mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-12-23 08:03:32 +02:00
Loading all artist tracks in cycle
This commit is contained in:
parent
b945793689
commit
a4bf0f69c0
1 changed files with 16 additions and 6 deletions
|
@ -35,11 +35,21 @@ def list_artists(pg=None, search=None):
|
|||
|
||||
|
||||
def play_artist(artist_id):
|
||||
tracks = get_tracks(artist=artist_id, include_channels=True)
|
||||
tracks_results = tracks.get('results')
|
||||
tracks = get_tracks(artist=artist_id, include_channels=True, pg=None)
|
||||
tracks_next = tracks.get('next')
|
||||
tracks_count = tracks.get('count')
|
||||
storage = {}
|
||||
for i in tracks_results:
|
||||
listen_url = concatinate_endpoint(i.get('listen_url'))
|
||||
storage[listen_url] = i
|
||||
player.loadfile(listen_url, 'append-play')
|
||||
if tracks_count > 50:
|
||||
print(f'Loading {tracks_count} tracks...')
|
||||
while True:
|
||||
tracks_results = tracks.get('results')
|
||||
tracks_next = tracks.get('next')
|
||||
for i in tracks_results:
|
||||
listen_url = concatinate_endpoint(i.get('listen_url'))
|
||||
storage[listen_url] = i
|
||||
player.loadfile(listen_url, 'append-play')
|
||||
if tracks_next:
|
||||
tracks = get_tracks(artist=artist_id, include_channels=True, pg=tracks_next)
|
||||
else:
|
||||
break
|
||||
player_menu("Artist playing...", storage)
|
||||
|
|
Loading…
Reference in a new issue