escape for fzf

This commit is contained in:
localhost_frssoft 2023-06-04 13:52:50 +03:00
parent 9c940a0bac
commit 982e5f5a87
2 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,7 @@ from src.mpv_control import player, track_url_to_uuid, player_fw_storage
from src.settings import get_config from src.settings import get_config
from pyfzf.pyfzf import FzfPrompt from pyfzf.pyfzf import FzfPrompt
from loguru import logger from loguru import logger
from shlex import quote
import threading import threading
import time import time
import sys import sys
@ -121,7 +122,7 @@ def radio_load(id_radio=None, type_radio='custom', name=None, related_object=Non
else: else:
player_items_menu[2] = 'Pause' player_items_menu[2] = 'Pause'
select = fzf.prompt(player_items_menu, select = fzf.prompt(player_items_menu,
f"--header=\'Radio {name} playing...\'")[0] quote(f"--header=\'Radio {name} playing...\'"))[0]
if select == 'Next': if select == 'Next':
playlist_remaining = player.playlist_count - player.playlist_current_pos playlist_remaining = player.playlist_count - player.playlist_current_pos
if playlist_remaining <= 2: if playlist_remaining <= 2:

View file

@ -4,6 +4,7 @@ from src.settings import get_config
from loguru import logger from loguru import logger
from pyfzf.pyfzf import FzfPrompt from pyfzf.pyfzf import FzfPrompt
from shutil import get_terminal_size from shutil import get_terminal_size
from shlex import quote
import mpv import mpv
import time import time
import sys import sys
@ -129,7 +130,7 @@ def player_menu(header='', storage={}):
player_items_menu.append('Like') player_items_menu.append('Like')
player_items_menu.extend(['Hide artist', 'Exit']) player_items_menu.extend(['Hide artist', 'Exit'])
select = fzf.prompt(player_items_menu, f"--header=\'{header}\'")[0] select = fzf.prompt(player_items_menu, quote(f"--header=\'{header}\'"))[0]
if select == 'Next': if select == 'Next':
try: try:
player.playlist_next() player.playlist_next()