diff --git a/.gitignore b/.gitignore index 9a69bd5..d9ba17e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +scratch.py node_modules/ diff --git a/spotify/api/spotify.py b/spotify/api/spotify.py index bbc9f7b..96d3e1a 100644 --- a/spotify/api/spotify.py +++ b/spotify/api/spotify.py @@ -2,7 +2,7 @@ from google.cloud import firestore import logging -from spotframework.net.user import User +from spotframework.net.user import NetworkUser from spotframework.net.network import Network db = firestore.Client() @@ -21,10 +21,10 @@ def create_playlist(username, name): user_dict = users[0].to_dict() spotify_keys = db.document('key/spotify').get().to_dict() - net = Network(User(spotify_keys['clientid'], - spotify_keys['clientsecret'], - user_dict['access_token'], - user_dict['refresh_token'])) + net = Network(NetworkUser(spotify_keys['clientid'], + spotify_keys['clientsecret'], + user_dict['access_token'], + user_dict['refresh_token'])) resp = net.create_playlist(net.user.username, name) diff --git a/spotify/tasks/play_user_playlist.py b/spotify/tasks/play_user_playlist.py index 345bd8e..1c254a6 100644 --- a/spotify/tasks/play_user_playlist.py +++ b/spotify/tasks/play_user_playlist.py @@ -5,11 +5,11 @@ import logging from spotframework.engine.playlistengine import PlaylistEngine from spotframework.engine.filter.shuffle import Shuffle -from spotframework.engine.filter.sortreversereleasedate import SortReverseReleaseDate -from spotframework.engine.filter.deduplicatebyid import DeduplicateByID +from spotframework.engine.filter.sort import SortReverseReleaseDate +from spotframework.engine.filter.deduplicate import DeduplicateByID from spotframework.net.network import Network -from spotframework.net.user import User +from spotframework.net.user import NetworkUser import spotify.db.database as database from spotify.db.part_generator import PartGenerator @@ -56,10 +56,10 @@ def play_user_playlist(username, spotify_keys = db.document('key/spotify').get().to_dict() - net = Network(User(spotify_keys['clientid'], - spotify_keys['clientsecret'], - user_dict['access_token'], - user_dict['refresh_token'])) + net = Network(NetworkUser(spotify_keys['clientid'], + spotify_keys['clientsecret'], + user_dict['access_token'], + user_dict['refresh_token'])) engine = PlaylistEngine(net) engine.load_user_playlists() @@ -95,7 +95,7 @@ def play_user_playlist(username, include_recommendations=include_recommendations, recommendation_limit=int(recommendation_sample)) - net.play(uris=[i['uri'] for i in tracks]) + net.play(uris=[i.uri for i in tracks]) else: logger.critical(f'multiple/no user(s) found ({username})') diff --git a/spotify/tasks/run_user_playlist.py b/spotify/tasks/run_user_playlist.py index 27dab06..fbc6729 100644 --- a/spotify/tasks/run_user_playlist.py +++ b/spotify/tasks/run_user_playlist.py @@ -5,11 +5,11 @@ import logging from spotframework.engine.playlistengine import PlaylistEngine from spotframework.engine.filter.shuffle import Shuffle -from spotframework.engine.filter.sortreversereleasedate import SortReverseReleaseDate -from spotframework.engine.filter.deduplicatebyid import DeduplicateByID +from spotframework.engine.filter.sort import SortReverseReleaseDate +from spotframework.engine.filter.deduplicate import DeduplicateByID from spotframework.net.network import Network -from spotframework.net.user import User +from spotframework.net.user import NetworkUser import spotify.db.database as database from spotify.db.part_generator import PartGenerator @@ -48,10 +48,10 @@ def run_user_playlist(username, playlist_name): spotify_keys = db.document('key/spotify').get().to_dict() - net = Network(User(spotify_keys['clientid'], - spotify_keys['clientsecret'], - user_dict['access_token'], - user_dict['refresh_token'])) + net = Network(NetworkUser(spotify_keys['clientid'], + spotify_keys['clientsecret'], + user_dict['access_token'], + user_dict['refresh_token'])) engine = PlaylistEngine(net) engine.load_user_playlists()