Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ab0a00a77 | |||
9bb48dcc47 |
@ -400,8 +400,18 @@ class HipsterfyPlaylist(object):
|
|||||||
"""Load the playlist data from Spotify and extract track information.
|
"""Load the playlist data from Spotify and extract track information.
|
||||||
"""
|
"""
|
||||||
playlist_id = self._playlist_uri.split("/")[-1].split("?")[0]
|
playlist_id = self._playlist_uri.split("/")[-1].split("?")[0]
|
||||||
results = self._hipsterfy.sp.playlist_items(playlist_id, additional_types=['track'])
|
results = []
|
||||||
self._tracks_data = [HipsterfyPlaylistItem(item['track']) for item in results['items'] if item['track']]
|
last_page_reached = False
|
||||||
|
offset = 0
|
||||||
|
while not last_page_reached:
|
||||||
|
page_results = self._hipsterfy.sp.playlist_items(playlist_id, additional_types=['track'], limit=100, offset=offset)
|
||||||
|
tracks = [item['track'] for item in page_results['items'] if item['track']]
|
||||||
|
if not tracks:
|
||||||
|
last_page_reached = True
|
||||||
|
else:
|
||||||
|
results.extend(page_results['items'])
|
||||||
|
offset += len(page_results['items'])
|
||||||
|
self._tracks_data = [HipsterfyPlaylistItem(item['track']) for item in results]
|
||||||
def get_tracks_data(self) -> List[HipsterfyPlaylistItem]:
|
def get_tracks_data(self) -> List[HipsterfyPlaylistItem]:
|
||||||
"""Returns the list of HipsterfyPlaylistItem objects representing the tracks in the playlist.
|
"""Returns the list of HipsterfyPlaylistItem objects representing the tracks in the playlist.
|
||||||
"""
|
"""
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "hipsterfy"
|
name = "hipsterfy"
|
||||||
version = "0.2.0"
|
version = "0.2.2"
|
||||||
description = ""
|
description = ""
|
||||||
authors = [
|
authors = [
|
||||||
{name="Jonas Weinz"}
|
{name="Jonas Weinz"}
|
||||||
@ -16,7 +16,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "hipsterfy"
|
name = "hipsterfy"
|
||||||
version = "0.2.0"
|
version = "0.2.2"
|
||||||
description = ""
|
description = ""
|
||||||
authors = [
|
authors = [
|
||||||
"Jonas Weinz"
|
"Jonas Weinz"
|
||||||
|
Reference in New Issue
Block a user