tracks counter in menu tracks

This commit is contained in:
localhost_frssoft 2023-07-11 00:24:19 +03:00
parent 1d6e63e9e9
commit 984d14515a

View File

@ -1,7 +1,7 @@
from src.fw_api import get_tracks, get_audio_file
from src.fw_api import get_tracks
from src.fw_tags import list_tags
from src.fw_libraries import libraries
from src.mpv_control import player, player_menu, track_url_to_uuid, play_track
from src.mpv_control import play_track
from pyfzf.pyfzf import FzfPrompt
from loguru import logger
@ -11,6 +11,7 @@ fzf = FzfPrompt()
@logger.catch
def list_tracks(pg=None, search=None, tag=None, library=None):
tracks = get_tracks(q=search, pg=pg, tag=tag, library=library)
tracks_count = tracks.get('count')
tracks_next = tracks.get('next')
tracks_prev = tracks.get('previous')
tracks_results = tracks.get('results')
@ -24,7 +25,7 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
index = tracks_results.index(i)
track_name = i.get('title')
view.append(f'{index}.{track_name}')
select = fzf.prompt(view)
select = fzf.prompt(view, f'--header=\'Found {tracks_count} tracks\'')
if select == []:
return
else: