Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions plex-playlist-sync/utils/spotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,23 @@ def _get_sp_user_playlists(

try:
sp_playlists = sp.user_playlists(user_id)
for playlist in sp_playlists["items"]:
playlists.append(
Playlist(
id=playlist["uri"],
name=playlist["name"] + suffix,
description=playlist.get("description", ""),
# playlists may not have a poster in such cases return ""
poster=""
if len(playlist["images"]) == 0
else playlist["images"][0].get("url", ""),
while sp_playlists:
for playlist in sp_playlists['items']:
playlists.append(
Playlist(
id=playlist["uri"],
name=playlist["name"] + suffix,
description=playlist.get("description", ""),
# playlists may not have a poster in such cases return ""
poster=""
if len(playlist["images"]) == 0
else playlist["images"][0].get("url", ""),
)
)
)
if sp_playlists['next']:
sp_playlists = sp.next(sp_playlists)
else:
sp_playlists = None
except:
logging.error("Spotify User ID Error")
return playlists
Expand Down