Skip to content

Commit

Permalink
Preserve original list-position, when local/unavailable songs are s…
Browse files Browse the repository at this point in the history
…kipped (#2105)

Co-authored-by: kuba <xnetcat.dev@gmail.com>
  • Loading branch information
dxrcy and xnetcat authored Jul 20, 2024
1 parent d78d071 commit 6890493
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spotdl/types/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_metadata(url: str) -> Tuple[Dict[str, Any], List[Song]]:
tracks.extend(playlist_response["items"])

songs = []
for track in tracks:
for track_no, track in enumerate(tracks):
if not isinstance(track, dict) or track.get("track") is None:
continue

Expand Down Expand Up @@ -137,6 +137,7 @@ def get_metadata(url: str) -> Tuple[Dict[str, Any], List[Song]]:
if (len(album_meta.get("images", [])) > 0)
else None
),
list_position=track_no + 1,
)

songs.append(song)
Expand Down
2 changes: 1 addition & 1 deletion spotdl/utils/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def get_simple_songs(
song_data = song.json
song_data["list_name"] = song_list.name
song_data["list_url"] = song_list.url
song_data["list_position"] = index + 1
song_data["list_position"] = song.list_position
song_data["list_length"] = song_list.length

if playlist_numbering:
Expand Down

0 comments on commit 6890493

Please sign in to comment.