# Ghibli Anime Jellyfin Preparation Toolkit This project provides a set of Python scripts to process a collection of Japanese animation (anime) files, originally named in Chinese, and transform them into a directory and file structure suitable for [Jellyfin](https://jellyfin.org/) media server. The toolkit also supports fetching and organizing metadata from online movie databases such as IMDb and TMDB. ## Features - **Directory Traversal & Title Extraction:**Collects unique Chinese anime titles from a directory tree. - **English Title & Metadata Matching:**Matches Chinese titles to their English equivalents and fetches metadata (IMDb/TMDB IDs). - **Metadata Transformation:**Converts collected metadata into a Jellyfin-friendly JSON format. - **Directory & File Structure Generation:**Builds a new directory tree with properly named files, supporting symlinks, renaming, and dry-run modes. - **Jellyfin Integration:** Prepares your anime collection for easy import into Jellyfin, with correct naming and metadata. ## Main Scripts - [`ghibili3.py`](ghibili3.py):Traverses your anime directory, matches Chinese titles to English, and fetches metadata from IMDb/TMDB. Outputs results to `ghibli_imdb_results.json`. - [`transform_files.py`](transform_files.py):Transforms the metadata and file information into a Jellyfin-ready format, outputting `ghibli_jellyfin_ready.json`. - [`build_jellyfin_dir.py`](build_jellyfin_dir.py):Builds the target directory structure for Jellyfin using the transformed JSON. Supports options for dry-run, symlinking, renaming files/directories, and more. - [`sync_media.py`](sync_media.py):Synchronizes media files between directories, with support for dry-run and error logging. - Other utility scripts: - [`delete_media.py`](delete_media.py), [`discard_media.py`](discard_media.py), [`remove_symlinks.py`](remove_symlinks.py): Various helpers for cleaning and managing your media files. ## Usage Example 1. **Collect and Match Titles:** ```sh python ghibili3.py ./anime --tmdb ``` This generates `ghibli_imdb_results.json`. 2. **Transform Metadata for Jellyfin:** ```sh python transform_files.py ``` This generates `ghibli_jellyfin_ready.json`. 3. **Build Jellyfin Directory Structure:** ```sh python build_jellyfin_dir.py ghibli_jellyfin_ready.json ./jellyfin_anime --symlink --rename-dir --dry-run ``` Remove `--dry-run` to actually create files and directories. ## Requirements - Python 3.7+ - `requests` library (for metadata fetching) Install dependencies: ```sh pip install requests ``` ## Directory Structure - `anime/` — Original anime files, named in Chinese. - `ghibli_imdb_results.json` — Metadata results from IMDb/TMDB. - `ghibli_jellyfin_ready.json` — Jellyfin-ready metadata and file info. - `jellyfin_anime/` — Output directory for Jellyfin import (created by scripts). ## Notes - The scripts are designed for batch processing and assume a consistent directory structure. - Always use `--dry-run` first to preview changes before making modifications. - For best results, ensure your anime files are organized in per-title directories. ## License MIT License --- *This toolkit is not affiliated with Studio Ghibli or Jellyfin.*