Added radio by tag

This commit is contained in:
localhost_frssoft 2022-11-30 03:33:14 +03:00
parent 5d23553dd3
commit fa58dde080

View File

@ -1,5 +1,6 @@
from src.fw_api import s, get_radios, post_radio_session, get_track_radio, list_libraries, favorite_track, get_audio_file from src.fw_api import s, get_radios, post_radio_session, get_track_radio, list_libraries, favorite_track, get_audio_file
from src.fw_libraries import libraries from src.fw_libraries import libraries
from src.fw_tags import list_tags
from src.utils import download_track from src.utils import download_track
from src.mpv_control import player, track_url_to_uuid from src.mpv_control import player, track_url_to_uuid
from src.settings import get_config from src.settings import get_config
@ -31,14 +32,14 @@ def list_radios():
if s.headers.get('Authorization'): # Radios avalaible only for auth user if s.headers.get('Authorization'): # Radios avalaible only for auth user
view.append('Favourites') view.append('Favourites')
view.append('Less listened') view.append('Less listened')
view.append('Random') view.extend(['Tag', 'Random', 'Libraries', 'Users', 'Recently Added'])
view.append('Libraries')
view.append('Users')
view.append('Recently Added')
selected = fzf.prompt(view, f'--header \'Found {count} radios\' --read0', delimiter="\0")[0].split('.', 1) selected = fzf.prompt(view, f'--header \'Found {count} radios\' --read0', delimiter="\0")[0].split('.', 1)
if 'Favourites' in selected: if 'Favourites' in selected:
radio_load(id_radio, 'favorites', name='your favorites tracks') radio_load(id_radio, 'favorites', name='your favorites tracks')
elif 'Tag' in selected:
tag = list_tags()
radio_load(type_radio='tag', name=f'Radio by tag: {tag}', related_object=tag)
elif 'Random' in selected: elif 'Random' in selected:
radio_load(id_radio, 'random', name='totally random') radio_load(id_radio, 'random', name='totally random')
elif 'Libraries' in selected: elif 'Libraries' in selected: