Skip to content
This repository was archived by the owner on May 2, 2026. It is now read-only.

Commit 70e1445

Browse files
authored
Merge pull request #184 from iMithrellas/master
Add media_actions option to open AniList page
2 parents 148436e + 3df630a commit 70e1445

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

viu_media/cli/interactive/menu/media/media_actions.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ def media_actions(ctx: Context, state: State) -> State | InternalDirective:
7878
ctx, state
7979
),
8080
f"{'⭐ ' if icons else ''}Score Anime": _score_anime(ctx, state),
81+
f"{'🌐 ' if icons else ''}Open AniList Page": _open_anilist_page(
82+
ctx, state
83+
),
8184
f"{'ℹ️ ' if icons else ''}View Info": _view_info(ctx, state),
8285
f"{'📀 ' if icons else ''}Change Provider (Current: {ctx.config.general.provider.value.upper()})": _change_provider(
8386
ctx, state
@@ -624,6 +627,26 @@ def action():
624627
return action
625628

626629

630+
def _open_anilist_page(ctx: Context, state: State) -> MenuAction:
631+
def action():
632+
media_item = state.media_api.media_item
633+
634+
if not media_item:
635+
return InternalDirective.RELOAD
636+
637+
from .....libs.media_api.types import MediaType
638+
639+
base_type = "anime" if media_item.type == MediaType.ANIME else "manga"
640+
url = f"https://anilist.co/{base_type}/{media_item.id}"
641+
642+
from webbrowser import open
643+
644+
open(url)
645+
return InternalDirective.RELOAD
646+
647+
return action
648+
649+
627650
def _view_recommendations(ctx: Context, state: State) -> MenuAction:
628651
def action():
629652
feedback = ctx.feedback

0 commit comments

Comments
 (0)