feat(player-controls-menu): add media actions menu option

This commit is contained in:
Benexl
2025-07-27 00:17:41 +03:00
parent 99809f3fd3
commit 276c8d48d9
3 changed files with 11 additions and 6 deletions

View File

@@ -68,9 +68,8 @@ def player_controls(ctx: Context, state: State) -> Union[State, InternalDirectiv
f"{'🔘 ' if icons else ''}Toggle Translation Type (Current: {ctx.config.stream.translation_type.upper()})": _toggle_config_state(
ctx, state, "TRANSLATION_TYPE"
),
f"{'🏠 ' if icons else ''}Main Menu": lambda: State(
menu_name=MenuName.MAIN
),
f"{'🎥 ' if icons else ''}Media Actions Menu": lambda: InternalDirective.BACKX4,
f"{'🏠 ' if icons else ''}Main Menu": lambda: InternalDirective.MAIN,
f"{'' if icons else ''}Exit": lambda: InternalDirective.EXIT,
}
)

View File

@@ -247,7 +247,7 @@ class Session:
if isinstance(next_step, InternalDirective):
if next_step == InternalDirective.MAIN:
self._history = [self._history[0]]
if next_step == InternalDirective.RELOAD:
elif next_step == InternalDirective.RELOAD:
continue
elif next_step == InternalDirective.CONFIG_EDIT:
self._edit_config()
@@ -263,6 +263,12 @@ class Session:
self._history.pop()
self._history.pop()
self._history.pop()
elif next_step == InternalDirective.BACKX4:
if len(self._history) > 4:
self._history.pop()
self._history.pop()
self._history.pop()
self._history.pop()
elif next_step == InternalDirective.EXIT:
break
else:

View File

@@ -14,12 +14,12 @@ class InternalDirective(Enum):
BACK = "BACK"
BACK_FORCE = "BACK_FORCE"
BACKX2 = "BACKX2"
BACKX3 = "BACKX3"
BACKX4 = "BACKX4"
EXIT = "EXIT"
CONFIG_EDIT = "CONFIG_EDIT"