feat: add media action to open anilist page

This commit is contained in:
iMithrellas
2026-01-30 13:36:46 +01:00
parent 148436e27c
commit 3df630a2af

View File

@@ -78,6 +78,9 @@ def media_actions(ctx: Context, state: State) -> State | InternalDirective:
ctx, state
),
f"{'' if icons else ''}Score Anime": _score_anime(ctx, state),
f"{'🌐 ' if icons else ''}Open AniList Page": _open_anilist_page(
ctx, state
),
f"{' ' if icons else ''}View Info": _view_info(ctx, state),
f"{'📀 ' if icons else ''}Change Provider (Current: {ctx.config.general.provider.value.upper()})": _change_provider(
ctx, state
@@ -624,6 +627,26 @@ def _view_info(ctx: Context, state: State) -> MenuAction:
return action
def _open_anilist_page(ctx: Context, state: State) -> MenuAction:
def action():
media_item = state.media_api.media_item
if not media_item:
return InternalDirective.RELOAD
from .....libs.media_api.types import MediaType
base_type = "anime" if media_item.type == MediaType.ANIME else "manga"
url = f"https://anilist.co/{base_type}/{media_item.id}"
from webbrowser import open
open(url)
return InternalDirective.RELOAD
return action
def _view_recommendations(ctx: Context, state: State) -> MenuAction:
def action():
feedback = ctx.feedback