mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 10:31:28 +00: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):
|
||||
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 = {}
|
||||
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