From 80b41f06da50d46ab5dfc2631deb26de0abd576f Mon Sep 17 00:00:00 2001 From: Benex254 Date: Mon, 19 Aug 2024 15:25:05 +0300 Subject: [PATCH] feat:add new ui command --- .../cli/interfaces/anilist_interfaces.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/fastanime/cli/interfaces/anilist_interfaces.py b/fastanime/cli/interfaces/anilist_interfaces.py index 1d8e281..9d8cced 100644 --- a/fastanime/cli/interfaces/anilist_interfaces.py +++ b/fastanime/cli/interfaces/anilist_interfaces.py @@ -1010,6 +1010,42 @@ def media_actions_menu( media_actions_menu(config, fastanime_runtime_state) + def _change_player( + config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState" + ): + """Change the translation type to use + + Args: + config: [TODO:description] + fastanime_runtime_state: [TODO:description] + """ + # prompt for new translation type + options = ["syncplay", "mpv-mod", "default"] + if config.use_fzf: + player = fzf.run( + options, + prompt="Select Player:", + ) + elif config.use_rofi: + player = Rofi.run(options, "Select Player: ") + else: + player = fuzzy_inquirer( + options, + "Select Player", + ) + + # update internal config + if player == "syncplay": + config.sync_play = True + config.use_mpv_mod = False + else: + config.sync_play = False + if player == "mpv-mod": + config.use_mpv_mod = True + else: + config.use_mpv_mod = False + media_actions_menu(config, fastanime_runtime_state) + def _view_info(config: "Config", fastanime_runtime_state: "FastAnimeRuntimeState"): """helper function to view info of an anime from terminal @@ -1178,6 +1214,7 @@ def media_actions_menu( f"{'📖 ' if icons else ''}View Info": _view_info, f"{'🎧 ' if icons else ''}Change Translation Type": _change_translation_type, f"{'💽 ' if icons else ''}Change Provider": _change_provider, + f"{'💽 ' if icons else ''}Change Player": _change_player, f"{'🔘 ' if icons else ''}Toggle auto select anime": _toggle_auto_select, # WARN: problematic if you choose an anime that doesnt match id f"{'💠 ' if icons else ''}Toggle auto next episode": _toggle_auto_next, f"{'🔘 ' if icons else ''}Toggle continue from history": _toggle_continue_from_history,