diff --git a/src/fw_recents.py b/src/fw_recents.py index 0c64702..32c4e86 100644 --- a/src/fw_recents.py +++ b/src/fw_recents.py @@ -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: for i in tracks_results: 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: for i in select: play_track(track=tracks_results[int( diff --git a/src/fw_tracks.py b/src/fw_tracks.py index 3c297d1..ba4182d 100644 --- a/src/fw_tracks.py +++ b/src/fw_tracks.py @@ -1,7 +1,7 @@ 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 play_track +from src.mpv_control import play_track, player_fw_storage from pyfzf.pyfzf import FzfPrompt from loguru import logger import time @@ -48,6 +48,8 @@ def list_tracks(pg=None, search=None, tag=None, library=None): elif select == 'Play this page': for i in tracks_results: 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': if tracks_count > 500: yn = input('WARNING: you really want add more than 500 tracks? (y/[n] or number of tracks)\n').lower() diff --git a/src/mpv_control.py b/src/mpv_control.py index 9e88ba8..db1a62e 100644 --- a/src/mpv_control.py +++ b/src/mpv_control.py @@ -33,6 +33,8 @@ if get_config('termux_handle_track_switch_by_volume'): class player_fw_storage: storage = {} + menu_ctx = None + menu_ctx_args = None @logger.catch @@ -160,6 +162,8 @@ def player_menu(header='', storage={}): player_items_menu[3] = 'Shuffle' if show_like_button: 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']) select = fzf.prompt(player_items_menu, quote(f"--header=\'{header}\'")) @@ -196,6 +200,8 @@ def player_menu(header='', storage={}): elif select == 'Like': src.fw_api.favorite_track( 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': track = player_fw_storage.storage.get(track_url_to_uuid()) player.playlist_remove('current')