keyword uri args for spotnet functions

This commit is contained in:
aj 2020-08-07 11:00:24 +01:00
parent 8858feb297
commit 6b3748256b
3 changed files with 7 additions and 8 deletions

View File

@ -309,7 +309,7 @@ def image(user=None):
net = database.get_authed_spotify_network(user)
try:
return jsonify({'images': net.get_playlist(uri_string=_playlist.uri).images, 'status': 'success'}), 200
return jsonify({'images': net.get_playlist(uri=_playlist.uri).images, 'status': 'success'}), 200
except SpotifyNetworkException as e:
logger.exception(f'error occured during {_playlist.name} / {user.username} playlist retrieval')
return jsonify({'error': f"spotify error occured: {e.http_code}"}), 404

View File

@ -6,7 +6,6 @@ from music.model.user import User
from music.model.playlist import Playlist
from spotfm.maths.counter import Counter
from spotframework.model.uri import Uri
from spotframework.net.network import SpotifyNetworkException
from fmframework.net.network import LastFMNetworkException
@ -37,7 +36,7 @@ def refresh_lastfm_track_stats(username, playlist_name):
return
try:
spotify_playlist = spotnet.get_playlist(uri=Uri(playlist.uri))
spotify_playlist = spotnet.get_playlist(uri=playlist.uri)
except SpotifyNetworkException:
logger.exception(f'error retrieving spotify playlist {username} / {playlist_name}')
return
@ -83,7 +82,7 @@ def refresh_lastfm_album_stats(username, playlist_name):
return
try:
spotify_playlist = spotnet.get_playlist(uri=Uri(playlist.uri))
spotify_playlist = spotnet.get_playlist(uri=playlist.uri)
except SpotifyNetworkException:
logger.exception(f'error retrieving spotify playlist {username} / {playlist_name}')
return
@ -129,7 +128,7 @@ def refresh_lastfm_artist_stats(username, playlist_name):
return
try:
spotify_playlist = spotnet.get_playlist(uri=Uri(playlist.uri))
spotify_playlist = spotnet.get_playlist(uri=playlist.uri)
except SpotifyNetworkException:
logger.exception(f'error retrieving spotify playlist {username} / {playlist_name}')
return

View File

@ -167,8 +167,8 @@ def run_user_playlist(username, playlist_name):
# EXECUTE
try:
net.replace_playlist_tracks(uri_string=playlist.uri, uris=[i.uri for i, j
in zip(*get_track_objects(playlist_tracks))])
net.replace_playlist_tracks(uri=playlist.uri, uris=[i.uri for i, j
in zip(*get_track_objects(playlist_tracks))])
if playlist.description_overwrite:
string = playlist.description_overwrite
@ -183,7 +183,7 @@ def run_user_playlist(username, playlist_name):
return None
try:
net.change_playlist_details(Uri(playlist.uri), description=string)
net.change_playlist_details(uri=playlist.uri, description=string)
except SpotifyNetworkException:
logger.exception(f'error changing description for {username} / {playlist_name}')