From 89ff453778828798efd2bf87f10fcad56b225dfb Mon Sep 17 00:00:00 2001 From: Aethar Date: Sat, 26 Jul 2025 17:37:43 +0900 Subject: [PATCH 1/2] stats fix --- .../cli/commands/anilist/commands/stats.py | 95 ++++++++++--------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/fastanime/cli/commands/anilist/commands/stats.py b/fastanime/cli/commands/anilist/commands/stats.py index 04bbb21..35c4f89 100644 --- a/fastanime/cli/commands/anilist/commands/stats.py +++ b/fastanime/cli/commands/anilist/commands/stats.py @@ -32,60 +32,61 @@ def stats(config: "AppConfig"): media_api_client = create_api_client(config.general.media_api, config) - # Check authentication + try: + # Check authentication - if profile := auth.get_auth(): - if not media_api_client.authenticate(profile.token): - feedback.error( - "Authentication Required", - f"You must be logged in to {config.general.media_api} to sync your media list.", - ) - feedback.info("Run this command to authenticate:", f"fastanime {config.general.media_api} auth") - raise click.Abort() - - - - - # Check if kitten is available for image display - KITTEN_EXECUTABLE = shutil.which("kitten") - if not KITTEN_EXECUTABLE: - feedback.warning("Kitten not found - profile image will not be displayed") - else: - # Display profile image using kitten icat - if user_profile.avatar_url: - console.clear() - image_x = int(console.size.width * 0.1) - image_y = int(console.size.height * 0.1) - img_w = console.size.width // 3 - img_h = console.size.height // 3 - - image_process = subprocess.run( - [ - KITTEN_EXECUTABLE, - "icat", - "--clear", - "--place", - f"{img_w}x{img_h}@{image_x}x{image_y}", - user_profile.avatar_url, - ], - check=False, + if profile := auth.get_auth(): + if not media_api_client.authenticate(profile.token): + feedback.error( + "Authentication Required", + f"You must be logged in to {config.general.media_api} to sync your media list.", ) + feedback.info("Run this command to authenticate:", f"fastanime {config.general.media_api} auth") + raise click.Abort() - if image_process.returncode != 0: - feedback.warning("Failed to display profile image") - # Display user information - about_text = getattr(user_profile, "about", "") or "No description available" - console.print( - Panel( - Markdown(about_text), - title=f"📊 {user_profile.name}'s Profile", + + # Check if kitten is available for image display + KITTEN_EXECUTABLE = shutil.which("kitten") + if not KITTEN_EXECUTABLE: + feedback.warning("Kitten not found - profile image will not be displayed") + else: + # Display profile image using kitten icat + if profile.avatar_url: + console.clear() + image_x = int(console.size.width * 0.1) + image_y = int(console.size.height * 0.1) + img_w = console.size.width // 3 + img_h = console.size.height // 3 + + image_process = subprocess.run( + [ + KITTEN_EXECUTABLE, + "icat", + "--clear", + "--place", + f"{img_w}x{img_h}@{image_x}x{image_y}", + profile.avatar_url, + ], + check=False, + ) + + if image_process.returncode != 0: + feedback.warning("Failed to display profile image") + + # Display user information + about_text = getattr(profile, "about", "") or "No description available" + + console.print( + Panel( + Markdown(about_text), + title=f"📊 {profile.name}'s Profile", + ) ) - ) - # You can add more stats here if the API provides them - feedback.success("User profile displayed successfully") + # You can add more stats here if the API provides them + feedback.success("User profile displayed successfully") except FastAnimeError as e: feedback.error("Failed to fetch user stats", str(e)) From 6cfc766db37a803e53bd4e0b5c07da983c3f3f0e Mon Sep 17 00:00:00 2001 From: Aethar Date: Sat, 26 Jul 2025 17:44:19 +0900 Subject: [PATCH 2/2] fix for auto enum --- fastanime/cli/interactive/state.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fastanime/cli/interactive/state.py b/fastanime/cli/interactive/state.py index 00dc4e2..51a27e2 100644 --- a/fastanime/cli/interactive/state.py +++ b/fastanime/cli/interactive/state.py @@ -12,19 +12,19 @@ from ...libs.provider.anime.types import Anime, SearchResults, Server class InternalDirective(Enum): MAIN = "MAIN" - BACK = auto() + BACK = "BACK" - BACK_FORCE = auto() + BACK_FORCE = "BACK_FORCE" - BACKX2 = auto() + BACKX2 = "BACKX2" - BACKX3 = auto() + BACKX3 = "BACKX3" - EXIT = auto() + EXIT = "EXIT" - CONFIG_EDIT = auto() + CONFIG_EDIT = "CONFIG_EDIT" - RELOAD = auto() + RELOAD = "RELOAD" class MenuName(Enum):