mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 21:49:19 +02:00
Loading all artist tracks in cycle
This commit is contained in:
parent
b945793689
commit
a4bf0f69c0
|
@ -35,11 +35,21 @@ def list_artists(pg=None, search=None):
|
||||||
|
|
||||||
|
|
||||||
def play_artist(artist_id):
|
def play_artist(artist_id):
|
||||||
tracks = get_tracks(artist=artist_id, include_channels=True)
|
tracks = get_tracks(artist=artist_id, include_channels=True, pg=None)
|
||||||
tracks_results = tracks.get('results')
|
tracks_next = tracks.get('next')
|
||||||
|
tracks_count = tracks.get('count')
|
||||||
storage = {}
|
storage = {}
|
||||||
|
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:
|
for i in tracks_results:
|
||||||
listen_url = concatinate_endpoint(i.get('listen_url'))
|
listen_url = concatinate_endpoint(i.get('listen_url'))
|
||||||
storage[listen_url] = i
|
storage[listen_url] = i
|
||||||
player.loadfile(listen_url, 'append-play')
|
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)
|
player_menu("Artist playing...", storage)
|
||||||
|
|
Loading…
Reference in New Issue