mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-30 07:51:29 +00:00
Compare commits
3 commits
d64d251ea7
...
cd55c0a6fd
Author | SHA1 | Date | |
---|---|---|---|
localhost_frssoft | cd55c0a6fd | ||
localhost_frssoft | baa7974641 | ||
localhost_frssoft | b4998074b2 |
|
@ -23,7 +23,11 @@ def list_radios():
|
||||||
index = results.index(i)
|
index = results.index(i)
|
||||||
id_radio = i.get('id')
|
id_radio = i.get('id')
|
||||||
name = i.get('name')
|
name = i.get('name')
|
||||||
view.append(f'{index}.{name}')
|
descr = i.get('description')
|
||||||
|
radio_option = name
|
||||||
|
if descr and descr != "":
|
||||||
|
radio_option += f' | {descr}'
|
||||||
|
view.append(f'{index}.{radio_option}')
|
||||||
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')
|
||||||
|
@ -32,11 +36,11 @@ def list_radios():
|
||||||
view.append('Users')
|
view.append('Users')
|
||||||
view.append('Recently Added')
|
view.append('Recently Added')
|
||||||
|
|
||||||
selected = fzf.prompt(view, f'--header \'Found {count} radios\'')[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')
|
radio_load(id_radio, 'favorites', name='your favorites tracks')
|
||||||
elif 'Random' in selected:
|
elif 'Random' in selected:
|
||||||
radio_load(id_radio, 'random')
|
radio_load(id_radio, 'random', name='totally random')
|
||||||
elif 'Libraries' in selected:
|
elif 'Libraries' in selected:
|
||||||
id_radio, type_radio, name_radio, related_obj = libraries()
|
id_radio, type_radio, name_radio, related_obj = libraries()
|
||||||
radio_load(id_radio, type_radio, name_radio, related_obj)
|
radio_load(id_radio, type_radio, name_radio, related_obj)
|
||||||
|
@ -54,9 +58,9 @@ def list_radios():
|
||||||
lib_addr = input()
|
lib_addr = input()
|
||||||
radio_load(None, 'actor-content', lib_addr, lib_addr)
|
radio_load(None, 'actor-content', lib_addr, lib_addr)
|
||||||
elif 'Recently Added' in selected:
|
elif 'Recently Added' in selected:
|
||||||
radio_load(id_radio, 'recently-added')
|
radio_load(id_radio, 'recently-added', name='Newest content on the network')
|
||||||
elif 'Less listened' in selected:
|
elif 'Less listened' in selected:
|
||||||
radio_load(id_radio, 'less-listened')
|
radio_load(id_radio, 'less-listened', name="Less listened tracks")
|
||||||
else:
|
else:
|
||||||
id_selected = selected[0]
|
id_selected = selected[0]
|
||||||
id_radio = results[int(id_selected)].get('id')
|
id_radio = results[int(id_selected)].get('id')
|
||||||
|
@ -73,7 +77,9 @@ def radio_generator(radio_session_id):
|
||||||
count_t += 1
|
count_t += 1
|
||||||
if count_t >= 60:
|
if count_t >= 60:
|
||||||
count_t = 0
|
count_t = 0
|
||||||
radio_get_track(radio_session_id)
|
playlist_remaining = len(player.playlist) - player.playlist_current_pos
|
||||||
|
if playlist_remaining <= 2:
|
||||||
|
radio_get_track(radio_session_id)
|
||||||
logger.info('Radio generator stopped')
|
logger.info('Radio generator stopped')
|
||||||
|
|
||||||
radio_event_gen = threading.Event()
|
radio_event_gen = threading.Event()
|
||||||
|
@ -103,7 +109,9 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
|
||||||
try:
|
try:
|
||||||
select = fzf.prompt(player_items_menu, f"--header=\'Radio {name} playing...\'")[0]
|
select = fzf.prompt(player_items_menu, f"--header=\'Radio {name} playing...\'")[0]
|
||||||
if select == 'Next':
|
if select == 'Next':
|
||||||
threading.Thread(target=radio_get_track, args=(radio_session_id,), daemon=True).start()
|
playlist_remaining = len(player.playlist) - player.playlist_current_pos
|
||||||
|
if playlist_remaining <= 2:
|
||||||
|
threading.Thread(target=radio_get_track, args=(radio_session_id,), daemon=True).start()
|
||||||
player.playlist_next()
|
player.playlist_next()
|
||||||
elif select == 'Prev':
|
elif select == 'Prev':
|
||||||
player.playlist_prev()
|
player.playlist_prev()
|
||||||
|
|
Loading…
Reference in a new issue