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.spotify = spotify
|
||||||
|
|
||||||
self.name = playlist_info.get("name")
|
self.name = playlist_info.get("name")
|
||||||
self.selected_track = playlist_info.get("selectedTrack")
|
|
||||||
|
|
||||||
self._thumbnail = thumbnail
|
self._thumbnail = thumbnail
|
||||||
self._uri = uri
|
self._uri = uri
|
||||||
|
|
@ -87,6 +86,11 @@ class Playlist:
|
||||||
for track in self.tracks_raw
|
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)
|
self.track_count = len(self.tracks)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ class Node:
|
||||||
"identifier": spotify_results.id,
|
"identifier": spotify_results.id,
|
||||||
"uri": spotify_results.uri,
|
"uri": spotify_results.uri,
|
||||||
"isStream": False,
|
"isStream": False,
|
||||||
"isSeekable": False,
|
"isSeekable": True,
|
||||||
"position": 0,
|
"position": 0,
|
||||||
"thumbnail": spotify_results.image
|
"thumbnail": spotify_results.image
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +327,7 @@ class Node:
|
||||||
"identifier": track.id,
|
"identifier": track.id,
|
||||||
"uri": track.uri,
|
"uri": track.uri,
|
||||||
"isStream": False,
|
"isStream": False,
|
||||||
"isSeekable": False,
|
"isSeekable": True,
|
||||||
"position": 0,
|
"position": 0,
|
||||||
"thumbnail": track.image
|
"thumbnail": track.image
|
||||||
}
|
}
|
||||||
|
|
@ -335,7 +335,7 @@ class Node:
|
||||||
]
|
]
|
||||||
|
|
||||||
return Playlist(
|
return Playlist(
|
||||||
playlist_info={"name": spotify_results.name, "selectedTrack": tracks[0]},
|
playlist_info={"name": spotify_results.name, "selectedTrack": 0},
|
||||||
tracks=tracks,
|
tracks=tracks,
|
||||||
ctx=ctx,
|
ctx=ctx,
|
||||||
spotify=True,
|
spotify=True,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue