From 52b2b208e3146b4269daf1a12e0220cdde96437c Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Mon, 14 Nov 2022 02:26:47 +0300 Subject: [PATCH] Optional like button for radio player menu --- src/fw_radios.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fw_radios.py b/src/fw_radios.py index 7fe82c3..990f4e1 100644 --- a/src/fw_radios.py +++ b/src/fw_radios.py @@ -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()