How sdaqo/anipy-cli works
Main Components
• API Component:
• Core Library: Wrapped up in “api/src/anipy_api”, it includes modules for handling anime data (anime.py), error handling (error.py), and downloading.
• Player Subsystem: Located under “api/src/anipy_api/player” with multiple implementations (iina, mpv, syncplay, vlc) for launching or controlling media playback.
• Provider Subsystem: Found under “api/src/anipy_api/provider” which contains base classes, filters, and concrete provider implementations (e.g., anivibe_provider, gogo_provider) to fetch anime streams or metadata.
• Utility Modules: Support files (like locallist.py, mal.py, and players utils) indicate integrations, such as with MyAnimeList and local lists.
• CLI Component:
• Command Parsers and Interfaces: In “cli/src/anipy_cli” there is an “arg_parser.py” and a “cli.py” that likely provide the initial command-line entry point.
• Sub-Commands / Menus: Documented as different “clis” (base_cli, binge_cli, default_cli, download_cli, history_cli, mal_cli, seasonal_cli) that define specific interactions.
• Additional Modules: Components such as “discord.py” (for Discord presence), “config.py”, and a dedicated “menus” sub-package provide user interface and integration functionality.
• Supporting Infrastructure:
• Documentation: The “docs” directory (with examples and getting started guides) and mkdocs.yml for generating online docs.
• CI/CD & Deployment: GitHub workflows (.github/workflows) for automation (publishing docs and python packages), build-related configuration files (pyproject.toml in both api and cli, flake.nix, shell.nix), and scripts for bumping versions or generating reference pages.
• Contribution & Legal Files: LICENSE, CONTRIBUTING.md, DISCLAIMER.md, etc., frame the operational and legal boundaries.
Relationships and Interactions
• The CLI layer depends on the API component to perform all backend processing such as fetching anime data, managing downloads, and interfacing with multiple providers and players.
• Within the API, there is a clear separation between core logic, the player subsystem (handling media playback), and provider subsystem (managing content sources).
• External integrations like MyAnimeList (mal.py and related CLI commands) and Discord presence (discord.py) interact with their corresponding parts of both API and CLI.
• The utility scripts and workflows indicate an automated build/test/deployment cycle which supports continuous integration.
Architectural Patterns and Principles
• Separation of Concerns: Notice how the project clearly splits core API functions from the CLI (client) functionality. This encourages reusability and integration with other projects.
• Modular Design: Different functionalities (players, providers, menus, and commands) are separated into their own modules and packages.
• Extensibility: The structure (with “providers/providers” and “clis/clis”) indicates that new components can be easily added without major refactoring.