fully objectified model
This commit is contained in:
parent
20939400de
commit
7f5c7709af
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
scratch.py
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ from google.cloud import firestore
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from spotframework.net.user import User
|
from spotframework.net.user import NetworkUser
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
|
|
||||||
db = firestore.Client()
|
db = firestore.Client()
|
||||||
@ -21,7 +21,7 @@ def create_playlist(username, name):
|
|||||||
user_dict = users[0].to_dict()
|
user_dict = users[0].to_dict()
|
||||||
spotify_keys = db.document('key/spotify').get().to_dict()
|
spotify_keys = db.document('key/spotify').get().to_dict()
|
||||||
|
|
||||||
net = Network(User(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['access_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['refresh_token']))
|
||||||
|
@ -5,11 +5,11 @@ import logging
|
|||||||
|
|
||||||
from spotframework.engine.playlistengine import PlaylistEngine
|
from spotframework.engine.playlistengine import PlaylistEngine
|
||||||
from spotframework.engine.filter.shuffle import Shuffle
|
from spotframework.engine.filter.shuffle import Shuffle
|
||||||
from spotframework.engine.filter.sortreversereleasedate import SortReverseReleaseDate
|
from spotframework.engine.filter.sort import SortReverseReleaseDate
|
||||||
from spotframework.engine.filter.deduplicatebyid import DeduplicateByID
|
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
||||||
|
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
from spotframework.net.user import User
|
from spotframework.net.user import NetworkUser
|
||||||
|
|
||||||
import spotify.db.database as database
|
import spotify.db.database as database
|
||||||
from spotify.db.part_generator import PartGenerator
|
from spotify.db.part_generator import PartGenerator
|
||||||
@ -56,7 +56,7 @@ def play_user_playlist(username,
|
|||||||
|
|
||||||
spotify_keys = db.document('key/spotify').get().to_dict()
|
spotify_keys = db.document('key/spotify').get().to_dict()
|
||||||
|
|
||||||
net = Network(User(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['access_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['refresh_token']))
|
||||||
@ -95,7 +95,7 @@ def play_user_playlist(username,
|
|||||||
include_recommendations=include_recommendations,
|
include_recommendations=include_recommendations,
|
||||||
recommendation_limit=int(recommendation_sample))
|
recommendation_limit=int(recommendation_sample))
|
||||||
|
|
||||||
net.play(uris=[i['uri'] for i in tracks])
|
net.play(uris=[i.uri for i in tracks])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.critical(f'multiple/no user(s) found ({username})')
|
logger.critical(f'multiple/no user(s) found ({username})')
|
||||||
|
@ -5,11 +5,11 @@ import logging
|
|||||||
|
|
||||||
from spotframework.engine.playlistengine import PlaylistEngine
|
from spotframework.engine.playlistengine import PlaylistEngine
|
||||||
from spotframework.engine.filter.shuffle import Shuffle
|
from spotframework.engine.filter.shuffle import Shuffle
|
||||||
from spotframework.engine.filter.sortreversereleasedate import SortReverseReleaseDate
|
from spotframework.engine.filter.sort import SortReverseReleaseDate
|
||||||
from spotframework.engine.filter.deduplicatebyid import DeduplicateByID
|
from spotframework.engine.filter.deduplicate import DeduplicateByID
|
||||||
|
|
||||||
from spotframework.net.network import Network
|
from spotframework.net.network import Network
|
||||||
from spotframework.net.user import User
|
from spotframework.net.user import NetworkUser
|
||||||
import spotify.db.database as database
|
import spotify.db.database as database
|
||||||
from spotify.db.part_generator import PartGenerator
|
from spotify.db.part_generator import PartGenerator
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ def run_user_playlist(username, playlist_name):
|
|||||||
|
|
||||||
spotify_keys = db.document('key/spotify').get().to_dict()
|
spotify_keys = db.document('key/spotify').get().to_dict()
|
||||||
|
|
||||||
net = Network(User(spotify_keys['clientid'],
|
net = Network(NetworkUser(spotify_keys['clientid'],
|
||||||
spotify_keys['clientsecret'],
|
spotify_keys['clientsecret'],
|
||||||
user_dict['access_token'],
|
user_dict['access_token'],
|
||||||
user_dict['refresh_token']))
|
user_dict['refresh_token']))
|
||||||
|
Loading…
Reference in New Issue
Block a user