More accesible play\pause buttons (partially no static)

This commit is contained in:
localhost_frssoft 2022-11-29 21:56:33 +03:00
parent ec26772089
commit 3124613c3a
2 changed files with 10 additions and 3 deletions

View File

@ -102,11 +102,16 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
radio_task = threading.Thread(target=radio_generator, args=(radio_session_id,), daemon=True)
radio_task.start()
player_items_menu = ['Next', 'Prev', 'Pause', 'Download', 'Info']
if show_like_button:
player_items_menu.append('Like')
player_items_menu.extend(['Hide artist', 'Exit'])
while True:
try:
if player.pause:
player_items_menu[2] = 'Play'
else:
player_items_menu[2] = 'Pause'
select = fzf.prompt(player_items_menu, f"--header=\'Radio {name} playing...\'")[0]
if select == 'Next':
playlist_remaining = len(player.playlist) - player.playlist_current_pos
@ -117,10 +122,8 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
player.playlist_prev()
elif select in ('Pause', 'Play'):
if player.pause:
player_items_menu[2] = 'Pause'
player.pause = False
else:
player_items_menu[2] = 'Play'
player.pause = True
elif select == 'Download':
print('Downloading...')

View File

@ -38,6 +38,10 @@ def player_menu(header='', storage={}):
try:
player_items_menu = ['Next', 'Prev', 'Pause',
'Download', 'Info']
if player.pause:
player_items_menu[2] = 'Play'
else:
player_items_menu[2] = 'Pause'
if show_like_button:
player_items_menu.append('Like')
player_items_menu.extend(['Hide artist', 'Exit'])
@ -47,7 +51,7 @@ def player_menu(header='', storage={}):
player.playlist_next()
elif select == 'Prev':
player.playlist_prev()
elif select == 'Pause':
elif select in ('Pause', 'Play'):
if player.pause:
player.pause = False
else: