Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
blastbeng committed Oct 4, 2024
1 parent 1bb1e79 commit d486cb8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions spotisub/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,21 @@ def artist_top_tracks_run(uuid):
if playlist_info_db is not None and playlist_info_db.uuid is not None:
artist = get_artist(playlist_info_db.import_arg)
if artist is not None and "uri" in artist and artist["uri"] is not None:
playlist_name = playlist_info_db.name + " - Top Tracks"
playlist_name = playlist_info_db.import_arg + " - Top Tracks"
playlist_info = {}
playlist_info["uuid"] = playlist_info_db.uuid
playlist_info["name"] = playlist_name
playlist_info["import_arg"] = name
playlist_info["import_arg"] = playlist_info_db.import_arg
playlist_info["spotify_uri"] = artist["uri"]
playlist_info["type"] = constants.JOB_ATT_ID
logging.info('(%s) Searching top tracks for: %s',
str(threading.current_thread().ident), artist_name)
sp = spotipy_helper.get_spotipy_client()
artist_top = sp.artist_top_tracks(artists_uri[artist_name])
subsonic_helper.write_playlist(sp, playlist_info, artist_top)
else:
logging.warning('(%s) Artist: %s Not found!',
str(threading.current_thread().ident), playlist_info_db.import_arg)

if os.environ.get(constants.ARTIST_GEN_SCHED, constants.ARTIST_GEN_SCHED_DEFAULT_VALUE) == "0":
scheduler.remove_job(id=constants.JOB_ATT_ID)
Expand Down Expand Up @@ -243,15 +246,15 @@ def show_recommendations_for_artist_run(uuid):
if playlist_info_db is not None and playlist_info_db.uuid is not None:
artist = get_artist(playlist_info_db.import_arg)
if artist is not None and "uri" in artist and artist["uri"] is not None:
playlist_name = playlist_info_db.name + " - Recommendations"
playlist_name = playlist_info_db.import_arg + " - Recommendations"
playlist_info = {}
playlist_info["uuid"] = playlist_info_db.uuid
playlist_info["name"] = playlist_name
playlist_info["spotify_uri"] = artist["uri"]
playlist_info["type"] = constants.JOB_AR_ID
playlist_info["import_arg"] = name
playlist_info["import_arg"] = playlist_info_db.import_arg
logging.info('(%s) Searching recommendations for: %s',
str(threading.current_thread().ident), name)
str(threading.current_thread().ident), playlist_info_db.import_arg)
sp = spotipy_helper.get_spotipy_client()
results = sp.recommendations(
seed_artists=[
Expand All @@ -263,7 +266,7 @@ def show_recommendations_for_artist_run(uuid):
subsonic_helper.write_playlist(sp, playlist_info, results)
else:
logging.warning('(%s) Artist: %s Not found!',
str(threading.current_thread().ident), name)
str(threading.current_thread().ident), playlist_info_db.import_arg)

if os.environ.get(constants.ARTIST_GEN_SCHED, constants.ARTIST_GEN_SCHED_DEFAULT_VALUE) == "0":
scheduler.remove_job(id=constants.JOB_AR_ID)
Expand Down Expand Up @@ -363,7 +366,7 @@ def get_user_saved_tracks_run(uuid):
if playlist_info_db is not None and playlist_info_db.uuid is not None:
playlist_info = {}
playlist_info["uuid"] = playlist_info_db.uuid
playlist_info["name"] = playlist_info_db.name
playlist_info["name"] = playlist_info_db.subsonic_playlist_name
playlist_info["spotify_uri"] = None
playlist_info["type"] = constants.JOB_ST_ID
playlist_info["import_arg"] = ""
Expand Down

0 comments on commit d486cb8

Please sign in to comment.