### GET Start Program Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Initiate the main program processes, including RSS checking, downloading, and renaming. ```http GET /start ``` -------------------------------- ### GET Check Setup Status Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Determine if the setup wizard is required, indicating a first-time run. ```http GET /setup/status ``` ```json { "need_setup": true } ``` -------------------------------- ### Complete Setup Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Saves all configurations and marks the setup as complete. ```APIDOC ## POST /setup/complete ### Description Saves all configurations and marks the setup as complete. Creates the configuration completion marker file `config/.setup_complete`. ### Method POST ### Endpoint /setup/complete ### Request Body - **configuration** (object) - Required - The complete configuration object. ### Request Example ```json { "configuration": { "rss_url": "https://example.com/rss", "notification_settings": { "type": "telegram", "token": "bot_token", "chat_id": "chat_id" } } } ``` ### Response #### Success Response (200) - **msg_en** (string) - Success message in English. - **msg_zh** (string) - Success message in Chinese. - **status** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "msg_en": "Setup completed successfully.", "msg_zh": "设置已成功完成。", "status": true } ``` ``` -------------------------------- ### Initialization Setup API Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt APIs for the initial setup and configuration wizard, including testing connections and completing the setup. ```APIDOC ## GET /api/v1/setup/status ### Description Checks the current setup status to determine if initialization is required. ### Method GET ### Endpoint /api/v1/setup/status ### Parameters None ### Request Example ```bash curl -X GET "http://localhost:7892/api/v1/setup/status" ``` ### Response #### Success Response (200) - **need_setup** (boolean) - Indicates if initialization setup is needed. - **version** (string) - The current version of the application. #### Response Example ```json { "need_setup": true, "version": "3.2.4" } ``` ## POST /api/v1/setup/test-downloader ### Description Tests the connection to a downloader client. ### Method POST ### Endpoint /api/v1/setup/test-downloader ### Parameters #### Request Body - **type** (string) - Required - The type of downloader (e.g., "qbittorrent"). - **host** (string) - Required - The host address of the downloader. - **username** (string) - Required - The username for the downloader. - **password** (string) - Required - The password for the downloader. - **ssl** (boolean) - Optional - Whether to use SSL for the connection. ### Request Example ```bash curl -X POST "http://localhost:7892/api/v1/setup/test-downloader" \ -H "Content-Type: application/json" \ -d '{ "type": "qbittorrent", "host": "http://192.168.1.100:8080", "username": "admin", "password": "adminadmin", "ssl": false }' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the connection test was successful. - **message_en** (string) - Success message in English. - **message_zh** (string) - Success message in Chinese. #### Response Example ```json { "success": true, "message_en": "Connection successful.", "message_zh": "连接成功。" } ``` ## POST /api/v1/setup/test-rss ### Description Tests the validity and accessibility of an RSS feed URL. ### Method POST ### Endpoint /api/v1/setup/test-rss ### Parameters #### Request Body - **url** (string) - Required - The URL of the RSS feed. ### Request Example ```bash curl -X POST "http://localhost:7892/api/v1/setup/test-rss" \ -H "Content-Type: application/json" \ -d '{"url": "https://mikanani.me/RSS/MyBangumi?token=xxx"}' ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the RSS feed is valid. - **message_en** (string) - Success message in English. - **message_zh** (string) - Success message in Chinese. - **title** (string) - The title of the RSS feed. - **item_count** (integer) - The number of items in the RSS feed. #### Response Example ```json { "success": true, "message_en": "RSS feed is valid.", "message_zh": "RSS 源有效。", "title": "Mikan Project - 我的订阅", "item_count": 25 } ``` ## POST /api/v1/setup/test-notification ### Description Tests the notification service configuration. ### Method POST ### Endpoint /api/v1/setup/test-notification ### Parameters #### Request Body - **type** (string) - Required - The type of notification service (e.g., "telegram"). - **token** (string) - Required - The API token for the notification service. - **chat_id** (string) - Required - The chat ID for the notification service. ### Request Example ```bash curl -X POST "http://localhost:7892/api/v1/setup/test-notification" \ -H "Content-Type: application/json" \ -d '{ "type": "telegram", "token": "your_bot_token", "chat_id": "your_chat_id" }' ``` ### Response #### Success Response (200) (No specific response body details provided in the source, typically an empty object or a success message) #### Response Example (No specific response example provided in the source) ## POST /api/v1/setup/complete ### Description Completes the initialization setup process with the provided configuration. ### Method POST ### Endpoint /api/v1/setup/complete ### Parameters #### Request Body - **username** (string) - Required - The username for the application. - **password** (string) - Required - The password for the application. - **downloader_type** (string) - Required - The type of downloader. - **downloader_host** (string) - Required - The host of the downloader. - **downloader_username** (string) - Required - The username for the downloader. - **downloader_password** (string) - Required - The password for the downloader. - **downloader_path** (string) - Required - The download path on the downloader. - **downloader_ssl** (boolean) - Optional - Whether SSL is used for the downloader connection. - **rss_url** (string) - Required - The URL of the RSS feed. - **rss_name** (string) - Required - The name for the RSS feed. - **notification_enable** (boolean) - Required - Whether notifications are enabled. - **notification_type** (string) - Optional - The type of notification service. - **notification_token** (string) - Optional - The API token for the notification service. - **notification_chat_id** (string) - Optional - The chat ID for the notification service. ### Request Example ```bash curl -X POST "http://localhost:7892/api/v1/setup/complete" \ -H "Content-Type: application/json" \ -d '{ "username": "admin", "password": "secure_password_123", "downloader_type": "qbittorrent", "downloader_host": "http://192.168.1.100:8080", "downloader_username": "admin", "downloader_password": "adminadmin", "downloader_path": "/downloads/Bangumi", "downloader_ssl": false, "rss_url": "https://mikanani.me/RSS/MyBangumi?token=xxx", "rss_name": "我的订阅", "notification_enable": true, "notification_type": "telegram", "notification_token": "your_bot_token", "notification_chat_id": "your_chat_id" }' ``` ### Response #### Success Response (200) (No specific response body details provided in the source, typically an empty object or a success message) #### Response Example (No specific response example provided in the source) ``` -------------------------------- ### Complete Initialization Setup Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Finalizes the initial setup by submitting all configuration details, including downloader, RSS, and notification settings. ```bash curl -X POST "http://localhost:7892/api/v1/setup/complete" \ -H "Content-Type: application/json" \ -d '{ "username": "admin", "password": "secure_password_123", "downloader_type": "qbittorrent", "downloader_host": "http://192.168.1.100:8080", "downloader_username": "admin", "downloader_password": "adminadmin", "downloader_path": "/downloads/Bangumi", "downloader_ssl": false, "rss_url": "https://mikanani.me/RSS/MyBangumi?token=xxx", "rss_name": "我的订阅", "notification_enable": true, "notification_type": "telegram", "notification_token": "your_bot_token", "notification_chat_id": "your_chat_id" }' ``` -------------------------------- ### Example Deployment Output Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose This log output shows a successful AutoBangumi deployment, including adding RSS feeds, starting collection of past episodes, and initiating the download process. ```other 2022-06-05 16:38:49 INFO: Add RSS Feed successfully. 2022-06-05 16:38:50 INFO: Adding Kawaii dake ja Nai Shikimori-san Season 1 2022-06-05 16:38:50 INFO: Adding Kakkou no Iinazuke Season 1 2022-06-05 16:38:50 INFO: Adding SPYxFAMILY Season 1 2022-06-05 16:38:50 INFO: Adding Love Live!虹咲学园 学园偶像同好会 Season 2 2022-06-05 16:38:50 INFO: Adding CUE! Season 1 2022-06-05 16:38:50 INFO: Adding Kaguya-sama wa Kokurasetai Season 3 2022-06-05 16:38:50 INFO: Adding Shokei Shoujo no Virgin Road Season 1 2022-06-05 16:38:50 INFO: Adding Kakkou no Iikagen Season 1 2022-06-05 16:38:50 INFO: Adding Summer Time Rendering Season 1 2022-06-05 16:38:50 INFO: Adding Mahoutsukai Reimeiki Season 1 2022-06-05 16:38:50 INFO: Adding Paripi Koumei Season 1 2022-06-05 16:38:50 INFO: Adding Komi-san wa, Komyushou Desu. Season 1 2022-06-05 16:38:50 INFO: Adding Deaimon Season 1 2022-06-05 16:38:50 INFO: Adding Tate no Yuusha no Nariagari Season 2 2022-06-05 16:38:50 INFO: Adding Shijou Saikyou no Daimaou Season 1 2022-06-05 16:38:50 INFO: Adding Yuusha, Yamemasu Season 1 2022-06-05 16:38:50 INFO: Adding Tomodachi Game Season 1 2022-06-05 16:38:50 INFO: Adding Machikado Mazoku: 2-choume Season 1 2022-06-05 16:38:50 INFO: Start collecting past episodes. 2022-06-05 16:39:32 INFO: Start adding rules. 2022-06-05 16:39:32 INFO: Finished. 2022-06-05 16:39:32 INFO: Waiting for downloading torrents... 2022-06-05 16:49:32 INFO: Finished checking 185 file's name. 2022-06-05 16:49:32 INFO: Renamed 0 files. 2022-06-05 16:49:32 INFO: Finished rename process. ``` -------------------------------- ### Complete Setup Endpoint Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Saves all configurations and marks the setup process as complete. This action creates a '.setup_complete' file in the config directory. ```http POST /setup/complete ``` -------------------------------- ### Setup Wizard API Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Endpoints available only during the initial setup wizard. These do not require authentication and are disabled after setup is complete. ```APIDOC ## GET /setup/status ### Description Check if the setup wizard is needed (first run). ### Method GET ### Endpoint /setup/status ### Response #### Success Response (200) - **need_setup** (boolean) - True if the setup wizard is required, false otherwise. ### Response Example ```json { "need_setup": true } ``` ## POST /setup/test-downloader ### Description Test the connection to the downloader using provided credentials. ### Method POST ### Endpoint /setup/test-downloader ### Request Body - **type** (string) - Required - The type of downloader (e.g., "qbittorrent"). - **host** (string) - Required - The host and port of the downloader (e.g., "172.17.0.1:8080"). - **username** (string) - Required - The username for the downloader. - **password** (string) - Required - The password for the downloader. - **ssl** (boolean) - Optional - Whether to use SSL/TLS. ### Request Example ```json { "type": "qbittorrent", "host": "172.17.0.1:8080", "username": "admin", "password": "adminadmin", "ssl": false } ``` ``` -------------------------------- ### Set Up Python Virtual Environment and Install Dependencies Source: https://github.com/estrellaxd/auto_bangumi/wiki/Windows-本地部署 Create a new Python virtual environment, activate it, and install project dependencies from requirements.txt. Ensure your Python version matches the one specified in the Dockerfile. ```powershell python -m venv env .\env\Scripts\Activate.ps1 python -m pip install -r requirements.txt ``` -------------------------------- ### Check Initialization Status Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Checks if the initial setup is required for the application. Returns a JSON object indicating the setup status and the current version. ```bash curl -X GET "http://localhost:7892/api/v1/setup/status" ``` -------------------------------- ### Download and Setup WebUI Source: https://github.com/estrellaxd/auto_bangumi/wiki/local-run Download the WebUI release, unzip it, and move the contents to the 'templates' directory. ```bash wget https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/download/latest/dist.zip unzip dist.zip mv dist templates ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/estrellaxd/auto_bangumi/wiki/local-run Install the required Python packages using pip. Ensure you have Python 3.10 or higher installed. ```bash python3 pip install -r requirements.txt ``` -------------------------------- ### Install Docker Compose Plugin Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose If Docker Compose is not installed, use these commands to update your package list and install the necessary plugin. ```bash $ sudo apt-get update $ sudo apt-get install docker-compose-plugin ``` -------------------------------- ### Create Configuration and Data Folders and Run Application Source: https://github.com/estrellaxd/auto_bangumi/wiki/local-run Create necessary directories for configuration and data, then start the AutoBangumi application. ```bash mkdir "config" mkdir "data" python3 main.py ``` -------------------------------- ### Start AutoBangumi Service Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Initiates the AutoBangumi service. Requires authentication. ```bash curl -X GET "http://localhost:7892/api/v1/start" \ -H "Cookie: token=your_jwt_token" ``` -------------------------------- ### Example RSS Feed Links (Plain Text) Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/deploy/quick-start.md These are example formats for Mikan Project RSS feed links. Replace 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' with your actual token. ```text https://mikanani.me/RSS/MyBangumi?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # 或 https://mikanime.tv/RSS/MyBangumi?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Start AutoBangumi Docker Container Source: https://github.com/estrellaxd/auto_bangumi/wiki/2.6更新说明 Command to start the AutoBangumi container using Docker Compose after updating the configuration. ```bash docker compose up -d autobangumi ``` -------------------------------- ### Install AutoBangumi as a Service with NSSM Source: https://github.com/estrellaxd/auto_bangumi/wiki/Windows-本地部署 Configure AutoBangumi to run as a Windows service using NSSM. This involves installing the service, setting application parameters and directory, and configuring delayed auto-start. ```powershell nssm install AutoBangumi (Get-Command python).Source nssm set AutoBangumi AppParameters (Get-Item .\main.py).FullName nssm set AutoBangumi AppDirectory (Get-Item ..).FullName nssm set AutoBangumi Start SERVICE_DELAYED_AUTO_START ``` -------------------------------- ### Install Docker Compose Plugin Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/deploy/docker-compose.md Install the Docker Compose plugin if it's not already present. This command is for Debian-based systems like Ubuntu. ```bash sudo apt-get update sudo apt-get install docker-compose-plugin ``` -------------------------------- ### GET Check Downloader Connection Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Test the connection to the configured downloader, typically qBittorrent. ```http GET /check/downloader ``` -------------------------------- ### Download and Install WebUI Source: https://github.com/estrellaxd/auto_bangumi/wiki/Windows-本地部署 Download the latest release of the AutoBangumi WebUI, extract it, and move the contents to the backend templates directory. ```powershell Invoke-WebRequest -Uri "https://github.com/Rewrite0/Auto_Bangumi_WebUI/releases/latest/download/dist.zip" -OutFile "dist.zip" Expand-Archive -Path "dist.zip" mv dist\* backend\src\templates ``` -------------------------------- ### Download Docker Compose for AutoBangumi Only Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Download the Docker Compose configuration file for a standalone AutoBangumi installation. ```bash wget https://raw.githubusercontent.com/EstrellaXD/Auto_Bangumi/main/docs/docker-compose/AutoBangumi/docker-compose.yml ``` -------------------------------- ### Standard Path for Collections and Files Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/changelog/2.6.md Example of the standard directory structure AutoBangumi expects for organizing downloaded media files and collections. ```text /downloads/Bangumi/Title/Season 1/xxx ``` -------------------------------- ### GET Configuration Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Retrieve the current application configuration, including settings for program, downloader, RSS parser, and more. ```http GET /config/get ``` -------------------------------- ### Run AutoBangumi Application Source: https://github.com/estrellaxd/auto_bangumi/wiki/Windows-本地部署 Navigate to the backend src directory and run the main Python script to start the AutoBangumi application. ```powershell cd backend\src python main.py ``` -------------------------------- ### Get Passkey Registration Options Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Requests options for registering a new Passkey. The response is intended for use with `navigator.credentials.create()`. Requires authentication. ```bash curl -X POST "http://localhost:7892/api/v1/passkey/register/options" \ -H "Cookie: token=your_jwt_token" ``` -------------------------------- ### POST Passkey Registration Options Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Obtain WebAuthn registration options, including challenges and relying party information, for Passkey setup. ```http POST /passkey/register/options ``` -------------------------------- ### POST Test Downloader Connection Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Test the connection to a downloader using provided credentials and type during the setup process. ```http POST /setup/test-downloader ``` ```json { "type": "qbittorrent", "host": "172.17.0.1:8080", "username": "admin", "password": "adminadmin", "ssl": false } ``` -------------------------------- ### Get Search Provider Configurations Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Retrieve the current configurations for all search providers, including their search URL patterns. ```bash curl -X GET "http://localhost:7892/api/v1/search/provider/config" \ -H "Cookie: token=your_jwt_token" ``` -------------------------------- ### Navigate to Source Directory and Create Version Info Source: https://github.com/estrellaxd/auto_bangumi/wiki/local-run Change into the 'src' directory and create a version file for local builds. ```bash cd src echo "VERSION = 'local'" >> module/__version__.py ``` -------------------------------- ### Download Docker Compose for qBittorrent + AutoBangumi Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Download the Docker Compose configuration file to set up both qBittorrent and AutoBangumi. ```bash wget https://raw.githubusercontent.com/EstrellaXD/Auto_Bangumi/main/docs/docker-compose/qBittorrent+AutoBangumi/docker-compose.yml ``` -------------------------------- ### Get Data API Source: https://github.com/estrellaxd/auto_bangumi/wiki/使用说明 Retrieve storage information currently held within AutoBangumi. This API call is a GET request. ```bash curl --request GET -sL \ --url 'http://ab_host:7892/api/v1/data'\ ``` -------------------------------- ### Download Docker Compose for All-in-one (qBittorrent + AutoBangumi + Plex) Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Download the Docker Compose configuration file for a comprehensive setup including qBittorrent, AutoBangumi, and Plex. ```bash wget https://raw.githubusercontent.com/EstrellaXD/Auto_Bangumi/main/docs/docker-compose/All-in-one/docker-compose.yml ``` -------------------------------- ### Initialize Downloader and Set Rules Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Initializes the download client, sets up anime download rules, and adds torrents. Requires importing DownloadClient, Bangumi, and Torrent. ```python async with DownloadClient() as client: # Initialize downloader settings await client.init_downloader() # Set anime automatic download rules bangumi = Bangumi( official_title="葬送的芙莉莲", title_raw="[ANi] Sousou no Frieren", season=1, rss_link="https://mikanani.me/RSS/Bangumi?bangumiId=3141", filter="720,\d+-\d+" ) await client.set_rule(bangumi) # Add torrent download torrent = Torrent(url="magnet:?xt=urn:btih:...") await client.add_torrent(torrent, bangumi) # Get torrents being downloaded torrents = await client.get_torrent_info( category="Bangumi", status_filter="downloading" ) for t in torrents: print(f"{t['name']}: {t['progress']*100:.1f}%") # Rename torrent file await client.rename_torrent_file( _hash="abc123", old_path="[ANi] Sousou no Frieren - 01 [1080p].mkv", new_path="葬送的芙莉莲 - S01E01.mkv" ) # Add tag to torrent await client.add_tag("abc123", "ab:1") ``` -------------------------------- ### DownloadClient Initialization Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Illustrates the basic import and initialization of the DownloadClient, which provides a unified interface for various download clients like qBittorrent and Aria2. ```python from module.downloader import DownloadClient from module.models import Bangumi, Torrent ``` -------------------------------- ### Check Docker Compose Version Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Verify if Docker Compose is installed by checking its version. This command is typically available after a standard Docker installation. ```bash docker compose -v ``` -------------------------------- ### Successful Auto Bangumi Startup Log Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/faq/troubleshooting.md This log indicates that Auto Bangumi has started successfully and is connected to qBittorrent. Check this log for successful connection. ```log [2022-07-09 21:55:19,164] INFO: _ ____ _ [2022-07-09 21:55:19,165] INFO: / \ _ _| |_ ___ | |_) | __ _ _ __ __ _ _ _ _ __ ___ _ [2022-07-09 21:55:19,166] INFO: / /\ \| | | | __/ _ \| _ < / _` | '_ \ / _` | | | | '_ ` _ \| | [2022-07-09 21:55:19,167] INFO: / /\ \ \ |_| | __/ _ \| _ < / _` | '_ \ / _` | | | | '_ ` _ \| | [2022-07-09 21:55:19,167] INFO: / ____ \ |_| | || (_) | |_) | (_| | | | | (_| | |_| | | | | | | | [2022-07-09 21:55:19,168] INFO: /_/ \_\__,_|\__\___/|____/ \__,_|_| |_|\__, |\__,_|_| |_| |_|_| [2022-07-09 21:55:19,169] INFO: __/ | [2022-07-09 21:55:19,169] INFO: |___/ [2022-07-09 21:55:19,170] INFO: Version 3.0.1 Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan [2022-07-09 21:55:19,171] INFO: GitHub: https://github.com/EstrellaXD/Auto_Bangumi/ [2022-07-09 21:55:19,172] INFO: Starting AutoBangumi... [2022-07-09 21:55:20,717] INFO: Add RSS Feed successfully. [2022-07-09 21:55:21,761] INFO: Start collecting RSS info. [2022-07-09 21:55:23,431] INFO: Finished [2022-07-09 21:55:23,432] INFO: Running.... ``` -------------------------------- ### Mikan Project RSS Feed Examples Source: https://github.com/estrellaxd/auto_bangumi/wiki/部署说明 These are example RSS feed URLs from Mikan Project. Ensure you replace 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' with your actual token obtained from Mikan Project. ```text https://mikanani.me/RSS/MyBangumi?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` ```text https://mikanime.tv/RSS/MyBangumi?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Successful Auto Bangumi Startup Log Source: https://github.com/estrellaxd/auto_bangumi/wiki/排错流程 This log indicates that Auto Bangumi has started successfully and is connected to qBittorrent. It also shows the version and author information. ```log [2022-07-09 21:55:19,164] INFO: _ ____ _ [2022-07-09 21:55:19,165] INFO: / | | | _ \ (_) [2022-07-09 21:55:19,166] INFO: / \ _ _| |_ ___ | |_) | __ _ _ __ __ _ _ _ _ __ ___ _ [2022-07-09 21:55:19,167] INFO: / /\ \| | | | __/ _ \| _ < / _` | '_ \ / _` | | | | '_ ` _ \| | [2022-07-09 21:55:19,167] INFO: / ____ \ |_| | || (_) | |_) | (_| | | | | (_| | |_| | | | | | | | [2022-07-09 21:55:19,168] INFO: /_/ \_\__,_|\__\___/|____/ \__,_|_| |_|\__, |\__,_|_| |_| |_|_| [2022-07-09 21:55:19,169] INFO: __/ | [2022-07-09 21:55:19,169] INFO: |___/ [2022-07-09 21:55:19,170] INFO: Version 3.0.1 Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan [2022-07-09 21:55:19,171] INFO: GitHub: https://github.com/EstrellaXD/Auto_Bangumi/ [2022-07-09 21:55:19,172] INFO: Starting AutoBangumi... [2022-07-09 21:55:20,717] INFO: Add RSS Feed successfully. [2022-07-09 21:55:21,761] INFO: Start collecting RSS info. [2022-07-09 21:55:23,431] INFO: Finished [2022-07-09 21:55:23,432] INFO: Running.... [2022-07-09 22:01:24,534] INFO: [NC-Raws] 继母的拖油瓶是我的前女友 - 01 (B-Global 1920x1080 HEVC AAC MKV) [0B604F3A].mkv >> 继母的拖油瓶是我的前女友 S01E01.mkv ``` -------------------------------- ### Initialize and Use Database Class Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/ja/dev/database.md Instantiate the main Database class to access sub-databases for managing anime subscriptions, RSS feeds, and torrents. Ensure proper session management using a context manager. ```python from module.database import Database with Database() as db: # サブデータベースへのアクセス bangumis = db.bangumi.search_all() rss_items = db.rss.search_active() torrents = db.torrent.search_all() ``` -------------------------------- ### Create AutoBangumi Directory Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Prepare the deployment environment by creating a dedicated directory for AutoBangumi and navigating into it. ```bash mkdir AutoBangumi cd AutoBangumi ``` -------------------------------- ### Get Logs Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Retrieves the complete application log file. ```APIDOC ## GET /log ### Description Retrieves the complete application log file. ### Method GET ### Endpoint /log ### Response #### Success Response (200) - **log_content** (string) - The content of the application log file. #### Response Example ``` 2023-10-27 10:00:00 INFO Application started. 2023-10-27 10:05:15 DEBUG Processing RSS feed... ``` ``` -------------------------------- ### GET Restart Program Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Restart the main program processes. ```http GET /restart ``` -------------------------------- ### Docker Deployment - Build and Run Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Commands for building the Docker image and running the AutoBangumi container. ```bash # Build image docker build -t auto_bangumi:latest . # Run container docker run -d \ --name autobangumi \ -p 7892:7892 \ -v /path/to/config:/app/config \ -v /path/to/data:/app/data \ -e TZ=Asia/Shanghai \ auto_bangumi:latest ``` -------------------------------- ### Get Available Search Providers Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Retrieve a list of all available search providers. ```bash curl -X GET "http://localhost:7892/api/v1/search/provider" \ -H "Cookie: token=your_jwt_token" ``` -------------------------------- ### GET All Bangumi Rules Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Fetch a list of all configured anime download rules. ```http GET /bangumi/get/all ``` -------------------------------- ### Docker Compose for AutoBangumi and qBittorrent on WSL Source: https://github.com/estrellaxd/auto_bangumi/wiki/wsl This configuration file sets up two services: qBittorrent for torrent management and AutoBangumi for automation. Ensure to update the download path and RSS feed URL to match your specific setup. User and group IDs (UID/GID) should correspond to your WSL user. ```yaml version: "3.6" services: qbittorrent: container_name: qbittorrent image: johngong/qbittorrent:latest hostname: qbittorrent environment: - QB_EE_BIN=false - UID=1000 # 用户权限1000 当前WSL登录用户,查询方法 wsl内输入 id 用户名 - GID=1000 - QB_WEBUI_PORT=8989 ports: - 6881:6881 - 6881:6881/udp - 8989:8989 volumes: - qb_config:/config - /mnt/g/animation:/Downloads #下载路径,对应 Windows上目录是 G:\animation networks: - AutoBangumi_network restart: unless-stopped AutoBangumi: image: estrellaxd/auto_bangumi:latest container_name: AutoBangumi ports: - 7892:7892 depends_on: - qbittorrent volumes: - ./config:/app/config - ./data:/app/data environment: - PUID=1000 - PGID=1000 - TZ=Asia/Shanghai - AB_DOWNLOADER_HOST=qbittorrent:8989 - AB_DOWNLOADER_USERNAME=admin - AB_DOWNLOADER_PASSWORD=adminadmin - AB_NOT_CONTAIN=720|繁体|CHT|JPTC|繁日|BIG5 - AB_DOWNLOAD_PATH=/Downloads #qbittorrent 映射的地址,否者可能提示下载失败 - AB_RSS=https://mikanani.me/RSS/MyBangumi?token=xxxxxxxx%3d%3d #订阅地址,改成自己的 networks: - AutoBangumi_network restart: unless-stopped networks: AutoBangumi_network: volumes: qb_config: external: false auto_bangumi: external: false ``` -------------------------------- ### GET Logout Endpoint Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Clear authentication cookies and log out the current user. ```http GET /auth/logout ``` -------------------------------- ### Create Test Data with Factory Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/dev/database.md Demonstrates using factory functions (e.g., `make_bangumi`) to create test data instances. This simplifies test setup by providing pre-configured objects. ```python from test.factories import make_bangumi, make_torrent, make_rss_item def test_bangumi_search(): bangumi = make_bangumi(title_raw="Test Title", season=2) # ... 测试逻辑 ``` -------------------------------- ### Get All Downloaded Torrents Source: https://context7.com/estrellaxd/auto_bangumi/llms.txt Retrieve a list of all torrents managed by the downloader, categorized by Bangumi. ```bash curl -X GET "http://localhost:7892/api/v1/downloader/torrents" \ -H "Cookie: token=your_jwt_token" ``` -------------------------------- ### GET Stop Program Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Halt the main program processes. The WebUI will remain accessible. ```http GET /stop ``` -------------------------------- ### Configure Junction Directories for Download and Library Management Source: https://github.com/estrellaxd/auto_bangumi/wiki/Windows-本地部署 This PowerShell script demonstrates how to set up Junction Directories to separate download and library locations, allowing for flexible management of media files without disrupting AutoBangumi's operation. It includes logging for created folders and removed junctions. ```powershell $downloadDir = "path\to\download_dir" $libraryDir = "path\to\library_dir" $logFile = $(Join-Path -Path $download_dir -ChildPath "downloadWatcher.log") $subfolderCreationTimeout = 10 $watcher = New-Object System.IO.FileSystemWatcher $watcher.Path = $downloadDir $watcher.EnableRaisingEvents = $true function CreateJunction( # The path to the folder containing junction targets, e.g. $downloadDir\ # The junction targets are its subfolders e.g. $downloadDir\\ $targetRoot ) { # The basename of $targetRoot, e.g. $targetRootName = Split-Path -Path $targetRoot -Leaf # The path the folder where junctions are created, e.g. $libraryDir\ $junctionRoot = $(Join-Path -Path $libraryDir -ChildPath $targetRootName) # Create $junctionRoot if it does not exist if (!(Test-Path $junctionRoot)) { New-Item -ItemType Directory -Path $junctionRoot Add-Content $logFile -Value "[Information] $(Get-Date) New folder created at $junctionRoot mirroring $targetRoot." } # Wait up to 10 secs for a subfolder to appear in $targetRoot # This is because if $targetRoot is newly created the downloader may not have created the subfolder yet $junctionTargetList = $(Get-ChildItem -Path $targetRoot -Directory) $subfolderWaitCount = 0 while ($junctionTargetList.Count -eq 0) { if ($subfolderWaitCount -ge $subfolderCreationTimeout) { Add-Content $logFile -Value "[Warning] $(Get-Date) No subfolders exist in $targetRoot for junctioning, skipping." Return } Start-Sleep -Seconds 1 try { $junctionTargetList = $(Get-ChildItem -Path $targetRoot -Directory) } # If $targetRoot is removed/renamed during the wait, skip catch [System.IO.DirectoryNotFoundException] { Add-Content $logFile -Value "[Warning] $(Get-Date) $targetRoot is removed/renamed during the wait, skipping." Return } $subfolderWaitCount++ } Get-ChildItem $junctionRoot | Where-Object {$_.LinkType -eq "Junction"} | ForEach-Object { # If a junction target is non-existent, remove it if (!(Test-Path $_.Target)) { Remove-Item $_.FullName Add-Content $logFile -Value "[Information] $(Get-Date) Junction at $($_.FullName) is removed because its target $($_.Target) is non-existent." } else { # Remove a junction target from $junctionTargetList if a junction in $junctionRoot is already pointing to it $existingTarget = $_.Target $junctionTargetList = $junctionTargetList | Where-Object {$_.FullName -ne $existingTarget} Add-Content $logFile -Value "[Debug] $(Get-Date) $($_.FullName) already exists, skipping." } } # Create junctions for each remaining target in $junctionTargetList for ($i = 0; $i -lt $junctionTargetList.Count; $i++) { $junctionTarget = $junctionTargetList[$i] # The default name for the junction is the name of the junction target it self, e.g. $junctionName = $junctionTarget.Name ``` -------------------------------- ### Create Data and Config Directories with Bind Mounts Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/deploy/docker-cli.md Use bind mounts to ensure data and configuration persist across container updates. Ensure your current working directory is AutoBangumi. ```shell mkdir -p ${HOME}/AutoBangumi/{config,data} cd ${HOME}/AutoBangumi ``` -------------------------------- ### GET List RSS Feeds Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Retrieve a list of all configured RSS subscription feeds. ```http GET /rss ``` -------------------------------- ### Example File Structure for Organized Anime Source: https://github.com/estrellaxd/auto_bangumi/blob/main/README.md Illustrates the directory structure created by AutoBangumi for organizing downloaded anime episodes, facilitating media server recognition. ```text Bangumi ├── bangumi_A_title │├── Season 1 ││├── A S01E01.mp4 ││├── A S01E02.mp4 ││├── A S01E03.mp4 ││└── A S01E04.mp4 │└── Season 2 │├── A S02E01.mp4 │├── A S02E02.mp4 │├── A S02E03.mp4 │└── A S02E04.mp4 ├── bangumi_B_title │└─── Season 1 ``` -------------------------------- ### GET Refresh Specific Poster Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Refresh the poster image for a single anime rule. ```http GET /bangumi/refresh/poster/{bangumi_id} ``` -------------------------------- ### GET Refresh All Posters Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Update the poster images for all anime rules by fetching them from TMDB. ```http GET /bangumi/refresh/poster/all ``` -------------------------------- ### Create Data and Configuration Folders Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-cli Create directories for persistent storage of Auto Bangumi data and configuration. This ensures data is not lost on container updates. ```shell # Create data folder mkdir AutoBangumi cd AutoBangumi ``` -------------------------------- ### GET Bangumi by ID Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Retrieve a specific anime rule using its unique ID. ```http GET /bangumi/get/{bangumi_id} ``` -------------------------------- ### Example Anime File Structure Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/home/index.md Illustrates the organized directory and file structure for downloaded anime episodes, designed for compatibility with media library software. ```tree Bangumi ├── bangumi_A_title │ ├── Season 1 │ │ ├── A S01E01.mp4 │ │ ├── A S01E02.mp4 │ │ ├── A S01E03.mp4 │ │ └── A S01E04.mp4 │ └── Season 2 │ ├── A S02E01.mp4 │ ├── A S02E02.mp4 │ ├── A S02E03.mp4 │ └── A S02E04.mp4 ├── bangumi_B_title │ └─── Season 1 ``` -------------------------------- ### GET Shutdown Application Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Shut down the entire AutoBangumi application, equivalent to restarting a Docker container. ```http GET /shutdown ``` -------------------------------- ### GET Refresh All RSS Feeds Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Manually trigger a refresh for all configured RSS subscription feeds. ```http GET /rss/refresh/all ``` -------------------------------- ### GET Reset All Bangumi Rules Source: https://github.com/estrellaxd/auto_bangumi/blob/main/docs/api/index.md Delete all anime rules. Use with caution as this action is irreversible. ```http GET /bangumi/reset/all ``` -------------------------------- ### Define Environment Variables for qBittorrent and Download Path Source: https://github.com/estrellaxd/auto_bangumi/wiki/Docker-compose Set environment variables for the qBittorrent port and the download path. These are required if you are using the combined Docker Compose files and not configuring via the WebUI. ```shell export \ QB_PORT= \ DOWNLOAD_PATH= ```