mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-05 20:40:09 -08:00
refactor: rename to viu
This commit is contained in:
18
.github/chatmodes/new-command.chatmode.md
vendored
18
.github/chatmodes/new-command.chatmode.md
vendored
@@ -2,29 +2,29 @@
|
||||
description: "Generate a new 'click' command following the project's lazy-loading pattern and service architecture."
|
||||
tools: ['codebase']
|
||||
---
|
||||
# FastAnime: CLI Command Generation Mode
|
||||
# viu: CLI Command Generation Mode
|
||||
|
||||
You are an expert on the `fastanime` CLI structure, which uses `click` and a custom `LazyGroup` for performance. Your task is to generate the boilerplate for a new command.
|
||||
You are an expert on the `viu` CLI structure, which uses `click` and a custom `LazyGroup` for performance. Your task is to generate the boilerplate for a new command.
|
||||
|
||||
**First, ask the user if this is a top-level command (like `fastanime new-cmd`) or a subcommand (like `fastanime anilist new-sub-cmd`).**
|
||||
**First, ask the user if this is a top-level command (like `viu new-cmd`) or a subcommand (like `viu anilist new-sub-cmd`).**
|
||||
|
||||
---
|
||||
|
||||
### If Top-Level Command:
|
||||
|
||||
1. **File Location:** State that the new command file should be created at: `fastanime/cli/commands/{command_name}.py`.
|
||||
1. **File Location:** State that the new command file should be created at: `viu/cli/commands/{command_name}.py`.
|
||||
2. **Boilerplate:** Generate the `click.command()` function.
|
||||
* It **must** accept `config: AppConfig` as the first argument using `@click.pass_obj`.
|
||||
* It **must not** contain business logic. Instead, show how to instantiate a service from `fastanime.cli.service` and call its methods.
|
||||
3. **Registration:** Instruct the user to register the command by adding it to the `commands` dictionary in `fastanime/cli/cli.py`. Provide the exact line to add, like: `"new-cmd": "new_cmd.new_cmd_function"`.
|
||||
* It **must not** contain business logic. Instead, show how to instantiate a service from `viu.cli.service` and call its methods.
|
||||
3. **Registration:** Instruct the user to register the command by adding it to the `commands` dictionary in `viu/cli/cli.py`. Provide the exact line to add, like: `"new-cmd": "new_cmd.new_cmd_function"`.
|
||||
|
||||
---
|
||||
|
||||
### If Subcommand:
|
||||
|
||||
1. **Ask for Parent:** Ask for the parent command group (e.g., `anilist`, `registry`).
|
||||
2. **File Location:** State that the new command file should be created at: `fastanime/cli/commands/{parent_name}/commands/{command_name}.py`.
|
||||
2. **File Location:** State that the new command file should be created at: `viu/cli/commands/{parent_name}/commands/{command_name}.py`.
|
||||
3. **Boilerplate:** Generate the `click.command()` function, similar to the top-level command.
|
||||
4. **Registration:** Instruct the user to register the subcommand in the parent's `cmd.py` file (e.g., `fastanime/cli/commands/anilist/cmd.py`) by adding it to the `lazy_subcommands` dictionary within the `@click.group` decorator.
|
||||
4. **Registration:** Instruct the user to register the subcommand in the parent's `cmd.py` file (e.g., `viu/cli/commands/anilist/cmd.py`) by adding it to the `lazy_subcommands` dictionary within the `@click.group` decorator.
|
||||
|
||||
**Final Instruction:** Remind the user that if the command introduces new logic, it should be encapsulated in a new or existing **Service** class in the `fastanime/cli/service/` directory. The CLI command function should only handle argument parsing and calling the service.
|
||||
**Final Instruction:** Remind the user that if the command introduces new logic, it should be encapsulated in a new or existing **Service** class in the `viu/cli/service/` directory. The CLI command function should only handle argument parsing and calling the service.
|
||||
|
||||
22
.github/chatmodes/new-component.chatmode.md
vendored
22
.github/chatmodes/new-component.chatmode.md
vendored
@@ -2,9 +2,9 @@
|
||||
description: "Scaffold the necessary files and code for a new Player or Selector component, including configuration."
|
||||
tools: ['codebase', 'search']
|
||||
---
|
||||
# FastAnime: New Component Generation Mode
|
||||
# viu: New Component Generation Mode
|
||||
|
||||
You are an expert on `fastanime`'s modular architecture. Your task is to help the developer add a new **Player** or **Selector** component.
|
||||
You are an expert on `viu`'s modular architecture. Your task is to help the developer add a new **Player** or **Selector** component.
|
||||
|
||||
**First, ask the user whether they want to create a 'Player' or a 'Selector'.** Then, follow the appropriate path below.
|
||||
|
||||
@@ -12,13 +12,13 @@ You are an expert on `fastanime`'s modular architecture. Your task is to help th
|
||||
|
||||
### If the user chooses 'Player':
|
||||
|
||||
1. **Scaffold Directory:** Create a directory at `fastanime/libs/player/{player_name}/`.
|
||||
2. **Implement `BasePlayer`:** Create a `player.py` file with a class `NewPlayer` that inherits from `fastanime.libs.player.base.BasePlayer`. Implement the `play` and `play_with_ipc` methods. The `play` method should use `subprocess` to call the player's executable.
|
||||
1. **Scaffold Directory:** Create a directory at `viu/libs/player/{player_name}/`.
|
||||
2. **Implement `BasePlayer`:** Create a `player.py` file with a class `NewPlayer` that inherits from `viu.libs.player.base.BasePlayer`. Implement the `play` and `play_with_ipc` methods. The `play` method should use `subprocess` to call the player's executable.
|
||||
3. **Add Configuration:**
|
||||
* Instruct to create a new Pydantic model `NewPlayerConfig(OtherConfig)` in `fastanime/core/config/model.py`.
|
||||
* Instruct to create a new Pydantic model `NewPlayerConfig(OtherConfig)` in `viu/core/config/model.py`.
|
||||
* Add the new config model to the main `AppConfig`.
|
||||
* Add defaults in `fastanime/core/config/defaults.py` and descriptions in `fastanime/core/config/descriptions.py`.
|
||||
4. **Register Player:** Instruct to modify `fastanime/libs/player/player.py` by:
|
||||
* Add defaults in `viu/core/config/defaults.py` and descriptions in `viu/core/config/descriptions.py`.
|
||||
4. **Register Player:** Instruct to modify `viu/libs/player/player.py` by:
|
||||
* Adding the player name to the `PLAYERS` list.
|
||||
* Adding the instantiation logic to the `PlayerFactory.create` method.
|
||||
|
||||
@@ -26,9 +26,9 @@ You are an expert on `fastanime`'s modular architecture. Your task is to help th
|
||||
|
||||
### If the user chooses 'Selector':
|
||||
|
||||
1. **Scaffold Directory:** Create a directory at `fastanime/libs/selectors/{selector_name}/`.
|
||||
2. **Implement `BaseSelector`:** Create a `selector.py` file with a class `NewSelector` that inherits from `fastanime.libs.selectors.base.BaseSelector`. Implement the `choose`, `confirm`, and `ask` methods.
|
||||
1. **Scaffold Directory:** Create a directory at `viu/libs/selectors/{selector_name}/`.
|
||||
2. **Implement `BaseSelector`:** Create a `selector.py` file with a class `NewSelector` that inherits from `viu.libs.selectors.base.BaseSelector`. Implement the `choose`, `confirm`, and `ask` methods.
|
||||
3. **Add Configuration:** (Follow the same steps as for a Player).
|
||||
4. **Register Selector:**
|
||||
* Instruct to modify `fastanime/libs/selectors/selector.py` by adding the selector name to the `SELECTORS` list and the factory logic to `SelectorFactory.create`.
|
||||
* Instruct to update the `Literal` type hint for the `selector` field in `GeneralConfig` (`fastanime/core/config/model.py`).
|
||||
* Instruct to modify `viu/libs/selectors/selector.py` by adding the selector name to the `SELECTORS` list and the factory logic to `SelectorFactory.create`.
|
||||
* Instruct to update the `Literal` type hint for the `selector` field in `GeneralConfig` (`viu/core/config/model.py`).
|
||||
|
||||
18
.github/chatmodes/new-provider.chatmode.md
vendored
18
.github/chatmodes/new-provider.chatmode.md
vendored
@@ -1,27 +1,27 @@
|
||||
---
|
||||
description: "Scaffold and implement a new anime provider, following all architectural patterns of the fastanime project."
|
||||
description: "Scaffold and implement a new anime provider, following all architectural patterns of the viu project."
|
||||
tools: ['codebase', 'search', 'fetch']
|
||||
---
|
||||
# FastAnime: New Provider Generation Mode
|
||||
# viu: New Provider Generation Mode
|
||||
|
||||
You are an expert on the `fastanime` codebase, specializing in its provider architecture. Your task is to guide the developer in creating a new anime provider. You must strictly adhere to the project's structure and coding conventions.
|
||||
You are an expert on the `viu` codebase, specializing in its provider architecture. Your task is to guide the developer in creating a new anime provider. You must strictly adhere to the project's structure and coding conventions.
|
||||
|
||||
**Your process is as follows:**
|
||||
|
||||
1. **Ask for the Provider's Name:** First, ask the user for the name of the new provider (e.g., `gogoanime`, `crunchyroll`). Use this name (in lowercase) for all subsequent file and directory naming.
|
||||
|
||||
2. **Scaffold the Directory Structure:** Based on the name, state the required directory structure that needs to be created:
|
||||
`fastanime/libs/provider/anime/{provider_name}/`
|
||||
`viu/libs/provider/anime/{provider_name}/`
|
||||
|
||||
3. **Scaffold the Core Files:** Generate the initial code for the following files inside the new directory. Ensure all code is fully type-hinted.
|
||||
|
||||
* **`__init__.py`**: Can be an empty file.
|
||||
* **`types.py`**: Create placeholder `TypedDict` models for the provider's specific API responses (e.g., `GogoAnimeSearchResult`, `GogoAnimeEpisode`).
|
||||
* **`mappers.py`**: Create empty mapping functions that will convert the provider-specific types into the generic types from `fastanime.libs.provider.anime.types`. For example: `map_to_search_results(data: GogoAnimeSearchPage) -> SearchResults:`.
|
||||
* **`provider.py`**: Generate the main provider class. It **MUST** inherit from `fastanime.libs.provider.anime.base.BaseAnimeProvider`. Include stubs for the required abstract methods: `search`, `get`, and `episode_streams`. Remind the user to use `httpx.Client` for requests and to call the mapper functions.
|
||||
* **`mappers.py`**: Create empty mapping functions that will convert the provider-specific types into the generic types from `viu.libs.provider.anime.types`. For example: `map_to_search_results(data: GogoAnimeSearchPage) -> SearchResults:`.
|
||||
* **`provider.py`**: Generate the main provider class. It **MUST** inherit from `viu.libs.provider.anime.base.BaseAnimeProvider`. Include stubs for the required abstract methods: `search`, `get`, and `episode_streams`. Remind the user to use `httpx.Client` for requests and to call the mapper functions.
|
||||
|
||||
4. **Instruct on Registration:** Clearly state the two files that **must** be modified to register the new provider:
|
||||
* **`fastanime/libs/provider/anime/types.py`**: Add the new provider's name to the `ProviderName` enum.
|
||||
* **`fastanime/libs/provider/anime/provider.py`**: Add an entry to the `PROVIDERS_AVAILABLE` dictionary.
|
||||
* **`viu/libs/provider/anime/types.py`**: Add the new provider's name to the `ProviderName` enum.
|
||||
* **`viu/libs/provider/anime/provider.py`**: Add an entry to the `PROVIDERS_AVAILABLE` dictionary.
|
||||
|
||||
5. **Final Guidance:** Remind the developer to add any title normalization rules to `fastanime/assets/normalizer.json` if the provider uses different anime titles than AniList.
|
||||
5. **Final Guidance:** Remind the developer to add any title normalization rules to `viu/assets/normalizer.json` if the provider uses different anime titles than AniList.
|
||||
|
||||
16
.github/chatmodes/plan.chatmode.md
vendored
16
.github/chatmodes/plan.chatmode.md
vendored
@@ -1,11 +1,11 @@
|
||||
---
|
||||
description: "Plan new features or bug fixes with architectural guidance for the fastanime project. Does not write implementation code."
|
||||
description: "Plan new features or bug fixes with architectural guidance for the viu project. Does not write implementation code."
|
||||
tools: ['codebase', 'search', 'githubRepo', 'fetch']
|
||||
model: "gpt-4o"
|
||||
---
|
||||
# FastAnime: Feature & Fix Planner Mode
|
||||
# viu: Feature & Fix Planner Mode
|
||||
|
||||
You are a senior software architect and project planner for the `fastanime` project. You are an expert in its layered architecture (`Core`, `Libs`, `Service`, `CLI`) and its commitment to modular, testable code.
|
||||
You are a senior software architect and project planner for the `viu` project. You are an expert in its layered architecture (`Core`, `Libs`, `Service`, `CLI`) and its commitment to modular, testable code.
|
||||
|
||||
Your primary goal is to help the user break down a feature request or bug report into a clear, actionable implementation plan.
|
||||
|
||||
@@ -33,17 +33,17 @@ Your primary goal is to help the user break down a feature request or bug report
|
||||
|
||||
**2. Architectural Impact Analysis**
|
||||
> This is the most important section. Detail which parts of the codebase will be touched and why.
|
||||
> - **Core Layer (`fastanime/core`):**
|
||||
> - **Core Layer (`viu/core`):**
|
||||
> - *Config (`config/model.py`):* Will a new Pydantic model or field be needed?
|
||||
> - *Utils (`utils/`):* Are any new low-level, reusable functions required?
|
||||
> - *Exceptions (`exceptions.py`):* Does this introduce a new failure case that needs a custom exception?
|
||||
> - **Libs Layer (`fastanime/libs`):**
|
||||
> - **Libs Layer (`viu/libs`):**
|
||||
> - *Media API (`media_api/`):* Does this involve a new call to the AniList API?
|
||||
> - *Provider (`provider/`):* Does this affect how data is scraped?
|
||||
> - *Player/Selector (`player/`, `selectors/`):* Does this change how we interact with external tools?
|
||||
> - **Service Layer (`fastanime/cli/service`):**
|
||||
> - **Service Layer (`viu/cli/service`):**
|
||||
> - Which service will orchestrate this logic? (e.g., `DownloadService`, `PlayerService`). Will a new service be needed?
|
||||
> - **CLI Layer (`fastanime/cli`):**
|
||||
> - **CLI Layer (`viu/cli`):**
|
||||
> - *Commands (`commands/`):* Which `click` command(s) will expose this feature?
|
||||
> - *Interactive UI (`interactive/`):* Which TUI menu(s) need to be added or modified?
|
||||
|
||||
@@ -52,7 +52,7 @@ Your primary goal is to help the user break down a feature request or bug report
|
||||
> 1. [ ] **Config:** Add `new_setting` to `GeneralConfig` in `core/config/model.py`.
|
||||
> 2. [ ] **Core:** Implement `new_util()` in `core/utils/helpers.py`.
|
||||
> 3. [ ] **Service:** Add method `handle_new_feature()` to `MyService`.
|
||||
> 4. [ ] **CLI:** Add `--new-feature` option to the `fastanime anilist search` command.
|
||||
> 4. [ ] **CLI:** Add `--new-feature` option to the `viu anilist search` command.
|
||||
> 5. [ ] **Tests:** Write a unit test for `new_util()` and an integration test for the service method.
|
||||
|
||||
**4. Configuration Changes**
|
||||
|
||||
58
.github/copilot-instructions.md
vendored
58
.github/copilot-instructions.md
vendored
@@ -1,27 +1,27 @@
|
||||
# GitHub Copilot Instructions for the FastAnime Repository
|
||||
# GitHub Copilot Instructions for the viu Repository
|
||||
|
||||
Hello, Copilot! This document provides instructions and context to help you understand the `fastanime` codebase. Following these guidelines will help you generate code that is consistent, maintainable, and aligned with the project's architecture.
|
||||
Hello, Copilot! This document provides instructions and context to help you understand the `viu` codebase. Following these guidelines will help you generate code that is consistent, maintainable, and aligned with the project's architecture.
|
||||
|
||||
## 1. High-Level Project Goal
|
||||
|
||||
`fastanime` is a command-line tool that brings the anime browsing, streaming, and management experience to the terminal. It integrates with metadata providers like AniList and scrapes streaming links from various anime provider websites. The core goals are efficiency, extensibility, and providing a powerful, scriptable user experience.
|
||||
`viu` is a command-line tool that brings the anime browsing, streaming, and management experience to the terminal. It integrates with metadata providers like AniList and scrapes streaming links from various anime provider websites. The core goals are efficiency, extensibility, and providing a powerful, scriptable user experience.
|
||||
|
||||
## 2. Core Architectural Concepts
|
||||
|
||||
The project follows a clean, layered architecture. When generating code, please adhere to this structure.
|
||||
|
||||
#### Layer 1: CLI (`fastanime/cli`)
|
||||
#### Layer 1: CLI (`viu/cli`)
|
||||
* **Purpose:** Handles user interaction, command parsing, and displaying output.
|
||||
* **Key Libraries:** `click` for command structure, `rich` for styled output.
|
||||
* **Interactive Mode:** The interactive TUI is managed by the `Session` object in `fastanime/cli/interactive/session.py`. It's a state machine where each menu is a function that returns the next `State` or an `InternalDirective` (like `BACK` or `EXIT`).
|
||||
* **Interactive Mode:** The interactive TUI is managed by the `Session` object in `viu/cli/interactive/session.py`. It's a state machine where each menu is a function that returns the next `State` or an `InternalDirective` (like `BACK` or `EXIT`).
|
||||
* **Guideline:** **CLI files should not contain complex business logic.** They should parse arguments and delegate tasks to the Service Layer.
|
||||
|
||||
#### Layer 2: Service (`fastanime/cli/service`)
|
||||
#### Layer 2: Service (`viu/cli/service`)
|
||||
* **Purpose:** Contains the core application logic. Services act as orchestrators, connecting the CLI layer with the various library components.
|
||||
* **Examples:** `DownloadService`, `PlayerService`, `MediaRegistryService`, `WatchHistoryService`.
|
||||
* **Guideline:** When adding new functionality (e.g., a new way to manage downloads), it should likely be implemented in a service or an existing service should be extended. Services are the "brains" of the application.
|
||||
|
||||
#### Layer 3: Libraries (`fastanime/libs`)
|
||||
#### Layer 3: Libraries (`viu/libs`)
|
||||
* **Purpose:** A collection of independent, reusable modules with well-defined contracts (Abstract Base Classes).
|
||||
* **`media_api`:** Interfaces with metadata services like AniList. All new metadata clients **must** inherit from `BaseApiClient`.
|
||||
* **`provider`:** Interfaces with anime streaming websites. All new providers **must** inherit from `BaseAnimeProvider`.
|
||||
@@ -29,7 +29,7 @@ The project follows a clean, layered architecture. When generating code, please
|
||||
* **`selectors`:** Wrappers for interactive UI tools like FZF or Rofi. All new selectors **must** inherit from `BaseSelector`.
|
||||
* **Guideline:** Libraries should be self-contained and not depend on the CLI or Service layers. They receive configuration and perform their specific task.
|
||||
|
||||
#### Layer 4: Core (`fastanime/core`)
|
||||
#### Layer 4: Core (`viu/core`)
|
||||
* **Purpose:** Foundational code shared across the entire application.
|
||||
* **`config`:** Pydantic models defining the application's configuration structure. **This is the single source of truth for all settings.**
|
||||
* **`downloader`:** The underlying logic for downloading files (using `yt-dlp` or `httpx`).
|
||||
@@ -39,7 +39,7 @@ The project follows a clean, layered architecture. When generating code, please
|
||||
|
||||
## 3. Key Technologies
|
||||
* **Dependency Management:** `uv` is used for all package management and task running. Refer to `pyproject.toml` for dependencies.
|
||||
* **Configuration:** **Pydantic** is used exclusively. The entire configuration is defined in `fastanime/core/config/model.py`.
|
||||
* **Configuration:** **Pydantic** is used exclusively. The entire configuration is defined in `viu/core/config/model.py`.
|
||||
* **CLI Framework:** `click`. We use a custom `LazyGroup` to load commands on demand for faster startup.
|
||||
* **HTTP Client:** `httpx` is the standard for all network requests.
|
||||
|
||||
@@ -48,37 +48,37 @@ The project follows a clean, layered architecture. When generating code, please
|
||||
Follow these patterns to ensure your contributions fit the existing architecture.
|
||||
|
||||
### How to Add a New Provider
|
||||
1. **Create Directory:** Add a new folder in `fastanime/libs/provider/anime/newprovider/`.
|
||||
1. **Create Directory:** Add a new folder in `viu/libs/provider/anime/newprovider/`.
|
||||
2. **Implement `BaseAnimeProvider`:** In `provider.py`, create a class `NewProvider` that inherits from `BaseAnimeProvider` and implement the `search`, `get`, and `episode_streams` methods.
|
||||
3. **Create Mappers:** In `mappers.py`, write functions to convert the provider's API/HTML data into the generic Pydantic models from `fastanime/libs/provider/anime/types.py` (e.g., `SearchResult`, `Anime`, `Server`).
|
||||
3. **Create Mappers:** In `mappers.py`, write functions to convert the provider's API/HTML data into the generic Pydantic models from `viu/libs/provider/anime/types.py` (e.g., `SearchResult`, `Anime`, `Server`).
|
||||
4. **Register Provider:**
|
||||
* Add the provider's name to the `ProviderName` enum in `fastanime/libs/provider/anime/types.py`.
|
||||
* Add it to the `PROVIDERS_AVAILABLE` dictionary in `fastanime/libs/provider/anime/provider.py`.
|
||||
* Add the provider's name to the `ProviderName` enum in `viu/libs/provider/anime/types.py`.
|
||||
* Add it to the `PROVIDERS_AVAILABLE` dictionary in `viu/libs/provider/anime/provider.py`.
|
||||
|
||||
### How to Add a New Player
|
||||
1. **Create Directory:** Add a new folder in `fastanime/libs/player/newplayer/`.
|
||||
1. **Create Directory:** Add a new folder in `viu/libs/player/newplayer/`.
|
||||
2. **Implement `BasePlayer`:** In `player.py`, create a class `NewPlayer` that inherits from `BasePlayer` and implement the `play` method. It should call the player's executable via `subprocess`.
|
||||
3. **Add Configuration:** If the player has settings, add a `NewPlayerConfig` Pydantic model in `fastanime/core/config/model.py`, and add it to the main `AppConfig`. Also add defaults and descriptions.
|
||||
4. **Register Player:** Add the player's name to the `PLAYERS` list and the factory logic in `fastanime/libs/player/player.py`.
|
||||
3. **Add Configuration:** If the player has settings, add a `NewPlayerConfig` Pydantic model in `viu/core/config/model.py`, and add it to the main `AppConfig`. Also add defaults and descriptions.
|
||||
4. **Register Player:** Add the player's name to the `PLAYERS` list and the factory logic in `viu/libs/player/player.py`.
|
||||
|
||||
### How to Add a New Selector
|
||||
1. **Create Directory:** Add a new folder in `fastanime/libs/selectors/newselector/`.
|
||||
1. **Create Directory:** Add a new folder in `viu/libs/selectors/newselector/`.
|
||||
2. **Implement `BaseSelector`:** In `selector.py`, create a class `NewSelector` that inherits from `BaseSelector` and implement `choose`, `confirm`, and `ask`.
|
||||
3. **Add Configuration:** If needed, add a `NewSelectorConfig` to `fastanime/core/config/model.py`.
|
||||
4. **Register Selector:** Add the selector's name to the `SELECTORS` list and the factory logic in `fastanime/libs/selectors/selector.py`. Update the `Literal` type hint for `selector` in `GeneralConfig`.
|
||||
3. **Add Configuration:** If needed, add a `NewSelectorConfig` to `viu/core/config/model.py`.
|
||||
4. **Register Selector:** Add the selector's name to the `SELECTORS` list and the factory logic in `viu/libs/selectors/selector.py`. Update the `Literal` type hint for `selector` in `GeneralConfig`.
|
||||
|
||||
### How to Add a New CLI Command
|
||||
* **Top-Level Command (`fastanime my-command`):**
|
||||
1. Create `fastanime/cli/commands/my_command.py` with your `click.command()`.
|
||||
2. Register it in the `commands` dictionary in `fastanime/cli/cli.py`.
|
||||
* **Subcommand (`fastanime anilist my-subcommand`):**
|
||||
1. Create `fastanime/cli/commands/anilist/commands/my_subcommand.py`.
|
||||
2. Register it in the `lazy_subcommands` dictionary of the parent `click.group()` (e.g., in `fastanime/cli/commands/anilist/cmd.py`).
|
||||
* **Top-Level Command (`viu my-command`):**
|
||||
1. Create `viu/cli/commands/my_command.py` with your `click.command()`.
|
||||
2. Register it in the `commands` dictionary in `viu/cli/cli.py`.
|
||||
* **Subcommand (`viu anilist my-subcommand`):**
|
||||
1. Create `viu/cli/commands/anilist/commands/my_subcommand.py`.
|
||||
2. Register it in the `lazy_subcommands` dictionary of the parent `click.group()` (e.g., in `viu/cli/commands/anilist/cmd.py`).
|
||||
|
||||
### How to Add a New Configuration Option
|
||||
1. **Add to Model:** Add the field to the appropriate Pydantic model in `fastanime/core/config/model.py`.
|
||||
2. **Add Default:** Add a default value in `fastanime/core/config/defaults.py`.
|
||||
3. **Add Description:** Add a user-friendly description in `fastanime/core/config/descriptions.py`.
|
||||
1. **Add to Model:** Add the field to the appropriate Pydantic model in `viu/core/config/model.py`.
|
||||
2. **Add Default:** Add a default value in `viu/core/config/defaults.py`.
|
||||
3. **Add Description:** Add a user-friendly description in `viu/core/config/descriptions.py`.
|
||||
4. The config loader and CLI option generation will handle the rest automatically.
|
||||
|
||||
## 5. Code Style and Conventions
|
||||
@@ -91,7 +91,7 @@ Follow these patterns to ensure your contributions fit the existing architecture
|
||||
|
||||
* ✅ **DO** use the abstract base classes (`BaseProvider`, `BasePlayer`, etc.) as contracts.
|
||||
* ✅ **DO** place business logic in the `service` layer.
|
||||
* ✅ **DO** use the Pydantic models in `fastanime/core/config/model.py` as the single source of truth for configuration.
|
||||
* ✅ **DO** use the Pydantic models in `viu/core/config/model.py` as the single source of truth for configuration.
|
||||
* ✅ **DO** use the `Context` object in interactive menus to access services and configuration.
|
||||
|
||||
* ❌ **DON'T** hardcode configuration values. Access them via the `config` object.
|
||||
|
||||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -20,13 +20,13 @@ jobs:
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Build fastanime
|
||||
- name: Build viu
|
||||
run: uv build
|
||||
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastanime_debug_build
|
||||
name: viu_debug_build
|
||||
path: |
|
||||
dist
|
||||
|
||||
|
||||
11
.github/workflows/publish.yml
vendored
11
.github/workflows/publish.yml
vendored
@@ -1,12 +1,3 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# GitHub recommends pinning actions to a commit SHA.
|
||||
# To get a newer version, you will need to update the SHA.
|
||||
# You can also reference a tag or branch, but the action may change without warning.
|
||||
|
||||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
@@ -32,7 +23,7 @@ jobs:
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Build fastanime
|
||||
- name: Build viu
|
||||
run: uv build
|
||||
|
||||
- name: Upload distributions
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
# Contributing to FastAnime
|
||||
# Contributing to Viu
|
||||
|
||||
First off, thank you for considering contributing to FastAnime! We welcome any help, whether it's reporting a bug, proposing a feature, or writing code. This document will guide you through the process.
|
||||
First off, thank you for considering contributing to Viu! We welcome any help, whether it's reporting a bug, proposing a feature, or writing code. This document will guide you through the process.
|
||||
|
||||
## How Can I Contribute?
|
||||
|
||||
There are many ways to contribute to the FastAnime project:
|
||||
There are many ways to contribute to the Viu project:
|
||||
|
||||
* **Reporting Bugs:** If you find a bug, please create an issue in our [issue tracker](https://github.com/Benexl/FastAnime/issues).
|
||||
* **Reporting Bugs:** If you find a bug, please create an issue in our [issue tracker](https://github.com/Benexl/Viu/issues).
|
||||
* **Suggesting Enhancements:** Have an idea for a new feature or an improvement to an existing one? We'd love to hear it.
|
||||
* **Writing Code:** Help us fix bugs or implement new features.
|
||||
* **Improving Documentation:** Enhance our README, add examples, or clarify our contribution guidelines.
|
||||
* **Adding a Provider, Player, or Selector:** Extend FastAnime's capabilities by integrating new tools and services.
|
||||
* **Adding a Provider, Player, or Selector:** Extend Viu's capabilities by integrating new tools and services.
|
||||
|
||||
## Contribution Workflow
|
||||
|
||||
We follow the standard GitHub Fork & Pull Request workflow.
|
||||
|
||||
1. **Create an Issue:** Before starting work on a new feature or a significant bug fix, please [create an issue](https://github.com/Benexl/FastAnime/issues/new/choose) to discuss your idea. This allows us to give feedback and prevent duplicate work. For small bugs or documentation typos, you can skip this step.
|
||||
1. **Create an Issue:** Before starting work on a new feature or a significant bug fix, please [create an issue](https://github.com/Benexl/Viu/issues/new/choose) to discuss your idea. This allows us to give feedback and prevent duplicate work. For small bugs or documentation typos, you can skip this step.
|
||||
|
||||
2. **Fork the Repository:** Create your own fork of the FastAnime repository.
|
||||
2. **Fork the Repository:** Create your own fork of the Viu repository.
|
||||
|
||||
3. **Clone Your Fork:**
|
||||
```bash
|
||||
git clone https://github.com/YOUR_USERNAME/FastAnime.git
|
||||
cd FastAnime
|
||||
git clone https://github.com/YOUR_USERNAME/Viu.git
|
||||
cd Viu
|
||||
```
|
||||
|
||||
4. **Create a Branch:** Create a new branch for your changes. Use a descriptive name.
|
||||
@@ -64,7 +64,7 @@ We follow the standard GitHub Fork & Pull Request workflow.
|
||||
git push origin feat/my-new-feature
|
||||
```
|
||||
|
||||
9. **Submit a Pull Request:** Open a pull request from your branch to the `master` branch of the main FastAnime repository. Provide a clear title and description of your changes.
|
||||
9. **Submit a Pull Request:** Open a pull request from your branch to the `master` branch of the main Viu repository. Provide a clear title and description of your changes.
|
||||
|
||||
## Setting Up Your Development Environment
|
||||
|
||||
@@ -111,7 +111,7 @@ To maintain code quality and consistency, please adhere to the following guideli
|
||||
* **Modularity and Architecture:**
|
||||
* **Services:** Business logic is organized into services (e.g., `PlayerService`, `DownloadService`).
|
||||
* **Factories:** Use factory patterns (`create_provider`, `create_selector`) for creating instances of different implementations.
|
||||
* **Configuration:** All configuration is managed through Pydantic models in `fastanime/core/config/model.py`. When adding new config options, update the model, defaults, and descriptions.
|
||||
* **Configuration:** All configuration is managed through Pydantic models in `viu/core/config/model.py`. When adding new config options, update the model, defaults, and descriptions.
|
||||
* **Commit Messages:** Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard.
|
||||
* **Testing:** New features should be accompanied by tests. Bug fixes should ideally include a regression test.
|
||||
|
||||
@@ -119,25 +119,25 @@ To maintain code quality and consistency, please adhere to the following guideli
|
||||
|
||||
Adding a new anime provider is a great way to contribute. Here are the steps:
|
||||
|
||||
1. **Create a New Provider Directory:** Inside `fastanime/libs/provider/anime/`, create a new directory with the provider's name (e.g., `fastanime/libs/provider/anime/newprovider/`).
|
||||
1. **Create a New Provider Directory:** Inside `viu/libs/provider/anime/`, create a new directory with the provider's name (e.g., `viu/libs/provider/anime/newprovider/`).
|
||||
|
||||
2. **Implement the Provider:**
|
||||
* Create a `provider.py` file.
|
||||
* Define a class (e.g., `NewProviderApi`) that inherits from `BaseAnimeProvider`.
|
||||
* Implement the abstract methods: `search`, `get`, and `episode_streams`.
|
||||
* Create `mappers.py` to convert the provider's data structures into the generic types defined in `fastanime/libs/provider/anime/types.py`.
|
||||
* Create `mappers.py` to convert the provider's data structures into the generic types defined in `viu/libs/provider/anime/types.py`.
|
||||
* Create `types.py` for any provider-specific data structures you need.
|
||||
* If the provider requires complex scraping, place extractor logic in an `extractors/` subdirectory.
|
||||
|
||||
3. **Register the Provider:**
|
||||
* Add your new provider to the `ProviderName` enum in `fastanime/libs/provider/anime/types.py`.
|
||||
* Register it in the `PROVIDERS_AVAILABLE` dictionary in `fastanime/libs/provider/anime/provider.py`.
|
||||
* Add your new provider to the `ProviderName` enum in `viu/libs/provider/anime/types.py`.
|
||||
* Register it in the `PROVIDERS_AVAILABLE` dictionary in `viu/libs/provider/anime/provider.py`.
|
||||
|
||||
4. **Add Normalization Rules (Optional):** If the provider uses different anime titles than AniList, add mappings to `fastanime/assets/normalizer.json`.
|
||||
4. **Add Normalization Rules (Optional):** If the provider uses different anime titles than AniList, add mappings to `viu/assets/normalizer.json`.
|
||||
|
||||
## How to Add a New Player
|
||||
|
||||
1. **Create a New Player Directory:** Inside `fastanime/libs/player/`, create a directory for your player (e.g., `fastanime/libs/player/myplayer/`).
|
||||
1. **Create a New Player Directory:** Inside `viu/libs/player/`, create a directory for your player (e.g., `viu/libs/player/myplayer/`).
|
||||
|
||||
2. **Implement the Player Class:**
|
||||
* In `myplayer/player.py`, create a class (e.g., `MyPlayer`) that inherits from `BasePlayer`.
|
||||
@@ -145,17 +145,17 @@ Adding a new anime provider is a great way to contribute. Here are the steps:
|
||||
* The `play` method should handle launching the player as a subprocess and return a `PlayerResult`.
|
||||
|
||||
3. **Add Configuration (if needed):**
|
||||
* If your player has configurable options, add a new Pydantic model (e.g., `MyPlayerConfig`) in `fastanime/core/config/model.py`. It should inherit from `OtherConfig`.
|
||||
* If your player has configurable options, add a new Pydantic model (e.g., `MyPlayerConfig`) in `viu/core/config/model.py`. It should inherit from `OtherConfig`.
|
||||
* Add this new config model as a field in the main `AppConfig` model.
|
||||
* Add default values in `defaults.py` and descriptions in `descriptions.py`.
|
||||
|
||||
4. **Register the Player:**
|
||||
* Add your player's name to the `PLAYERS` list in `fastanime/libs/player/player.py`.
|
||||
* Add your player's name to the `PLAYERS` list in `viu/libs/player/player.py`.
|
||||
* Add the logic to instantiate your player class within the `PlayerFactory.create` method.
|
||||
|
||||
## How to Add a New Selector
|
||||
|
||||
1. **Create a New Selector Directory:** Inside `fastanime/libs/selectors/`, create a new directory (e.g., `fastanime/libs/selectors/myselector/`).
|
||||
1. **Create a New Selector Directory:** Inside `viu/libs/selectors/`, create a new directory (e.g., `viu/libs/selectors/myselector/`).
|
||||
|
||||
2. **Implement the Selector Class:**
|
||||
* In `myselector/selector.py`, create a class (e.g., `MySelector`) that inherits from `BaseSelector`.
|
||||
@@ -165,19 +165,19 @@ Adding a new anime provider is a great way to contribute. Here are the steps:
|
||||
3. **Add Configuration (if needed):** Follow the same configuration steps as for adding a new player.
|
||||
|
||||
4. **Register the Selector:**
|
||||
* Add your selector's name to the `SELECTORS` list in `fastanime/libs/selectors/selector.py`.
|
||||
* Add your selector's name to the `SELECTORS` list in `viu/libs/selectors/selector.py`.
|
||||
* Add the instantiation logic to the `SelectorFactory.create` method.
|
||||
* Update the `Literal` type hint for the `selector` field in `GeneralConfig` (`fastanime/core/config/model.py`).
|
||||
* Update the `Literal` type hint for the `selector` field in `GeneralConfig` (`viu/core/config/model.py`).
|
||||
|
||||
## How to Add a New CLI Command or Service
|
||||
|
||||
Our CLI uses `click` and a `LazyGroup` class to load commands on demand.
|
||||
|
||||
### Adding a Top-Level Command (e.g., `fastanime my-command`)
|
||||
### Adding a Top-Level Command (e.g., `viu my-command`)
|
||||
|
||||
1. **Create the Command File:** Create a new Python file in `fastanime/cli/commands/` (e.g., `my_command.py`). This file should contain your `click.command()` function.
|
||||
1. **Create the Command File:** Create a new Python file in `viu/cli/commands/` (e.g., `my_command.py`). This file should contain your `click.command()` function.
|
||||
|
||||
2. **Register the Command:** In `fastanime/cli/cli.py`, add your command to the `commands` dictionary.
|
||||
2. **Register the Command:** In `viu/cli/cli.py`, add your command to the `commands` dictionary.
|
||||
```python
|
||||
commands = {
|
||||
# ... existing commands
|
||||
@@ -185,11 +185,11 @@ Our CLI uses `click` and a `LazyGroup` class to load commands on demand.
|
||||
}
|
||||
```
|
||||
|
||||
### Adding a Subcommand (e.g., `fastanime anilist my-subcommand`)
|
||||
### Adding a Subcommand (e.g., `viu anilist my-subcommand`)
|
||||
|
||||
1. **Create the Command File:** Place your new command file inside the appropriate subdirectory, for example, `fastanime/cli/commands/anilist/commands/my_subcommand.py`.
|
||||
1. **Create the Command File:** Place your new command file inside the appropriate subdirectory, for example, `viu/cli/commands/anilist/commands/my_subcommand.py`.
|
||||
|
||||
2. **Register the Subcommand:** In the parent command's entry point file (e.g., `fastanime/cli/commands/anilist/cmd.py`), add your subcommand to the `commands` dictionary within the `LazyGroup`.
|
||||
2. **Register the Subcommand:** In the parent command's entry point file (e.g., `viu/cli/commands/anilist/cmd.py`), add your subcommand to the `commands` dictionary within the `LazyGroup`.
|
||||
```python
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
@@ -202,7 +202,7 @@ Our CLI uses `click` and a `LazyGroup` class to load commands on demand.
|
||||
```
|
||||
|
||||
### Creating a Service
|
||||
If your command involves complex logic, consider creating a service in `fastanime/cli/service/` to keep the business logic separate from the command-line interface. This service can then be instantiated and used within your `click` command function. This follows the existing pattern for services like `DownloadService` and `PlayerService`.
|
||||
If your command involves complex logic, consider creating a service in `viu/cli/service/` to keep the business logic separate from the command-line interface. This service can then be instantiated and used within your `click` command function. This follows the existing pattern for services like `DownloadService` and `PlayerService`.
|
||||
|
||||
---
|
||||
Thank you for contributing to FastAnime
|
||||
Thank you for contributing to Viu
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
<h2>This project: fastanime</h2>
|
||||
<h2>This project: viu</h2>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
106
README.md
106
README.md
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<h1 align="center">FastAnime</h1>
|
||||
<h1 align="center">Viu</h1>
|
||||
</p>
|
||||
<p align="center">
|
||||
<sup>
|
||||
@@ -8,12 +8,12 @@
|
||||
</p>
|
||||
<div align="center">
|
||||
|
||||
[](https://pypi.org/project/fastanime/)
|
||||
[](https://pypi.org/project/fastanime/)
|
||||
[](https://github.com/Benexl/FastAnime/actions)
|
||||
[](https://pypi.org/project/viu/)
|
||||
[](https://pypi.org/project/viu/)
|
||||
[](https://github.com/Benexl/Viu/actions)
|
||||
[](https://discord.gg/HBEmAwvbHV)
|
||||
[](https://github.com/Benexl/FastAnime/issues)
|
||||
[](https://github.com/Benexl/FastAnime/blob/master/LICENSE)
|
||||
[](https://github.com/Benexl/Viu/issues)
|
||||
[](https://github.com/Benexl/Viu/blob/master/LICENSE)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||

|
||||

|
||||
|
||||
<details>
|
||||
<summary>
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
## Installation
|
||||
|
||||
FastAnime runs on any platform with Python 3.10+, including Windows, macOS, Linux, and Android (via Termux).
|
||||
Viu runs on any platform with Python 3.10+, including Windows, macOS, Linux, and Android (via Termux).
|
||||
|
||||
### Prerequisites
|
||||
|
||||
@@ -94,17 +94,17 @@ For the best experience, please install these external tools:
|
||||
|
||||
### Recommended Installation (uv)
|
||||
|
||||
The best way to install FastAnime is with [**uv**](https://github.com/astral-sh/uv), a lightning-fast Python package manager.
|
||||
The best way to install Viu is with [**uv**](https://github.com/astral-sh/uv), a lightning-fast Python package manager.
|
||||
|
||||
```bash
|
||||
# Install with all optional features for the full experience
|
||||
uv tool install "fastanime[standard]"
|
||||
uv tool install "viu[standard]"
|
||||
|
||||
# Or, pick and choose the extras you need:
|
||||
uv tool install fastanime # Core functionality only
|
||||
uv tool install "fastanime[download]" # For advanced downloading with yt-dlp
|
||||
uv tool install "fastanime[discord]" # For Discord Rich Presence
|
||||
uv tool install "fastanime[notifications]" # For desktop notifications
|
||||
uv tool install viu # Core functionality only
|
||||
uv tool install "viu[download]" # For advanced downloading with yt-dlp
|
||||
uv tool install "viu[discord]" # For Discord Rich Presence
|
||||
uv tool install "viu[notifications]" # For desktop notifications
|
||||
```
|
||||
|
||||
### Other Installation Methods
|
||||
@@ -114,27 +114,27 @@ uv tool install "fastanime[notifications]" # For desktop notifications
|
||||
|
||||
#### Nix / NixOS
|
||||
```bash
|
||||
nix profile install github:Benexl/fastanime
|
||||
nix profile install github:Benexl/viu
|
||||
```
|
||||
|
||||
#### Arch Linux (AUR)
|
||||
Use an AUR helper like `yay` or `paru`.
|
||||
```bash
|
||||
# Stable version (recommended)
|
||||
yay -S fastanime
|
||||
yay -S viu
|
||||
|
||||
# Git version (latest commit)
|
||||
yay -S fastanime-git
|
||||
yay -S viu-git
|
||||
```
|
||||
|
||||
#### Using pipx (for isolated environments)
|
||||
```bash
|
||||
pipx install "fastanime[standard]"
|
||||
pipx install "viu[standard]"
|
||||
```
|
||||
|
||||
#### Using pip
|
||||
```bash
|
||||
pip install "fastanime[standard]"
|
||||
pip install "viu[standard]"
|
||||
```
|
||||
</details>
|
||||
|
||||
@@ -143,15 +143,15 @@ uv tool install "fastanime[notifications]" # For desktop notifications
|
||||
|
||||
Requires [Git](https://git-scm.com/), [Python 3.10+](https://www.python.org/), and [uv](https://astral.sh/blog/uv).
|
||||
```bash
|
||||
git clone https://github.com/Benexl/FastAnime.git --depth 1
|
||||
cd FastAnime
|
||||
git clone https://github.com/Benexl/Viu.git --depth 1
|
||||
cd Viu
|
||||
uv tool install .
|
||||
fastanime --version
|
||||
viu --version
|
||||
```
|
||||
</details>
|
||||
|
||||
> [!TIP]
|
||||
> Enable shell completions for a much better experience by running `fastanime completions` and following the on-screen instructions for your shell.
|
||||
> Enable shell completions for a much better experience by running `viu completions` and following the on-screen instructions for your shell.
|
||||
|
||||
## Getting Started: Quick Start
|
||||
|
||||
@@ -159,59 +159,59 @@ Get up and running in three simple steps:
|
||||
|
||||
1. **Authenticate with AniList:**
|
||||
```bash
|
||||
fastanime anilist auth
|
||||
viu anilist auth
|
||||
```
|
||||
This will open your browser. Authorize the app and paste the obtained token back into the terminal.
|
||||
|
||||
2. **Launch the Interactive TUI:**
|
||||
```bash
|
||||
fastanime anilist
|
||||
viu anilist
|
||||
```
|
||||
|
||||
3. **Browse & Play:** Use your arrow keys to navigate the menus, select an anime, and choose an episode to stream instantly.
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### The Interactive TUI (`fastanime anilist`)
|
||||
### The Interactive TUI (`viu anilist`)
|
||||
|
||||
This is the main, user-friendly way to use FastAnime. It provides a rich terminal experience where you can:
|
||||
This is the main, user-friendly way to use Viu. It provides a rich terminal experience where you can:
|
||||
* Browse trending, popular, and seasonal anime.
|
||||
* Manage your personal lists (Watching, Completed, Paused, etc.).
|
||||
* Search for any anime in the AniList database.
|
||||
* View detailed information, characters, recommendations, reviews, and airing schedules.
|
||||
* Stream or download episodes directly from the menus.
|
||||
|
||||
### Powerful Searching (`fastanime anilist search`)
|
||||
### Powerful Searching (`viu anilist search`)
|
||||
|
||||
Filter the entire AniList database with powerful command-line flags.
|
||||
|
||||
```bash
|
||||
# Search for anime from 2024, sorted by popularity, that is releasing and not on your list
|
||||
fastanime anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --not-on-list
|
||||
viu anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --not-on-list
|
||||
|
||||
# Find the most popular movies with the "Fantasy" genre
|
||||
fastanime anilist search -g Fantasy -f MOVIE -s POPULARITY_DESC
|
||||
viu anilist search -g Fantasy -f MOVIE -s POPULARITY_DESC
|
||||
|
||||
# Dump search results as JSON instead of launching the TUI
|
||||
fastanime anilist search -t "Demon Slayer" --dump-json
|
||||
viu anilist search -t "Demon Slayer" --dump-json
|
||||
```
|
||||
|
||||
### Background Downloads (`fastanime queue` & `worker`)
|
||||
### Background Downloads (`viu queue` & `worker`)
|
||||
|
||||
FastAnime includes a robust background downloading system.
|
||||
Viu includes a robust background downloading system.
|
||||
|
||||
1. **Add episodes to the queue:**
|
||||
```bash
|
||||
# Add episodes 1-12 of Jujutsu Kaisen to the download queue
|
||||
fastanime queue add -t "Jujutsu Kaisen" -r "0:12"
|
||||
viu queue add -t "Jujutsu Kaisen" -r "0:12"
|
||||
```
|
||||
2. **Start the worker process:**
|
||||
```bash
|
||||
# Run the worker in the foreground (press Ctrl+C to stop)
|
||||
fastanime worker
|
||||
viu worker
|
||||
|
||||
# Or run it as a background process
|
||||
fastanime worker &
|
||||
viu worker &
|
||||
```The worker will now process the queue, download your episodes, and check for notifications.
|
||||
|
||||
### Scriptable Commands (`download` & `search`)
|
||||
@@ -221,24 +221,24 @@ These commands are designed for automation and quick, non-interactive tasks.
|
||||
#### `download` Examples
|
||||
```bash
|
||||
# Download the latest 5 episodes of One Piece
|
||||
fastanime download -t "One Piece" -r "-5"
|
||||
viu download -t "One Piece" -r "-5"
|
||||
|
||||
# Download episodes 1 to 24, merge subtitles, and clean up original files
|
||||
fastanime download -t "Jujutsu Kaisen" -r "0:24" --merge --clean
|
||||
viu download -t "Jujutsu Kaisen" -r "0:24" --merge --clean
|
||||
```
|
||||
|
||||
#### `search` (Binging) Examples
|
||||
```bash
|
||||
# Start binging an anime from the first episode
|
||||
fastanime search -t "Attack on Titan" -r ":"
|
||||
viu search -t "Attack on Titan" -r ":"
|
||||
|
||||
# Watch the latest episode directly
|
||||
fastanime search -t "My Hero Academia" -r "-1"
|
||||
viu search -t "My Hero Academia" -r "-1"
|
||||
```
|
||||
|
||||
### Local Data Management (`fastanime registry`)
|
||||
### Local Data Management (`viu registry`)
|
||||
|
||||
FastAnime maintains a local database of your anime for offline access and enhanced performance.
|
||||
Viu maintains a local database of your anime for offline access and enhanced performance.
|
||||
|
||||
* `registry sync`: Synchronize your local data with your remote AniList account.
|
||||
* `registry stats`: Show detailed statistics about your viewing habits.
|
||||
@@ -249,13 +249,13 @@ FastAnime maintains a local database of your anime for offline access and enhanc
|
||||
|
||||
## Configuration
|
||||
|
||||
FastAnime is highly customizable. A default configuration file with detailed comments is created on the first run.
|
||||
Viu is highly customizable. A default configuration file with detailed comments is created on the first run.
|
||||
|
||||
* **Find your config file:** `fastanime config --path`
|
||||
* **Edit in your default editor:** `fastanime config`
|
||||
* **Use the interactive wizard:** `fastanime config --interactive`
|
||||
* **Find your config file:** `viu config --path`
|
||||
* **Edit in your default editor:** `viu config`
|
||||
* **Use the interactive wizard:** `viu config --interactive`
|
||||
|
||||
Most settings in the config file can be temporarily overridden with command-line flags (e.g., `fastanime --provider animepahe anilist`).
|
||||
Most settings in the config file can be temporarily overridden with command-line flags (e.g., `viu --provider animepahe anilist`).
|
||||
|
||||
<details>
|
||||
<summary><b>Default Configuration (`config.ini`) Explained</b></summary>
|
||||
@@ -303,7 +303,7 @@ download_check_interval = 5 ; How often to process the download queue (minu
|
||||
|
||||
### MPV IPC Integration
|
||||
|
||||
When `use_ipc = True` is set in your config, FastAnime provides powerful in-player controls without needing to close MPV.
|
||||
When `use_ipc = True` is set in your config, Viu provides powerful in-player controls without needing to close MPV.
|
||||
|
||||
**Key Bindings:**
|
||||
* `Shift+N`: Play the next episode.
|
||||
@@ -320,27 +320,27 @@ When `use_ipc = True` is set in your config, FastAnime provides powerful in-play
|
||||
|
||||
You can run the background worker as a systemd service for persistence.
|
||||
|
||||
1. Create a service file at `~/.config/systemd/user/fastanime-worker.service`:
|
||||
1. Create a service file at `~/.config/systemd/user/viu-worker.service`:
|
||||
```ini
|
||||
[Unit]
|
||||
Description=FastAnime Background Worker
|
||||
Description=Viu Background Worker
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/path/to/your/fastanime worker --log
|
||||
ExecStart=/path/to/your/viu worker --log
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
*Replace `/path/to/your/fastanime` with the output of `which fastanime`.*
|
||||
*Replace `/path/to/your/viu` with the output of `which viu`.*
|
||||
|
||||
2. Enable and start the service:
|
||||
```bash
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now fastanime-worker.service
|
||||
systemctl --user enable --now viu-worker.service
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM python:3.12-slim-bookworm
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
COPY . /fastanime
|
||||
COPY . /viu
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
WORKDIR /fastanime
|
||||
WORKDIR /viu
|
||||
RUN uv tool install .
|
||||
CMD ["bash"]
|
||||
|
||||
@@ -5,7 +5,7 @@ block_cipher = None
|
||||
|
||||
# Collect all required data files
|
||||
datas = [
|
||||
('fastanime/assets/*', 'fastanime/assets'),
|
||||
('viu/assets/*', 'viu/assets'),
|
||||
]
|
||||
|
||||
# Collect all required hidden imports
|
||||
@@ -16,11 +16,11 @@ hiddenimports = [
|
||||
'yt_dlp',
|
||||
'python_mpv',
|
||||
'fuzzywuzzy',
|
||||
'fastanime',
|
||||
] + collect_submodules('fastanime')
|
||||
'viu',
|
||||
] + collect_submodules('viu')
|
||||
|
||||
a = Analysis(
|
||||
['./fastanime/fastanime.py'], # Changed entry point
|
||||
['./viu/viu.py'], # Changed entry point
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=datas,
|
||||
@@ -49,7 +49,7 @@ exe = EXE(
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='fastanime',
|
||||
name='viu',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=True,
|
||||
@@ -61,5 +61,5 @@ exe = EXE(
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon='fastanime/assets/logo.ico'
|
||||
icon='viu/assets/logo.ico'
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
_fastanime_completion() {
|
||||
_viu_completion() {
|
||||
local IFS=$'\n'
|
||||
local response
|
||||
|
||||
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _FASTANIME_COMPLETE=bash_complete $1)
|
||||
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _VIU_COMPLETE=bash_complete $1)
|
||||
|
||||
for completion in $response; do
|
||||
IFS=',' read type value <<< "$completion"
|
||||
@@ -21,9 +21,9 @@ _fastanime_completion() {
|
||||
return 0
|
||||
}
|
||||
|
||||
_fastanime_completion_setup() {
|
||||
complete -o nosort -F _fastanime_completion fastanime
|
||||
_viu_completion_setup() {
|
||||
complete -o nosort -F _viu_completion viu
|
||||
}
|
||||
|
||||
_fastanime_completion_setup;
|
||||
_viu_completion_setup;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function _fastanime_completion;
|
||||
set -l response (env _FASTANIME_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) fastanime);
|
||||
function _viu_completion;
|
||||
set -l response (env _VIU_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) viu);
|
||||
|
||||
for completion in $response;
|
||||
set -l metadata (string split "," $completion);
|
||||
@@ -14,5 +14,5 @@ function _fastanime_completion;
|
||||
end;
|
||||
end;
|
||||
|
||||
complete --no-files --command fastanime --arguments "(_fastanime_completion)";
|
||||
complete --no-files --command viu --arguments "(_viu_completion)";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#compdef fastanime
|
||||
#compdef viu
|
||||
|
||||
_fastanime_completion() {
|
||||
_viu_completion() {
|
||||
local -a completions
|
||||
local -a completions_with_descriptions
|
||||
local -a response
|
||||
(( ! $+commands[fastanime] )) && return 1
|
||||
(( ! $+commands[viu] )) && return 1
|
||||
|
||||
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _FASTANIME_COMPLETE=zsh_complete fastanime)}")
|
||||
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _VIU_COMPLETE=zsh_complete viu)}")
|
||||
|
||||
for type key descr in ${response}; do
|
||||
if [[ "$type" == "plain" ]]; then
|
||||
@@ -33,9 +33,9 @@ _fastanime_completion() {
|
||||
|
||||
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
|
||||
# autoload from fpath, call function directly
|
||||
_fastanime_completion "$@"
|
||||
_viu_completion "$@"
|
||||
else
|
||||
# eval/source/. command, register function for later
|
||||
compdef _fastanime_completion fastanime
|
||||
compdef _viu_completion viu
|
||||
fi
|
||||
|
||||
6
dev/generate_completions.sh
Executable file → Normal file
6
dev/generate_completions.sh
Executable file → Normal file
@@ -5,10 +5,10 @@ APP_DIR="$(
|
||||
)"
|
||||
|
||||
# fish shell completions
|
||||
_FASTANIME_COMPLETE=fish_source fastanime >"$APP_DIR/completions/fastanime.fish"
|
||||
_VIU_COMPLETE=fish_source viu >"$APP_DIR/completions/viu.fish"
|
||||
|
||||
# zsh completions
|
||||
_FASTANIME_COMPLETE=zsh_source fastanime >"$APP_DIR/completions/fastanime.zsh"
|
||||
_VIU_COMPLETE=zsh_source viu >"$APP_DIR/completions/viu.zsh"
|
||||
|
||||
# bash completions
|
||||
_FASTANIME_COMPLETE=bash_source fastanime >"$APP_DIR/completions/fastanime.bash"
|
||||
_VIU_COMPLETE=bash_source viu >"$APP_DIR/completions/viu.bash"
|
||||
|
||||
6
dev/make_release
Executable file → Normal file
6
dev/make_release
Executable file → Normal file
@@ -2,11 +2,11 @@
|
||||
CLI_DIR="$(dirname "$(realpath "$0")")"
|
||||
VERSION=$1
|
||||
[ -z "$VERSION" ] && echo no version provided && exit 1
|
||||
[ "$VERSION" = "current" ] && fastanime --version && exit 0
|
||||
[ "$VERSION" = "current" ] && viu --version && exit 0
|
||||
sed -i "s/^version.*/version = \"$VERSION\"/" "$CLI_DIR/pyproject.toml" &&
|
||||
sed -i "s/__version__.*/__version__ = \"v$VERSION\"/" "$CLI_DIR/fastanime/__init__.py" &&
|
||||
sed -i "s/__version__.*/__version__ = \"v$VERSION\"/" "$CLI_DIR/viu/__init__.py" &&
|
||||
sed -i "s/version = .*/version = \"$VERSION\";/" "$CLI_DIR/flake.nix" &&
|
||||
git stage "$CLI_DIR/pyproject.toml" "$CLI_DIR/fastanime/__init__.py" "$CLI_DIR/flake.nix" &&
|
||||
git stage "$CLI_DIR/pyproject.toml" "$CLI_DIR/viu/__init__.py" "$CLI_DIR/flake.nix" &&
|
||||
git commit -m "chore: bump version (v$VERSION)" &&
|
||||
# nix flake lock &&
|
||||
uv lock &&
|
||||
|
||||
2
fa
Executable file → Normal file
2
fa
Executable file → Normal file
@@ -3,4 +3,4 @@ provider_type=$1
|
||||
provider_name=$2
|
||||
[ -z "$provider_type" ] && echo "Please specify provider type" && exit
|
||||
[ -z "$provider_name" ] && echo "Please specify provider type" && exit
|
||||
uv run python -m fastanime.libs.provider.${provider_type}.${provider_name}.provider
|
||||
uv run python -m viu.libs.provider.${provider_type}.${provider_name}.provider
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
███████╗░█████╗░░██████╗████████╗░█████╗░███╗░░██╗██╗███╗░░░███╗███████╗
|
||||
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔══██╗████╗░██║██║████╗░████║██╔════╝
|
||||
█████╗░░███████║╚█████╗░░░░██║░░░███████║██╔██╗██║██║██╔████╔██║█████╗░░
|
||||
██╔══╝░░██╔══██║░╚═══██╗░░░██║░░░██╔══██║██║╚████║██║██║╚██╔╝██║██╔══╝░░
|
||||
██║░░░░░██║░░██║██████╔╝░░░██║░░░██║░░██║██║░╚███║██║██║░╚═╝░██║███████╗
|
||||
╚═╝░░░░░╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝╚═╝░░╚══╝╚═╝╚═╝░░░░░╚═╝╚══════╝
|
||||
@@ -1,169 +0,0 @@
|
||||
download = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# Basic download by title
|
||||
fastanime anilist download -t "Attack on Titan"
|
||||
\b
|
||||
# Download specific episodes
|
||||
fastanime anilist download -t "One Piece" --episode-range "1-10"
|
||||
\b
|
||||
# Download single episode
|
||||
fastanime anilist download -t "Death Note" --episode-range "1"
|
||||
\b
|
||||
# Download multiple specific episodes
|
||||
fastanime anilist download -t "Naruto" --episode-range "1,5,10"
|
||||
\b
|
||||
# Download with quality preference
|
||||
fastanime anilist download -t "Death Note" --quality 1080 --episode-range "1-5"
|
||||
\b
|
||||
# Download with multiple filters
|
||||
fastanime anilist download -g Action -T Isekai --score-greater 80 --status RELEASING
|
||||
\b
|
||||
# Download with concurrent downloads
|
||||
fastanime anilist download -t "Demon Slayer" --episode-range "1-5" --max-concurrent 3
|
||||
\b
|
||||
# Force redownload existing episodes
|
||||
fastanime anilist download -t "Your Name" --episode-range "1" --force-redownload
|
||||
\b
|
||||
# Download from a specific season and year
|
||||
fastanime anilist download --season WINTER --year 2024 -s POPULARITY_DESC
|
||||
\b
|
||||
# Download with genre filtering
|
||||
fastanime anilist download -g Action -g Adventure --score-greater 75
|
||||
\b
|
||||
# Download only completed series
|
||||
fastanime anilist download -g Fantasy --status FINISHED --score-greater 75
|
||||
\b
|
||||
# Download movies only
|
||||
fastanime anilist download -F MOVIE -s SCORE_DESC --quality best
|
||||
"""
|
||||
|
||||
|
||||
search = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# Basic search by title
|
||||
fastanime anilist search -t "Attack on Titan"
|
||||
\b
|
||||
# Search with multiple filters
|
||||
fastanime anilist search -g Action -T Isekai --score-greater 75 --status RELEASING
|
||||
\b
|
||||
# Get anime with the tag of isekai
|
||||
fastanime anilist search -T isekai
|
||||
\b
|
||||
# Get anime of 2024 and sort by popularity, finished or releasing, not in your list
|
||||
fastanime anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --status FINISHED --not-on-list
|
||||
\b
|
||||
# Get anime of 2024 season WINTER
|
||||
fastanime anilist search -y 2024 --season WINTER
|
||||
\b
|
||||
# Get anime genre action and tag isekai,magic
|
||||
fastanime anilist search -g Action -T Isekai -T Magic
|
||||
\b
|
||||
# Get anime of 2024 thats finished airing
|
||||
fastanime anilist search -y 2024 -S FINISHED
|
||||
\b
|
||||
# Get the most favourite anime movies
|
||||
fastanime anilist search -f MOVIE -s FAVOURITES_DESC
|
||||
\b
|
||||
# Search with score and popularity filters
|
||||
fastanime anilist search --score-greater 80 --popularity-greater 50000
|
||||
\b
|
||||
# Search excluding certain genres and tags
|
||||
fastanime anilist search --genres-not Ecchi --tags-not "Hentai"
|
||||
\b
|
||||
# Search with date ranges (YYYYMMDD format)
|
||||
fastanime anilist search --start-date-greater 20200101 --start-date-lesser 20241231
|
||||
\b
|
||||
# Get only TV series, exclude certain statuses
|
||||
fastanime anilist search -f TV --status-not CANCELLED --status-not HIATUS
|
||||
\b
|
||||
# Paginated search with custom page size
|
||||
fastanime anilist search -g Action --page 2 --per-page 25
|
||||
\b
|
||||
# Search for manga specifically
|
||||
fastanime anilist search --media-type MANGA -g Fantasy
|
||||
\b
|
||||
# Complex search with multiple criteria
|
||||
fastanime anilist search -t "demon" -g Action -g Supernatural --score-greater 70 --year 2020 -s SCORE_DESC
|
||||
\b
|
||||
# Dump search results as JSON instead of interactive mode
|
||||
fastanime anilist search -g Action --dump-json
|
||||
"""
|
||||
|
||||
|
||||
main = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# ---- search ----
|
||||
\b
|
||||
# Basic search by title
|
||||
fastanime anilist search -t "Attack on Titan"
|
||||
\b
|
||||
# Search with multiple filters
|
||||
fastanime anilist search -g Action -T Isekai --score-greater 75 --status RELEASING
|
||||
\b
|
||||
# Get anime with the tag of isekai
|
||||
fastanime anilist search -T isekai
|
||||
\b
|
||||
# Get anime of 2024 and sort by popularity, finished or releasing, not in your list
|
||||
fastanime anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --status FINISHED --not-on-list
|
||||
\b
|
||||
# Get anime of 2024 season WINTER
|
||||
fastanime anilist search -y 2024 --season WINTER
|
||||
\b
|
||||
# Get anime genre action and tag isekai,magic
|
||||
fastanime anilist search -g Action -T Isekai -T Magic
|
||||
\b
|
||||
# Get anime of 2024 thats finished airing
|
||||
fastanime anilist search -y 2024 -S FINISHED
|
||||
\b
|
||||
# Get the most favourite anime movies
|
||||
fastanime anilist search -f MOVIE -s FAVOURITES_DESC
|
||||
\b
|
||||
# Search with score and popularity filters
|
||||
fastanime anilist search --score-greater 80 --popularity-greater 50000
|
||||
\b
|
||||
# Search excluding certain genres and tags
|
||||
fastanime anilist search --genres-not Ecchi --tags-not "Hentai"
|
||||
\b
|
||||
# Search with date ranges (YYYYMMDD format)
|
||||
fastanime anilist search --start-date-greater 20200101 --start-date-lesser 20241231
|
||||
\b
|
||||
# Get only TV series, exclude certain statuses
|
||||
fastanime anilist search -f TV --status-not CANCELLED --status-not HIATUS
|
||||
\b
|
||||
# Paginated search with custom page size
|
||||
fastanime anilist search -g Action --page 2 --per-page 25
|
||||
\b
|
||||
# Search for manga specifically
|
||||
fastanime anilist search --media-type MANGA -g Fantasy
|
||||
\b
|
||||
# Complex search with multiple criteria
|
||||
fastanime anilist search -t "demon" -g Action -g Supernatural --score-greater 70 --year 2020 -s SCORE_DESC
|
||||
\b
|
||||
# Dump search results as JSON instead of interactive mode
|
||||
fastanime anilist search -g Action --dump-json
|
||||
\b
|
||||
# ---- login ----
|
||||
\b
|
||||
# To sign in just run
|
||||
fastanime anilist auth
|
||||
\b
|
||||
# To check your login status
|
||||
fastanime anilist auth --status
|
||||
\b
|
||||
# To log out and erase credentials
|
||||
fastanime anilist auth --logout
|
||||
\b
|
||||
# ---- notifier ----
|
||||
\b
|
||||
# basic form
|
||||
fastanime anilist notifier
|
||||
\b
|
||||
# with logging to stdout
|
||||
fastanime --log anilist notifier
|
||||
\b
|
||||
# with logging to a file. stored in the same place as your config
|
||||
fastanime --log-file anilist notifier
|
||||
"""
|
||||
@@ -1,31 +0,0 @@
|
||||
"""
|
||||
Example usage for the registry command
|
||||
"""
|
||||
|
||||
main = """
|
||||
|
||||
Examples:
|
||||
# Sync with remote AniList
|
||||
fastanime registry sync --upload --download
|
||||
|
||||
# Show detailed registry statistics
|
||||
fastanime registry stats --detailed
|
||||
|
||||
# Search local registry
|
||||
fastanime registry search "attack on titan"
|
||||
|
||||
# Export registry to JSON
|
||||
fastanime registry export --format json --output backup.json
|
||||
|
||||
# Import from backup
|
||||
fastanime registry import backup.json
|
||||
|
||||
# Clean up orphaned entries
|
||||
fastanime registry clean --dry-run
|
||||
|
||||
# Create full backup
|
||||
fastanime registry backup --compress
|
||||
|
||||
# Restore from backup
|
||||
fastanime registry restore backup.tar.gz
|
||||
"""
|
||||
@@ -1,7 +0,0 @@
|
||||
"""
|
||||
Core utilities for FastAnime application.
|
||||
|
||||
This module provides various utility classes and functions used throughout
|
||||
the FastAnime application, including concurrency management, file operations,
|
||||
and other common functionality.
|
||||
"""
|
||||
12
flake.nix
12
flake.nix
@@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "FastAnime Project Flake";
|
||||
description = "Viu Project Flake";
|
||||
|
||||
inputs = {
|
||||
# The nixpkgs unstable latest commit breaks the plyer python package
|
||||
@@ -23,7 +23,7 @@
|
||||
in
|
||||
{
|
||||
packages.default = python3Packages.buildPythonApplication {
|
||||
pname = "fastanime";
|
||||
pname = "viu";
|
||||
inherit version;
|
||||
pyproject = true;
|
||||
|
||||
@@ -67,13 +67,13 @@
|
||||
# Needs to be adapted for the nix derivation build
|
||||
doCheck = false;
|
||||
|
||||
pythonImportsCheck = [ "fastanime" ];
|
||||
pythonImportsCheck = [ "viu" ];
|
||||
|
||||
meta = {
|
||||
description = "Your browser anime experience from the terminal";
|
||||
homepage = "https://github.com/Benexl/FastAnime";
|
||||
changelog = "https://github.com/Benexl/FastAnime/releases/tag/v${version}";
|
||||
mainProgram = "fastanime";
|
||||
homepage = "https://github.com/Benexl/Viu";
|
||||
changelog = "https://github.com/Benexl/Viu/releases/tag/v${version}";
|
||||
mainProgram = "viu";
|
||||
license = lib.licenses.unlicense;
|
||||
maintainers = with lib.maintainers; [ theobori ];
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[project]
|
||||
name = "fastanime"
|
||||
name = "viu"
|
||||
version = "3.1.0"
|
||||
description = "A browser anime site experience from the terminal"
|
||||
license = "UNLICENSE"
|
||||
@@ -14,7 +14,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
fastanime = 'fastanime:Cli'
|
||||
viu = 'viu:Cli'
|
||||
|
||||
[project.optional-dependencies]
|
||||
standard = [
|
||||
|
||||
2
uv.lock
generated
2
uv.lock
generated
@@ -102,7 +102,7 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastanime"
|
||||
name = "viu"
|
||||
version = "3.1.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
|
||||
@@ -2,7 +2,7 @@ import sys
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
raise ImportError(
|
||||
"You are using an unsupported version of Python. Only Python versions 3.10 and above are supported by FastAnime"
|
||||
"You are using an unsupported version of Python. Only Python versions 3.10 and above are supported by Viu"
|
||||
) # noqa: F541
|
||||
|
||||
|
||||
7
viu/assets/defaults/ascii-art
Normal file
7
viu/assets/defaults/ascii-art
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
██╗░░░██╗██╗██╗░░░██╗
|
||||
██║░░░██║██║██║░░░██║
|
||||
╚██╗░██╔╝██║██║░░░██║
|
||||
░╚████╔╝░██║██║░░░██║
|
||||
░░╚██╔╝░░██║╚██████╔╝
|
||||
░░░╚═╝░░░╚═╝░╚═════╝░
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Rofi Theme: FastAnime "Tokyo Night" Confirmation
|
||||
* Rofi Theme: Viu "Tokyo Night" Confirmation
|
||||
* Author: Gemini ft Benexl
|
||||
* Description: A compact and clear modal dialog for Yes/No confirmations that displays a prompt.
|
||||
*/
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Rofi Theme: FastAnime "Tokyo Night" Input
|
||||
* Rofi Theme: Viu "Tokyo Night" Input
|
||||
* Author: Gemini ft Benexl
|
||||
* Description: A compact, modern modal dialog for text input that correctly displays the prompt.
|
||||
*/
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Rofi Theme: FastAnime "Tokyo Night" Main
|
||||
* Rofi Theme: Viu "Tokyo Night" Main
|
||||
* Author: Gemini ft Benexl
|
||||
* Description: A sharp, modern, and ultra-compact theme with a Tokyo Night palette.
|
||||
*/
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Rofi Theme: FastAnime "Tokyo Night" Horizontal Strip
|
||||
* Rofi Theme: Viu "Tokyo Night" Horizontal Strip
|
||||
* Author: Gemini ft Benexl
|
||||
* Description: A fullscreen, horizontal, icon-centric theme for previews.
|
||||
*/
|
||||
@@ -1,13 +1,13 @@
|
||||
# values in {NAME} syntax are provided by python using .replace()
|
||||
#
|
||||
[Unit]
|
||||
Description=FastAnime Background Worker
|
||||
Description=Viu Background Worker
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# Ensure you have the full path to your fastanime executable
|
||||
# Use `which fastanime` to find it
|
||||
# Ensure you have the full path to your viu executable
|
||||
# Use `which viu` to find it
|
||||
ExecStart={EXECUTABLE} worker --log
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 276 KiB |
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# FastAnime Airing Schedule Info Script Template
|
||||
# Viu Airing Schedule Info Script Template
|
||||
# This script formats and displays airing schedule details in the FZF preview pane.
|
||||
# Python injects the actual data values into the placeholders.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# FastAnime Character Info Script Template
|
||||
# Viu Character Info Script Template
|
||||
# This script formats and displays character details in the FZF preview pane.
|
||||
# Python injects the actual data values into the placeholders.
|
||||
|
||||
2
fastanime/assets/scripts/fzf/info.template.sh → viu/assets/scripts/fzf/info.template.sh
Executable file → Normal file
2
fastanime/assets/scripts/fzf/info.template.sh → viu/assets/scripts/fzf/info.template.sh
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# FastAnime Preview Info Script Template
|
||||
# Viu Preview Info Script Template
|
||||
# This script formats and displays the textual information in the FZF preview pane.
|
||||
# Some values are injected by python those with '{name}' syntax using .replace()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# FastAnime Review Info Script Template
|
||||
# Viu Review Info Script Template
|
||||
# This script formats and displays review details in the FZF preview pane.
|
||||
# Python injects the actual data values into the placeholders.
|
||||
|
||||
@@ -43,7 +43,7 @@ commands = {
|
||||
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
root="fastanime.cli.commands",
|
||||
root="viu.cli.commands",
|
||||
lazy_subcommands=commands,
|
||||
context_settings=dict(auto_envvar_prefix=PROJECT_NAME),
|
||||
)
|
||||
@@ -68,7 +68,7 @@ commands = {
|
||||
@click.pass_context
|
||||
def cli(ctx: click.Context, **options: "Unpack[Options]"):
|
||||
"""
|
||||
The main entry point for the FastAnime CLI.
|
||||
The main entry point for the Viu CLI.
|
||||
"""
|
||||
setup_logging(options["log"])
|
||||
setup_exceptions_handler(
|
||||
@@ -18,7 +18,7 @@ commands = {
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
name="anilist",
|
||||
root="fastanime.cli.commands.anilist.commands",
|
||||
root="viu.cli.commands.anilist.commands",
|
||||
invoke_without_command=True,
|
||||
help="A beautiful interface that gives you access to a commplete streaming experience",
|
||||
short_help="Access all streaming options",
|
||||
@@ -1,10 +1,10 @@
|
||||
from typing import TYPE_CHECKING, Dict, List
|
||||
|
||||
import click
|
||||
from fastanime.cli.utils.completion import anime_titles_shell_complete
|
||||
from fastanime.core.config import AppConfig
|
||||
from fastanime.core.exceptions import FastAnimeError
|
||||
from fastanime.libs.media_api.types import (
|
||||
from viu.cli.utils.completion import anime_titles_shell_complete
|
||||
from viu.core.config import AppConfig
|
||||
from viu.core.exceptions import ViuError
|
||||
from viu.libs.media_api.types import (
|
||||
MediaFormat,
|
||||
MediaGenre,
|
||||
MediaItem,
|
||||
@@ -112,15 +112,15 @@ if TYPE_CHECKING:
|
||||
)
|
||||
@click.pass_obj
|
||||
def download(config: AppConfig, **options: "Unpack[DownloadOptions]"):
|
||||
from fastanime.cli.service.download.service import DownloadService
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.cli.service.watch_history import WatchHistoryService
|
||||
from fastanime.cli.utils.parser import parse_episode_range
|
||||
from fastanime.libs.media_api.api import create_api_client
|
||||
from fastanime.libs.media_api.params import MediaSearchParams
|
||||
from fastanime.libs.provider.anime.provider import create_provider
|
||||
from fastanime.libs.selectors import create_selector
|
||||
from viu.cli.service.download.service import DownloadService
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.cli.service.watch_history import WatchHistoryService
|
||||
from viu.cli.utils.parser import parse_episode_range
|
||||
from viu.libs.media_api.api import create_api_client
|
||||
from viu.libs.media_api.params import MediaSearchParams
|
||||
from viu.libs.provider.anime.provider import create_provider
|
||||
from viu.libs.selectors import create_selector
|
||||
from rich.progress import Progress
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
@@ -181,7 +181,7 @@ def download(config: AppConfig, **options: "Unpack[DownloadOptions]"):
|
||||
search_result = media_api.search_media(search_params)
|
||||
|
||||
if not search_result or not search_result.media:
|
||||
raise FastAnimeError("No anime found matching your search criteria.")
|
||||
raise ViuError("No anime found matching your search criteria.")
|
||||
|
||||
anime_to_download: List[MediaItem]
|
||||
if options.get("yes"):
|
||||
@@ -219,7 +219,7 @@ def download(config: AppConfig, **options: "Unpack[DownloadOptions]"):
|
||||
total_downloaded = 0
|
||||
episode_range_str = options.get("episode_range")
|
||||
if not episode_range_str:
|
||||
raise FastAnimeError("--episode-range is required.")
|
||||
raise ViuError("--episode-range is required.")
|
||||
|
||||
for media_item in anime_to_download:
|
||||
watch_history.add_media_to_list_if_not_present(media_item)
|
||||
@@ -259,7 +259,7 @@ def download(config: AppConfig, **options: "Unpack[DownloadOptions]"):
|
||||
f"Finished. Successfully downloaded a total of {total_downloaded} episodes."
|
||||
)
|
||||
|
||||
except FastAnimeError as e:
|
||||
except ViuError as e:
|
||||
feedback.error("Download command failed", str(e))
|
||||
except Exception as e:
|
||||
feedback.error("An unexpected error occurred", str(e))
|
||||
@@ -1,5 +1,5 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from viu.core.config import AppConfig
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
@@ -11,8 +11,8 @@ def notifications(config: AppConfig):
|
||||
Displays unread notifications from AniList.
|
||||
Running this command will also mark the notifications as read on the AniList website.
|
||||
"""
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.libs.media_api.api import create_api_client
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.libs.media_api.api import create_api_client
|
||||
|
||||
from ....service.auth import AuthService
|
||||
|
||||
@@ -25,7 +25,7 @@ def notifications(config: AppConfig):
|
||||
|
||||
if not api_client.is_authenticated():
|
||||
feedback.error(
|
||||
"Authentication Required", "Please log in with 'fastanime anilist auth'."
|
||||
"Authentication Required", "Please log in with 'viu anilist auth'."
|
||||
)
|
||||
return
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import TYPE_CHECKING
|
||||
import click
|
||||
|
||||
from .....core.config import AppConfig
|
||||
from .....core.exceptions import FastAnimeError
|
||||
from .....core.exceptions import ViuError
|
||||
from .....libs.media_api.types import (
|
||||
MediaFormat,
|
||||
MediaGenre,
|
||||
@@ -235,14 +235,14 @@ def search(config: AppConfig, **options: "Unpack[SearchOptions]"):
|
||||
and score_lesser is not None
|
||||
and score_greater > score_lesser
|
||||
):
|
||||
raise FastAnimeError("Minimum score cannot be higher than maximum score")
|
||||
raise ViuError("Minimum score cannot be higher than maximum score")
|
||||
|
||||
if (
|
||||
popularity_greater is not None
|
||||
and popularity_lesser is not None
|
||||
and popularity_greater > popularity_lesser
|
||||
):
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
"Minimum popularity cannot be higher than maximum popularity"
|
||||
)
|
||||
|
||||
@@ -251,7 +251,7 @@ def search(config: AppConfig, **options: "Unpack[SearchOptions]"):
|
||||
and start_date_lesser is not None
|
||||
and start_date_greater > start_date_lesser
|
||||
):
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
"Start date greater cannot be later than start date lesser"
|
||||
)
|
||||
|
||||
@@ -260,7 +260,7 @@ def search(config: AppConfig, **options: "Unpack[SearchOptions]"):
|
||||
and end_date_lesser is not None
|
||||
and end_date_greater > end_date_lesser
|
||||
):
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
"End date greater cannot be later than end date lesser"
|
||||
)
|
||||
|
||||
@@ -297,7 +297,7 @@ def search(config: AppConfig, **options: "Unpack[SearchOptions]"):
|
||||
search_result = api_client.search_media(search_params)
|
||||
|
||||
if not search_result or not search_result.media:
|
||||
raise FastAnimeError("No anime found matching your search criteria")
|
||||
raise ViuError("No anime found matching your search criteria")
|
||||
|
||||
if dump_json:
|
||||
# Use Pydantic's built-in serialization
|
||||
@@ -326,7 +326,7 @@ def search(config: AppConfig, **options: "Unpack[SearchOptions]"):
|
||||
session.load_menus_from_folder("media")
|
||||
session.run(config, history=[initial_state])
|
||||
|
||||
except FastAnimeError as e:
|
||||
except ViuError as e:
|
||||
feedback.error("Search failed", str(e))
|
||||
raise click.Abort()
|
||||
except Exception as e:
|
||||
@@ -3,7 +3,7 @@ from typing import TYPE_CHECKING
|
||||
import click
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from fastanime.core.config import AppConfig
|
||||
from viu.core.config import AppConfig
|
||||
|
||||
|
||||
@click.command(help="Print out your anilist stats")
|
||||
@@ -38,7 +38,7 @@ def stats(config: "AppConfig"):
|
||||
)
|
||||
feedback.info(
|
||||
"Run this command to authenticate:",
|
||||
f"fastanime {config.general.media_api} auth",
|
||||
f"viu {config.general.media_api} auth",
|
||||
)
|
||||
raise click.Abort()
|
||||
|
||||
169
viu/cli/commands/anilist/examples.py
Normal file
169
viu/cli/commands/anilist/examples.py
Normal file
@@ -0,0 +1,169 @@
|
||||
download = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# Basic download by title
|
||||
viu anilist download -t "Attack on Titan"
|
||||
\b
|
||||
# Download specific episodes
|
||||
viu anilist download -t "One Piece" --episode-range "1-10"
|
||||
\b
|
||||
# Download single episode
|
||||
viu anilist download -t "Death Note" --episode-range "1"
|
||||
\b
|
||||
# Download multiple specific episodes
|
||||
viu anilist download -t "Naruto" --episode-range "1,5,10"
|
||||
\b
|
||||
# Download with quality preference
|
||||
viu anilist download -t "Death Note" --quality 1080 --episode-range "1-5"
|
||||
\b
|
||||
# Download with multiple filters
|
||||
viu anilist download -g Action -T Isekai --score-greater 80 --status RELEASING
|
||||
\b
|
||||
# Download with concurrent downloads
|
||||
viu anilist download -t "Demon Slayer" --episode-range "1-5" --max-concurrent 3
|
||||
\b
|
||||
# Force redownload existing episodes
|
||||
viu anilist download -t "Your Name" --episode-range "1" --force-redownload
|
||||
\b
|
||||
# Download from a specific season and year
|
||||
viu anilist download --season WINTER --year 2024 -s POPULARITY_DESC
|
||||
\b
|
||||
# Download with genre filtering
|
||||
viu anilist download -g Action -g Adventure --score-greater 75
|
||||
\b
|
||||
# Download only completed series
|
||||
viu anilist download -g Fantasy --status FINISHED --score-greater 75
|
||||
\b
|
||||
# Download movies only
|
||||
viu anilist download -F MOVIE -s SCORE_DESC --quality best
|
||||
"""
|
||||
|
||||
|
||||
search = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# Basic search by title
|
||||
viu anilist search -t "Attack on Titan"
|
||||
\b
|
||||
# Search with multiple filters
|
||||
viu anilist search -g Action -T Isekai --score-greater 75 --status RELEASING
|
||||
\b
|
||||
# Get anime with the tag of isekai
|
||||
viu anilist search -T isekai
|
||||
\b
|
||||
# Get anime of 2024 and sort by popularity, finished or releasing, not in your list
|
||||
viu anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --status FINISHED --not-on-list
|
||||
\b
|
||||
# Get anime of 2024 season WINTER
|
||||
viu anilist search -y 2024 --season WINTER
|
||||
\b
|
||||
# Get anime genre action and tag isekai,magic
|
||||
viu anilist search -g Action -T Isekai -T Magic
|
||||
\b
|
||||
# Get anime of 2024 thats finished airing
|
||||
viu anilist search -y 2024 -S FINISHED
|
||||
\b
|
||||
# Get the most favourite anime movies
|
||||
viu anilist search -f MOVIE -s FAVOURITES_DESC
|
||||
\b
|
||||
# Search with score and popularity filters
|
||||
viu anilist search --score-greater 80 --popularity-greater 50000
|
||||
\b
|
||||
# Search excluding certain genres and tags
|
||||
viu anilist search --genres-not Ecchi --tags-not "Hentai"
|
||||
\b
|
||||
# Search with date ranges (YYYYMMDD format)
|
||||
viu anilist search --start-date-greater 20200101 --start-date-lesser 20241231
|
||||
\b
|
||||
# Get only TV series, exclude certain statuses
|
||||
viu anilist search -f TV --status-not CANCELLED --status-not HIATUS
|
||||
\b
|
||||
# Paginated search with custom page size
|
||||
viu anilist search -g Action --page 2 --per-page 25
|
||||
\b
|
||||
# Search for manga specifically
|
||||
viu anilist search --media-type MANGA -g Fantasy
|
||||
\b
|
||||
# Complex search with multiple criteria
|
||||
viu anilist search -t "demon" -g Action -g Supernatural --score-greater 70 --year 2020 -s SCORE_DESC
|
||||
\b
|
||||
# Dump search results as JSON instead of interactive mode
|
||||
viu anilist search -g Action --dump-json
|
||||
"""
|
||||
|
||||
|
||||
main = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# ---- search ----
|
||||
\b
|
||||
# Basic search by title
|
||||
viu anilist search -t "Attack on Titan"
|
||||
\b
|
||||
# Search with multiple filters
|
||||
viu anilist search -g Action -T Isekai --score-greater 75 --status RELEASING
|
||||
\b
|
||||
# Get anime with the tag of isekai
|
||||
viu anilist search -T isekai
|
||||
\b
|
||||
# Get anime of 2024 and sort by popularity, finished or releasing, not in your list
|
||||
viu anilist search -y 2024 -s POPULARITY_DESC --status RELEASING --status FINISHED --not-on-list
|
||||
\b
|
||||
# Get anime of 2024 season WINTER
|
||||
viu anilist search -y 2024 --season WINTER
|
||||
\b
|
||||
# Get anime genre action and tag isekai,magic
|
||||
viu anilist search -g Action -T Isekai -T Magic
|
||||
\b
|
||||
# Get anime of 2024 thats finished airing
|
||||
viu anilist search -y 2024 -S FINISHED
|
||||
\b
|
||||
# Get the most favourite anime movies
|
||||
viu anilist search -f MOVIE -s FAVOURITES_DESC
|
||||
\b
|
||||
# Search with score and popularity filters
|
||||
viu anilist search --score-greater 80 --popularity-greater 50000
|
||||
\b
|
||||
# Search excluding certain genres and tags
|
||||
viu anilist search --genres-not Ecchi --tags-not "Hentai"
|
||||
\b
|
||||
# Search with date ranges (YYYYMMDD format)
|
||||
viu anilist search --start-date-greater 20200101 --start-date-lesser 20241231
|
||||
\b
|
||||
# Get only TV series, exclude certain statuses
|
||||
viu anilist search -f TV --status-not CANCELLED --status-not HIATUS
|
||||
\b
|
||||
# Paginated search with custom page size
|
||||
viu anilist search -g Action --page 2 --per-page 25
|
||||
\b
|
||||
# Search for manga specifically
|
||||
viu anilist search --media-type MANGA -g Fantasy
|
||||
\b
|
||||
# Complex search with multiple criteria
|
||||
viu anilist search -t "demon" -g Action -g Supernatural --score-greater 70 --year 2020 -s SCORE_DESC
|
||||
\b
|
||||
# Dump search results as JSON instead of interactive mode
|
||||
viu anilist search -g Action --dump-json
|
||||
\b
|
||||
# ---- login ----
|
||||
\b
|
||||
# To sign in just run
|
||||
viu anilist auth
|
||||
\b
|
||||
# To check your login status
|
||||
viu anilist auth --status
|
||||
\b
|
||||
# To log out and erase credentials
|
||||
viu anilist auth --logout
|
||||
\b
|
||||
# ---- notifier ----
|
||||
\b
|
||||
# basic form
|
||||
viu anilist notifier
|
||||
\b
|
||||
# with logging to stdout
|
||||
viu --log anilist notifier
|
||||
\b
|
||||
# with logging to a file. stored in the same place as your config
|
||||
viu --log-file anilist notifier
|
||||
"""
|
||||
@@ -7,16 +7,16 @@ import click
|
||||
\b
|
||||
\b\bExamples:
|
||||
# try to detect your shell and print completions
|
||||
fastanime completions
|
||||
viu completions
|
||||
\b
|
||||
# print fish completions
|
||||
fastanime completions --fish
|
||||
viu completions --fish
|
||||
\b
|
||||
# print bash completions
|
||||
fastanime completions --bash
|
||||
viu completions --bash
|
||||
\b
|
||||
# print zsh completions
|
||||
fastanime completions --zsh
|
||||
viu completions --zsh
|
||||
""",
|
||||
)
|
||||
@click.option("--fish", is_flag=True, help="print fish completions")
|
||||
@@ -40,8 +40,8 @@ def completions(fish, zsh, bash):
|
||||
if fish or (current_shell == "fish" and not zsh and not bash):
|
||||
print(
|
||||
"""
|
||||
function _fastanime_completion;
|
||||
set -l response (env _FASTANIME_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) fastanime);
|
||||
function _viu_completion;
|
||||
set -l response (env _VIU_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) viu);
|
||||
|
||||
for completion in $response;
|
||||
set -l metadata (string split "," $completion);
|
||||
@@ -56,21 +56,21 @@ function _fastanime_completion;
|
||||
end;
|
||||
end;
|
||||
|
||||
complete --no-files --command fastanime --arguments "(_fastanime_completion)";
|
||||
complete --no-files --command viu --arguments "(_viu_completion)";
|
||||
"""
|
||||
)
|
||||
elif zsh or (current_shell == "zsh" and not bash):
|
||||
print(
|
||||
"""
|
||||
#compdef fastanime
|
||||
#compdef viu
|
||||
|
||||
_fastanime_completion() {
|
||||
_viu_completion() {
|
||||
local -a completions
|
||||
local -a completions_with_descriptions
|
||||
local -a response
|
||||
(( ! $+commands[fastanime] )) && return 1
|
||||
(( ! $+commands[viu] )) && return 1
|
||||
|
||||
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _FASTANIME_COMPLETE=zsh_complete fastanime)}")
|
||||
response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _VIU_COMPLETE=zsh_complete viu)}")
|
||||
|
||||
for type key descr in ${response}; do
|
||||
if [[ "$type" == "plain" ]]; then
|
||||
@@ -97,21 +97,21 @@ _fastanime_completion() {
|
||||
|
||||
if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
|
||||
# autoload from fpath, call function directly
|
||||
_fastanime_completion "$@"
|
||||
_viu_completion "$@"
|
||||
else
|
||||
# eval/source/. command, register function for later
|
||||
compdef _fastanime_completion fastanime
|
||||
compdef _viu_completion viu
|
||||
fi
|
||||
"""
|
||||
)
|
||||
elif bash or current_shell == "bash":
|
||||
print(
|
||||
"""
|
||||
_fastanime_completion() {
|
||||
_viu_completion() {
|
||||
local IFS=$'\n'
|
||||
local response
|
||||
|
||||
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _FASTANIME_COMPLETE=bash_complete $1)
|
||||
response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _VIU_COMPLETE=bash_complete $1)
|
||||
|
||||
for completion in $response; do
|
||||
IFS=',' read type value <<< "$completion"
|
||||
@@ -130,11 +130,11 @@ _fastanime_completion() {
|
||||
return 0
|
||||
}
|
||||
|
||||
_fastanime_completion_setup() {
|
||||
complete -o nosort -F _fastanime_completion fastanime
|
||||
_viu_completion_setup() {
|
||||
complete -o nosort -F _viu_completion viu
|
||||
}
|
||||
|
||||
_fastanime_completion_setup;
|
||||
_viu_completion_setup;
|
||||
"""
|
||||
)
|
||||
else:
|
||||
@@ -11,25 +11,25 @@ from ...core.config import AppConfig
|
||||
\b\bExamples:
|
||||
# Edit your config in your default editor
|
||||
# NB: If it opens vim or vi exit with `:q`
|
||||
fastanime config
|
||||
viu config
|
||||
\b
|
||||
# Start the interactive configuration wizard
|
||||
fastanime config --interactive
|
||||
viu config --interactive
|
||||
\b
|
||||
# get the path of the config file
|
||||
fastanime config --path
|
||||
viu config --path
|
||||
\b
|
||||
# print desktop entry info
|
||||
fastanime config --generate-desktop-entry
|
||||
viu config --generate-desktop-entry
|
||||
\b
|
||||
# update your config without opening an editor
|
||||
fastanime --icons --selector fzf --preview full config --update
|
||||
viu --icons --selector fzf --preview full config --update
|
||||
\b
|
||||
# interactively define your config
|
||||
fastanime config --interactive
|
||||
viu config --interactive
|
||||
\b
|
||||
# view the current contents of your config
|
||||
fastanime config --view
|
||||
viu config --view
|
||||
""",
|
||||
)
|
||||
@click.option("--path", "-p", help="Print the config location and exit", is_flag=True)
|
||||
@@ -45,13 +45,13 @@ from ...core.config import AppConfig
|
||||
@click.option(
|
||||
"--generate-desktop-entry",
|
||||
"-d",
|
||||
help="Generate the desktop entry of fastanime",
|
||||
help="Generate the desktop entry of viu",
|
||||
is_flag=True,
|
||||
)
|
||||
@click.option(
|
||||
"--update",
|
||||
"-u",
|
||||
help="Persist all the config options passed to fastanime to your config file",
|
||||
help="Persist all the config options passed to viu to your config file",
|
||||
is_flag=True,
|
||||
)
|
||||
@click.option(
|
||||
@@ -112,7 +112,7 @@ def config(
|
||||
|
||||
def _generate_desktop_entry():
|
||||
"""
|
||||
Generates a desktop entry for FastAnime.
|
||||
Generates a desktop entry for Viu.
|
||||
"""
|
||||
import shutil
|
||||
import sys
|
||||
@@ -130,11 +130,11 @@ def _generate_desktop_entry():
|
||||
__version__,
|
||||
)
|
||||
|
||||
EXECUTABLE = shutil.which("fastanime")
|
||||
EXECUTABLE = shutil.which("viu")
|
||||
if EXECUTABLE:
|
||||
cmds = f"{EXECUTABLE} --selector rofi anilist"
|
||||
else:
|
||||
cmds = f"{sys.executable} -m fastanime --selector rofi anilist"
|
||||
cmds = f"{sys.executable} -m viu --selector rofi anilist"
|
||||
|
||||
# TODO: Get funs of the other platforms to complete this lol
|
||||
if PLATFORM == "win32":
|
||||
@@ -3,7 +3,7 @@ from typing import TYPE_CHECKING
|
||||
import click
|
||||
|
||||
from ...core.config import AppConfig
|
||||
from ...core.exceptions import FastAnimeError
|
||||
from ...core.exceptions import ViuError
|
||||
from ..utils.completion import anime_titles_shell_complete
|
||||
from . import examples
|
||||
|
||||
@@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
from typing import TypedDict
|
||||
|
||||
from fastanime.cli.service.feedback.service import FeedbackService
|
||||
from viu.cli.service.feedback.service import FeedbackService
|
||||
from typing_extensions import Unpack
|
||||
|
||||
from ...libs.provider.anime.base import BaseAnimeProvider
|
||||
@@ -103,9 +103,9 @@ if TYPE_CHECKING:
|
||||
)
|
||||
@click.pass_obj
|
||||
def download(config: AppConfig, **options: "Unpack[Options]"):
|
||||
from fastanime.cli.service.feedback.service import FeedbackService
|
||||
from viu.cli.service.feedback.service import FeedbackService
|
||||
|
||||
from ...core.exceptions import FastAnimeError
|
||||
from ...core.exceptions import ViuError
|
||||
from ...libs.provider.anime.params import (
|
||||
AnimeParams,
|
||||
SearchParams,
|
||||
@@ -129,7 +129,7 @@ def download(config: AppConfig, **options: "Unpack[Options]"):
|
||||
)
|
||||
)
|
||||
if not search_results:
|
||||
raise FastAnimeError("No results were found matching your query")
|
||||
raise ViuError("No results were found matching your query")
|
||||
|
||||
_search_results = {
|
||||
search_result.title: search_result
|
||||
@@ -140,7 +140,7 @@ def download(config: AppConfig, **options: "Unpack[Options]"):
|
||||
"Select Anime", list(_search_results.keys())
|
||||
)
|
||||
if not selected_anime_title:
|
||||
raise FastAnimeError("No title selected")
|
||||
raise ViuError("No title selected")
|
||||
anime_result = _search_results[selected_anime_title]
|
||||
|
||||
# ---- fetch selected anime ----
|
||||
@@ -148,7 +148,7 @@ def download(config: AppConfig, **options: "Unpack[Options]"):
|
||||
anime = provider.get(AnimeParams(id=anime_result.id, query=anime_title))
|
||||
|
||||
if not anime:
|
||||
raise FastAnimeError(f"Failed to fetch anime {anime_result.title}")
|
||||
raise ViuError(f"Failed to fetch anime {anime_result.title}")
|
||||
|
||||
available_episodes: list[str] = sorted(
|
||||
getattr(anime.episodes, config.stream.translation_type), key=float
|
||||
@@ -174,14 +174,14 @@ def download(config: AppConfig, **options: "Unpack[Options]"):
|
||||
episode,
|
||||
)
|
||||
except (ValueError, IndexError) as e:
|
||||
raise FastAnimeError(f"Invalid episode range: {e}") from e
|
||||
raise ViuError(f"Invalid episode range: {e}") from e
|
||||
else:
|
||||
episode = selector.choose(
|
||||
"Select Episode",
|
||||
getattr(anime.episodes, config.stream.translation_type),
|
||||
)
|
||||
if not episode:
|
||||
raise FastAnimeError("No episode selected")
|
||||
raise ViuError("No episode selected")
|
||||
download_anime(
|
||||
config,
|
||||
options,
|
||||
@@ -219,7 +219,7 @@ def download_anime(
|
||||
)
|
||||
)
|
||||
if not streams:
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
f"Failed to get streams for anime: {anime.title}, episode: {episode}"
|
||||
)
|
||||
|
||||
@@ -227,7 +227,7 @@ def download_anime(
|
||||
with feedback.progress("Fetching top server"):
|
||||
server = next(streams, None)
|
||||
if not server:
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
f"Failed to get server for anime: {anime.title}, episode: {episode}"
|
||||
)
|
||||
else:
|
||||
@@ -239,11 +239,11 @@ def download_anime(
|
||||
else:
|
||||
server_name = selector.choose("Select Server", servers_names)
|
||||
if not server_name:
|
||||
raise FastAnimeError("Server not selected")
|
||||
raise ViuError("Server not selected")
|
||||
server = servers[server_name]
|
||||
stream_link = server.links[0].link
|
||||
if not stream_link:
|
||||
raise FastAnimeError(
|
||||
raise ViuError(
|
||||
f"Failed to get stream link for anime: {anime.title}, episode: {episode}"
|
||||
)
|
||||
feedback.info(f"[green bold]Now Downloading:[/] {anime.title} Episode: {episode}")
|
||||
@@ -3,31 +3,31 @@ download = """
|
||||
\b\bExamples:
|
||||
# Download all available episodes
|
||||
# multiple titles can be specified with -t option
|
||||
fastanime download -t <anime-title> -t <anime-title>
|
||||
viu download -t <anime-title> -t <anime-title>
|
||||
# -- or --
|
||||
fastanime download -t <anime-title> -t <anime-title> -r ':'
|
||||
viu download -t <anime-title> -t <anime-title> -r ':'
|
||||
\b
|
||||
# download latest episode for the two anime titles
|
||||
# the number can be any no of latest episodes but a minus sign
|
||||
# must be present
|
||||
fastanime download -t <anime-title> -t <anime-title> -r '-1'
|
||||
viu download -t <anime-title> -t <anime-title> -r '-1'
|
||||
\b
|
||||
# latest 5
|
||||
fastanime download -t <anime-title> -t <anime-title> -r '-5'
|
||||
viu download -t <anime-title> -t <anime-title> -r '-5'
|
||||
\b
|
||||
# Download specific episode range
|
||||
# be sure to observe the range Syntax
|
||||
fastanime download -t <anime-title> -r '<episodes-start>:<episodes-end>:<step>'
|
||||
viu download -t <anime-title> -r '<episodes-start>:<episodes-end>:<step>'
|
||||
\b
|
||||
fastanime download -t <anime-title> -r '<episodes-start>:<episodes-end>'
|
||||
viu download -t <anime-title> -r '<episodes-start>:<episodes-end>'
|
||||
\b
|
||||
fastanime download -t <anime-title> -r '<episodes-start>:'
|
||||
viu download -t <anime-title> -r '<episodes-start>:'
|
||||
\b
|
||||
fastanime download -t <anime-title> -r ':<episodes-end>'
|
||||
viu download -t <anime-title> -r ':<episodes-end>'
|
||||
\b
|
||||
# download specific episode
|
||||
# remember python indexing starts at 0
|
||||
fastanime download -t <anime-title> -r '<episode-1>:<episode>'
|
||||
viu download -t <anime-title> -r '<episode-1>:<episode>'
|
||||
\b
|
||||
# merge subtitles with ffmpeg to mkv format; hianime tends to give subs as separate files
|
||||
# and dont prompt for anything
|
||||
@@ -35,36 +35,36 @@ download = """
|
||||
# and clean
|
||||
# ie remove original files (sub file and vid file)
|
||||
# only keep merged files
|
||||
fastanime download -t <anime-title> --merge --clean --no-prompt
|
||||
viu download -t <anime-title> --merge --clean --no-prompt
|
||||
\b
|
||||
# EOF is used since -t always expects a title
|
||||
# you can supply anime titles from file or -t at the same time
|
||||
# from stdin
|
||||
echo -e "<anime-title>\\n<anime-title>\\n<anime-title>" | fastanime download -t "EOF" -r <range> -f -
|
||||
echo -e "<anime-title>\\n<anime-title>\\n<anime-title>" | viu download -t "EOF" -r <range> -f -
|
||||
\b
|
||||
# from file
|
||||
fastanime download -t "EOF" -r <range> -f <file-path>
|
||||
viu download -t "EOF" -r <range> -f <file-path>
|
||||
"""
|
||||
search = """
|
||||
\b
|
||||
\b\bExamples:
|
||||
# basic form where you will still be prompted for the episode number
|
||||
# multiple titles can be specified with the -t option
|
||||
fastanime search -t <anime-title> -t <anime-title>
|
||||
viu search -t <anime-title> -t <anime-title>
|
||||
\b
|
||||
# binge all episodes with this command
|
||||
fastanime search -t <anime-title> -r ':'
|
||||
viu search -t <anime-title> -r ':'
|
||||
\b
|
||||
# watch latest episode
|
||||
fastanime search -t <anime-title> -r '-1'
|
||||
viu search -t <anime-title> -r '-1'
|
||||
\b
|
||||
# binge a specific episode range with this command
|
||||
# be sure to observe the range Syntax
|
||||
fastanime search -t <anime-title> -r '<start>:<stop>'
|
||||
viu search -t <anime-title> -r '<start>:<stop>'
|
||||
\b
|
||||
fastanime search -t <anime-title> -r '<start>:<stop>:<step>'
|
||||
viu search -t <anime-title> -r '<start>:<stop>:<step>'
|
||||
\b
|
||||
fastanime search -t <anime-title> -r '<start>:'
|
||||
viu search -t <anime-title> -r '<start>:'
|
||||
\b
|
||||
fastanime search -t <anime-title> -r ':<end>'
|
||||
viu search -t <anime-title> -r ':<end>'
|
||||
"""
|
||||
@@ -1,7 +1,7 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from fastanime.core.exceptions import FastAnimeError
|
||||
from fastanime.libs.media_api.types import (
|
||||
from viu.core.config import AppConfig
|
||||
from viu.core.exceptions import ViuError
|
||||
from viu.libs.media_api.types import (
|
||||
MediaFormat,
|
||||
MediaGenre,
|
||||
MediaItem,
|
||||
@@ -15,7 +15,7 @@ from fastanime.libs.media_api.types import (
|
||||
|
||||
|
||||
@click.command(help="Queue episodes for the background worker to download.")
|
||||
# Search/Filter options (mirrors 'fastanime anilist download')
|
||||
# Search/Filter options (mirrors 'viu anilist download')
|
||||
@click.option("--title", "-t")
|
||||
@click.option("--page", "-p", type=click.IntRange(min=1), default=1)
|
||||
@click.option("--per-page", type=click.IntRange(min=1, max=50))
|
||||
@@ -72,14 +72,14 @@ def queue(config: AppConfig, **options):
|
||||
and queue the specified episode range for background download.
|
||||
The background worker should be running to process the queue.
|
||||
"""
|
||||
from fastanime.cli.service.download.service import DownloadService
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.cli.utils.parser import parse_episode_range
|
||||
from fastanime.libs.media_api.params import MediaSearchParams
|
||||
from fastanime.libs.media_api.api import create_api_client
|
||||
from fastanime.libs.provider.anime.provider import create_provider
|
||||
from fastanime.libs.selectors import create_selector
|
||||
from viu.cli.service.download.service import DownloadService
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.cli.utils.parser import parse_episode_range
|
||||
from viu.libs.media_api.params import MediaSearchParams
|
||||
from viu.libs.media_api.api import create_api_client
|
||||
from viu.libs.provider.anime.provider import create_provider
|
||||
from viu.libs.selectors import create_selector
|
||||
from rich.progress import Progress
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
@@ -140,7 +140,7 @@ def queue(config: AppConfig, **options):
|
||||
search_result = media_api.search_media(search_params)
|
||||
|
||||
if not search_result or not search_result.media:
|
||||
raise FastAnimeError("No anime found matching your search criteria.")
|
||||
raise ViuError("No anime found matching your search criteria.")
|
||||
|
||||
if options.get("yes"):
|
||||
anime_to_queue = search_result.media
|
||||
@@ -212,7 +212,7 @@ def queue(config: AppConfig, **options):
|
||||
f"Done. Total of {total_queued} episode(s) queued across all selections."
|
||||
)
|
||||
|
||||
except FastAnimeError as e:
|
||||
except ViuError as e:
|
||||
feedback.error("Queue command failed", str(e))
|
||||
except Exception as e:
|
||||
feedback.error("An unexpected error occurred", str(e))
|
||||
@@ -13,7 +13,7 @@ commands = {
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
name="queue",
|
||||
root="fastanime.cli.commands.queue.commands",
|
||||
root="viu.cli.commands.queue.commands",
|
||||
invoke_without_command=False,
|
||||
help="Manage the download queue (add, list, resume, clear).",
|
||||
short_help="Manage the download queue.",
|
||||
@@ -1,7 +1,7 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from fastanime.core.exceptions import FastAnimeError
|
||||
from fastanime.libs.media_api.types import (
|
||||
from viu.core.config import AppConfig
|
||||
from viu.core.exceptions import ViuError
|
||||
from viu.libs.media_api.types import (
|
||||
MediaFormat,
|
||||
MediaGenre,
|
||||
MediaItem,
|
||||
@@ -70,14 +70,14 @@ from fastanime.libs.media_api.types import (
|
||||
)
|
||||
@click.pass_obj
|
||||
def add(config: AppConfig, **options):
|
||||
from fastanime.cli.service.download import DownloadService
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.cli.utils.parser import parse_episode_range
|
||||
from fastanime.libs.media_api.api import create_api_client
|
||||
from fastanime.libs.media_api.params import MediaSearchParams
|
||||
from fastanime.libs.provider.anime.provider import create_provider
|
||||
from fastanime.libs.selectors import create_selector
|
||||
from viu.cli.service.download import DownloadService
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.cli.utils.parser import parse_episode_range
|
||||
from viu.libs.media_api.api import create_api_client
|
||||
from viu.libs.media_api.params import MediaSearchParams
|
||||
from viu.libs.provider.anime.provider import create_provider
|
||||
from viu.libs.selectors import create_selector
|
||||
from rich.progress import Progress
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
@@ -138,7 +138,7 @@ def add(config: AppConfig, **options):
|
||||
search_result = media_api.search_media(search_params)
|
||||
|
||||
if not search_result or not search_result.media:
|
||||
raise FastAnimeError("No anime found matching your search criteria.")
|
||||
raise ViuError("No anime found matching your search criteria.")
|
||||
|
||||
if options.get("yes"):
|
||||
anime_to_queue = search_result.media
|
||||
@@ -149,7 +149,7 @@ def add(config: AppConfig, **options):
|
||||
}
|
||||
preview_command = None
|
||||
if config.general.preview != "none":
|
||||
from fastanime.cli.utils.preview import create_preview_context
|
||||
from viu.cli.utils.preview import create_preview_context
|
||||
|
||||
with create_preview_context() as preview_ctx:
|
||||
preview_command = preview_ctx.get_anime_preview(
|
||||
@@ -211,7 +211,7 @@ def add(config: AppConfig, **options):
|
||||
f"Done. Total of {total_queued} episode(s) queued across all selections."
|
||||
)
|
||||
|
||||
except FastAnimeError as e:
|
||||
except ViuError as e:
|
||||
feedback.error("Queue add failed", str(e))
|
||||
except Exception as e:
|
||||
feedback.error("An unexpected error occurred", str(e))
|
||||
@@ -1,14 +1,14 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from viu.core.config import AppConfig
|
||||
|
||||
|
||||
@click.command(name="clear", help="Clear queued items from the registry (QUEUED -> NOT_DOWNLOADED).")
|
||||
@click.option("--force", is_flag=True, help="Do not prompt for confirmation.")
|
||||
@click.pass_obj
|
||||
def clear_cmd(config: AppConfig, force: bool):
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.cli.service.registry.models import DownloadStatus
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.cli.service.registry.models import DownloadStatus
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
registry = MediaRegistryService(config.general.media_api, config.media_registry)
|
||||
@@ -1,5 +1,5 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from viu.core.config import AppConfig
|
||||
|
||||
|
||||
@click.command(name="list", help="List items in the download queue and their statuses.")
|
||||
@@ -10,9 +10,9 @@ from fastanime.core.config import AppConfig
|
||||
@click.option("--detailed", is_flag=True)
|
||||
@click.pass_obj
|
||||
def list_cmd(config: AppConfig, status: str | None, detailed: bool | None):
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.cli.service.registry.models import DownloadStatus
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.cli.service.registry.models import DownloadStatus
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
registry = MediaRegistryService(config.general.media_api, config.media_registry)
|
||||
@@ -1,15 +1,15 @@
|
||||
import click
|
||||
from fastanime.core.config import AppConfig
|
||||
from viu.core.config import AppConfig
|
||||
|
||||
|
||||
@click.command(name="resume", help="Submit any queued or in-progress downloads to the worker.")
|
||||
@click.pass_obj
|
||||
def resume(config: AppConfig):
|
||||
from fastanime.cli.service.download.service import DownloadService
|
||||
from fastanime.cli.service.feedback import FeedbackService
|
||||
from fastanime.cli.service.registry import MediaRegistryService
|
||||
from fastanime.libs.media_api.api import create_api_client
|
||||
from fastanime.libs.provider.anime.provider import create_provider
|
||||
from viu.cli.service.download.service import DownloadService
|
||||
from viu.cli.service.feedback import FeedbackService
|
||||
from viu.cli.service.registry import MediaRegistryService
|
||||
from viu.libs.media_api.api import create_api_client
|
||||
from viu.libs.provider.anime.provider import create_provider
|
||||
|
||||
feedback = FeedbackService(config)
|
||||
media_api = create_api_client(config.general.media_api, config)
|
||||
@@ -19,7 +19,7 @@ commands = {
|
||||
@click.group(
|
||||
cls=LazyGroup,
|
||||
name="registry",
|
||||
root="fastanime.cli.commands.registry.commands",
|
||||
root="viu.cli.commands.registry.commands",
|
||||
invoke_without_command=True,
|
||||
help="Manage your local media registry - sync, search, backup and maintain your anime database",
|
||||
short_help="Local media registry management",
|
||||
@@ -69,7 +69,7 @@ def backup(
|
||||
)
|
||||
if backup_format == "zip":
|
||||
extension = "zip"
|
||||
output = f"fastanime_registry_backup_{api}_{timestamp}.{extension}"
|
||||
output = f"viu_registry_backup_{api}_{timestamp}.{extension}"
|
||||
|
||||
output_path = Path(output)
|
||||
|
||||
@@ -208,7 +208,7 @@ def _create_backup_metadata(
|
||||
|
||||
return {
|
||||
"backup_timestamp": datetime.now().isoformat(),
|
||||
"fastanime_version": __version__,
|
||||
"viu_version": __version__,
|
||||
"registry_version": stats.get("version"),
|
||||
"api": api,
|
||||
"total_media": stats.get("total_media", 0),
|
||||
@@ -78,7 +78,7 @@ def export(
|
||||
extension = output_format.lower()
|
||||
if compress:
|
||||
extension += ".gz"
|
||||
output_path = Path(f"fastanime_registry_{api}_{timestamp}.{extension}")
|
||||
output_path = Path(f"viu_registry_{api}_{timestamp}.{extension}")
|
||||
else:
|
||||
output_path = output
|
||||
|
||||
@@ -230,7 +230,7 @@ def _export_xml(data: dict, output_path: Path):
|
||||
"""Export data to XML format."""
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
root = ET.Element("fastanime_registry")
|
||||
root = ET.Element("viu_registry")
|
||||
|
||||
# Add metadata
|
||||
metadata_elem = ET.SubElement(root, "metadata")
|
||||
@@ -109,7 +109,7 @@ def _create_backup(
|
||||
from .export import _export_json, _prepare_export_data
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
backup_path = Path(f"fastanime_registry_pre_import_{api}_{timestamp}.json")
|
||||
backup_path = Path(f"viu_registry_pre_import_{api}_{timestamp}.json")
|
||||
|
||||
export_data = _prepare_export_data(registry_service, True, ())
|
||||
_export_json(export_data, backup_path)
|
||||
@@ -177,7 +177,7 @@ def _backup_current_registry(
|
||||
from .backup import _create_tar_backup
|
||||
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
backup_path = Path(f"fastanime_registry_pre_restore_{api}_{timestamp}.tar.gz")
|
||||
backup_path = Path(f"viu_registry_pre_restore_{api}_{timestamp}.tar.gz")
|
||||
|
||||
try:
|
||||
_create_tar_backup(registry_service, backup_path, True, False, feedback, api)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user