mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-27 19:51:28 +00:00
try adding context to player menu
This commit is contained in:
parent
1c90dd5d0e
commit
78dca31aa4
|
@ -47,6 +47,8 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
|
||||||
elif 'Play this page' in select:
|
elif 'Play this page' in select:
|
||||||
for i in tracks_results:
|
for i in tracks_results:
|
||||||
play_track(track=i['track'], multi=True)
|
play_track(track=i['track'], multi=True)
|
||||||
|
player_fw_storage.menu_ctx = list_fav_or_history
|
||||||
|
player_fw_storage.menu_ctx_args = [pg]
|
||||||
elif len(select) > 1:
|
elif len(select) > 1:
|
||||||
for i in select:
|
for i in select:
|
||||||
play_track(track=tracks_results[int(
|
play_track(track=tracks_results[int(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from src.fw_api import get_tracks
|
from src.fw_api import get_tracks
|
||||||
from src.fw_tags import list_tags
|
from src.fw_tags import list_tags
|
||||||
from src.fw_libraries import libraries
|
from src.fw_libraries import libraries
|
||||||
from src.mpv_control import play_track
|
from src.mpv_control import play_track, player_fw_storage
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
import time
|
import time
|
||||||
|
@ -48,6 +48,8 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
|
||||||
elif select == 'Play this page':
|
elif select == 'Play this page':
|
||||||
for i in tracks_results:
|
for i in tracks_results:
|
||||||
play_track(track=i, multi=True)
|
play_track(track=i, multi=True)
|
||||||
|
player_fw_storage.menu_ctx = list_tracks
|
||||||
|
player_fw_storage.menu_ctx_args = [pg]
|
||||||
elif select == 'Play all pages':
|
elif select == 'Play all pages':
|
||||||
if tracks_count > 500:
|
if tracks_count > 500:
|
||||||
yn = input('WARNING: you really want add more than 500 tracks? (y/[n] or number of tracks)\n').lower()
|
yn = input('WARNING: you really want add more than 500 tracks? (y/[n] or number of tracks)\n').lower()
|
||||||
|
|
|
@ -33,6 +33,8 @@ if get_config('termux_handle_track_switch_by_volume'):
|
||||||
|
|
||||||
class player_fw_storage:
|
class player_fw_storage:
|
||||||
storage = {}
|
storage = {}
|
||||||
|
menu_ctx = None
|
||||||
|
menu_ctx_args = None
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
|
@ -160,6 +162,8 @@ def player_menu(header='', storage={}):
|
||||||
player_items_menu[3] = 'Shuffle'
|
player_items_menu[3] = 'Shuffle'
|
||||||
if show_like_button:
|
if show_like_button:
|
||||||
player_items_menu.append('Like')
|
player_items_menu.append('Like')
|
||||||
|
if player_fw_storage.menu_ctx:
|
||||||
|
player_items_menu.append('Add more tracks')
|
||||||
player_items_menu.extend(['Hide artist', 'Exit'])
|
player_items_menu.extend(['Hide artist', 'Exit'])
|
||||||
|
|
||||||
select = fzf.prompt(player_items_menu, quote(f"--header=\'{header}\'"))
|
select = fzf.prompt(player_items_menu, quote(f"--header=\'{header}\'"))
|
||||||
|
@ -196,6 +200,8 @@ def player_menu(header='', storage={}):
|
||||||
elif select == 'Like':
|
elif select == 'Like':
|
||||||
src.fw_api.favorite_track(
|
src.fw_api.favorite_track(
|
||||||
player_fw_storage.storage.get(track_url_to_uuid())['id'])
|
player_fw_storage.storage.get(track_url_to_uuid())['id'])
|
||||||
|
elif select == 'Add more tracks':
|
||||||
|
player_fw_storage.menu_ctx(pg=player_fw_storage.menu_ctx_args[0])
|
||||||
elif select == 'Hide artist':
|
elif select == 'Hide artist':
|
||||||
track = player_fw_storage.storage.get(track_url_to_uuid())
|
track = player_fw_storage.storage.get(track_url_to_uuid())
|
||||||
player.playlist_remove('current')
|
player.playlist_remove('current')
|
||||||
|
|
Loading…
Reference in a new issue