update
Some checks failed
Tests / test (ubuntu-latest, 3.8) (push) Failing after 24m2s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 24m4s
Tests / test (ubuntu-latest, 3.9) (push) Failing after 10m52s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled

This commit is contained in:
2025-03-08 23:52:40 -08:00
parent a66e3ab455
commit ad11faf1b0
23 changed files with 2946 additions and 155 deletions

142
README.md
View File

@@ -1,83 +1,127 @@
# Jimaku Downloader
A Python package to download japanese subtitles for anime from Jimaku.cc
<div align="center">
A tool for downloading Japanese subtitles for anime from <a href="https://jimaku.cc" target="_blank" rel="noopener noreferrer">Jimaku</a>
</div>
<div align="center">
<p>
<video controls muted src="https://github.com/user-attachments/assets/3723866f-4e7d-4f89-8b55-17f2fb6fa6be"></video>
</p>
</div>
## Features
- Search for subtitles using AniList IDs
- Supports both individual files and directories
- Interactive subtitle selection using fzf
- Auto-detects anime from filenames with season and episode numbers
- Recursively checks parent directories for anime titles
- Optional MPV playback with downloaded subtitles
- Caches AniList IDs to reduce API calls
- Queries AniList for anime titles
- Select subtitle entries from Jimaku
- Download subtitles to a specified directory
- Launch MPV with the downloaded subtitles
- Supports both file and directory inputs
- Support for selecting/downloading multiple subtitle files
## Installation
```bash
# From PyPI
pip install jimaku-dl
You can install Jimaku Downloader using pip
```sh
pip install jimaku-dl
```
### Arch Linux
Arch Linux users can install
<a href="https://aur.archlinux.org/packages/python-jimaku-dl" target="_blank">python-jimaku-dl</a>
from the AUR
```sh
paru -S python-jimaku-dl
# or
yay -S python-jimaku-dl
# From source
git clone https://github.com/InsaneDesperado/jimaku-dl.git
cd jimaku-dl
pip install -e .
```
## Usage
### Command Line
### Command Line Interface
```bash
# Download subtitles for a video file
jimaku-dl /path/to/your/anime.S01E02.mkv
The main entry point for Jimaku Downloader is the `jimaku-dl` command. Here are some examples of how to use it:
# Download subtitles for an entire series (directory mode)
jimaku-dl /path/to/your/anime/directory/
```sh
# Download subtitles for a single video file
jimaku-dl /path/to/video.mkv
# Specify a different destination directory
jimaku-dl /path/to/your/anime.mkv --dest /path/to/subtitles/
# Download subtitles for a directory
jimaku-dl /path/to/anime/directory
# Play the video with MPV after downloading subtitles
jimaku-dl /path/to/your/anime.mkv --play
# Specify a custom destination directory
jimaku-dl /path/to/video.mkv --dest /custom/path
# Set API token via command line
jimaku-dl /path/to/your/anime.mkv --api-token YOUR_TOKEN
```
# Launch MPV with the downloaded subtitles
jimaku-dl /path/to/video.mkv --play
### Environment Variables
# Specify an AniList ID directly
jimaku-dl /path/to/video.mkv --anilist-id 123456
You can set your Jimaku API token using the `JIMAKU_API_TOKEN` environment variable:
# Set the Jimaku API token
jimaku-dl /path/to/video.mkv --token your_api_token
```bash
export JIMAKU_API_TOKEN=your_api_token
# Set the logging level
jimaku-dl /path/to/video.mkv --log-level DEBUG
```
### Python API
You can also use Jimaku Downloader as a Python library:
```python
from jimaku_downloader import JimakuDownloader
from jimaku_dl.downloader import JimakuDownloader
# Create a downloader instance
downloader = JimakuDownloader(api_token="your_api_token", log_level="INFO")
# Download subtitles
downloaded_files = downloader.download_subtitles(
media_path="/path/to/your/anime.mkv",
dest_dir="/path/to/save/subtitles/", # Optional
play=True # Optional: play with MPV after downloading
)
print(f"Downloaded {len/downloaded_files)} subtitle files")
downloaded_files = downloader.download_subtitles("/path/to/video.mkv", dest_dir="/custom/path", play=True)
print(f"Downloaded files: {downloaded_files}")
```
## Requirements
## File Naming
- Python 3.8 or higher
- `fzf` command-line utility for interactive selection
- `mpv` (optional, for playback functionality)
- A valid Jimaku.cc API token
Jimaku Downloader supports various file naming conventions to extract show title, season, and episode information. It is recommended to follow the [Trash Guides recommended naming schema](https://trash-guides.info/Sonarr/Sonarr-recommended-naming-scheme/#recommended-naming-scheme) for best results.
### Examples
- `Show Title - S01E02 - Episode Name [1080p].mkv`
- `Show.Name.S01E02.1080p.mkv`
- `Show_Name_S01E02_HEVC.mkv`
- `/path/to/Show Name/Season-1/Show Name - 02 [1080p].mkv`
## Development
To contribute to Jimaku Downloader, follow these steps:
1. Clone the repository:
```sh
git clone https://github.com/yourusername/jimaku-dl.git
cd jimaku-dl
```
2. Create a virtual environment and activate it:
```sh
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
```
3. Install the dependencies:
```sh
pip install -r requirements_dev.txt
```
4. Run the tests:
```sh
pytest
```
## License
GPL v3
Jimaku Downloader is licensed under the GPLv3 License. See the [LICENSE](LICENSE) file for more information.