mirror of
https://github.com/Benexl/FastAnime.git
synced 2026-01-06 17:53:40 -08:00
feat: fix: registry command
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import click
|
||||
|
||||
from ....core.config.model import AppConfig
|
||||
from ...utils.lazyloader import LazyGroup
|
||||
from . import examples
|
||||
|
||||
@@ -26,10 +27,10 @@ commands = {
|
||||
epilog=examples.main,
|
||||
)
|
||||
@click.option(
|
||||
"--api",
|
||||
default="anilist",
|
||||
"--api",
|
||||
default="anilist",
|
||||
help="Media API to use (default: anilist)",
|
||||
type=click.Choice(["anilist"], case_sensitive=False)
|
||||
type=click.Choice(["anilist"], case_sensitive=False),
|
||||
)
|
||||
@click.pass_context
|
||||
def registry(ctx: click.Context, api: str):
|
||||
@@ -37,29 +38,32 @@ def registry(ctx: click.Context, api: str):
|
||||
The entry point for the 'registry' command. If no subcommand is invoked,
|
||||
it shows registry information and statistics.
|
||||
"""
|
||||
from ...service.registry.service import MediaRegistryService
|
||||
from ...utils.feedback import create_feedback_manager
|
||||
from ...service.feedback import FeedbackService
|
||||
from ...service.registry import MediaRegistryService
|
||||
|
||||
config = ctx.obj
|
||||
feedback = create_feedback_manager(config.general.icons)
|
||||
config: AppConfig = ctx.obj
|
||||
feedback = FeedbackService()
|
||||
|
||||
if ctx.invoked_subcommand is None:
|
||||
# Show registry overview and statistics
|
||||
try:
|
||||
registry_service = MediaRegistryService(api, config.registry)
|
||||
registry_service = MediaRegistryService(api, config.media_registry)
|
||||
stats = registry_service.get_registry_stats()
|
||||
|
||||
|
||||
feedback.info("Registry Overview", f"API: {api}")
|
||||
feedback.info("Total Media", f"{stats.get('total_media', 0)} entries")
|
||||
feedback.info("Recently Updated", f"{stats.get('recently_updated', 0)} entries in last 7 days")
|
||||
feedback.info("Storage Path", str(config.registry.media_dir))
|
||||
|
||||
feedback.info(
|
||||
"Recently Updated",
|
||||
f"{stats.get('recently_updated', 0)} entries in last 7 days",
|
||||
)
|
||||
feedback.info("Storage Path", str(config.media_registry.media_dir))
|
||||
|
||||
# Show status breakdown if available
|
||||
status_breakdown = stats.get('status_breakdown', {})
|
||||
status_breakdown = stats.get("status_breakdown", {})
|
||||
if status_breakdown:
|
||||
feedback.info("Status Breakdown:")
|
||||
for status, count in status_breakdown.items():
|
||||
feedback.info(f" {status.title()}", f"{count} entries")
|
||||
|
||||
feedback.info(f" {status}", f"{count} entries")
|
||||
|
||||
except Exception as e:
|
||||
feedback.error("Registry Error", f"Failed to load registry: {e}")
|
||||
|
||||
Reference in New Issue
Block a user