make spotify tracks seekable and change Playlist.selected_track
This commit is contained in:
parent
02621cf669
commit
ec02cbe146
|
|
@ -74,7 +74,6 @@ class Playlist:
|
|||
self.spotify = spotify
|
||||
|
||||
self.name = playlist_info.get("name")
|
||||
self.selected_track = playlist_info.get("selectedTrack")
|
||||
|
||||
self._thumbnail = thumbnail
|
||||
self._uri = uri
|
||||
|
|
@ -87,6 +86,11 @@ class Playlist:
|
|||
for track in self.tracks_raw
|
||||
]
|
||||
|
||||
if (index := playlist_info.get("selectedTrack")) == -1:
|
||||
self.selected_track = None
|
||||
else:
|
||||
self.selected_track = self.tracks[index]
|
||||
|
||||
self.track_count = len(self.tracks)
|
||||
|
||||
def __str__(self):
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ class Node:
|
|||
"identifier": spotify_results.id,
|
||||
"uri": spotify_results.uri,
|
||||
"isStream": False,
|
||||
"isSeekable": False,
|
||||
"isSeekable": True,
|
||||
"position": 0,
|
||||
"thumbnail": spotify_results.image
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ class Node:
|
|||
"identifier": track.id,
|
||||
"uri": track.uri,
|
||||
"isStream": False,
|
||||
"isSeekable": False,
|
||||
"isSeekable": True,
|
||||
"position": 0,
|
||||
"thumbnail": track.image
|
||||
}
|
||||
|
|
@ -335,7 +335,7 @@ class Node:
|
|||
]
|
||||
|
||||
return Playlist(
|
||||
playlist_info={"name": spotify_results.name, "selectedTrack": tracks[0]},
|
||||
playlist_info={"name": spotify_results.name, "selectedTrack": 0},
|
||||
tracks=tracks,
|
||||
ctx=ctx,
|
||||
spotify=True,
|
||||
|
|
|
|||
Loading…
Reference in New Issue