mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-27 17:43:02 +00:00
Optional like button for radio player menu
This commit is contained in:
parent
327dae09da
commit
52b2b208e3
@ -2,6 +2,7 @@ from src.fw_api import s, get_radios, post_radio_session, get_track_radio, list_
|
||||
from src.fw_libraries import libraries
|
||||
from src.utils import download_track
|
||||
from src.mpv_control import player
|
||||
from src.settings import get_config
|
||||
from pyfzf.pyfzf import FzfPrompt
|
||||
from loguru import logger
|
||||
import threading
|
||||
@ -80,6 +81,7 @@ radio_event_gen = threading.Event()
|
||||
|
||||
@logger.catch
|
||||
def radio_load(id_radio=None, type_radio='custom', name=None, related_object=None):
|
||||
show_like_button = get_config('show_like_button')
|
||||
requested_radio = {
|
||||
'custom_radio': id_radio,
|
||||
'radio_type': type_radio,
|
||||
@ -94,7 +96,12 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
|
||||
radio_task.start()
|
||||
while True:
|
||||
try:
|
||||
select = fzf.prompt(('Next', 'Prev', 'Pause', 'Download', 'Info', 'Exit'), f"--header=\'Radio {name} playing...\'")[0]
|
||||
player_items_menu = ['Next', 'Prev', 'Pause',
|
||||
'Download', 'Info']
|
||||
if show_like_button:
|
||||
player_items_menu.append('Like')
|
||||
player_items_menu.extend(['Hide artist', 'Exit'])
|
||||
select = fzf.prompt(player_items_menu, f"--header=\'Radio {name} playing...\'")[0]
|
||||
if select == 'Next':
|
||||
threading.Thread(target=radio_get_track, args=(radio_session_id,), daemon=True).start()
|
||||
player.playlist_next()
|
||||
|
Loading…
Reference in New Issue
Block a user