NAS Movie Download
Automated movie downloading system using Jackett for torrent search and qBittorrent for download management.
新功能:自动字幕下载支持! 🎬
Configuration
Environment Variables
Set these environment variables for the skill to function properly:
Jackett Configuration:
JACKETT_URL: Jackett service URL (default: http://192.168.1.246:9117)JACKETT_API_KEY: Jackett API key (default: o5gp976vq8cm084cqkcv30av9v3e5jpy)
qBittorrent Configuration:
QB_URL: qBittorrent Web UI URL (default: http://192.168.1.246:8888)QB_USERNAME: qBittorrent username (default: admin)QB_PASSWORD: qBittorrent password (default: adminadmin)
Subtitle Configuration:
OPENSUBTITLES_API_KEY: OpenSubtitles API key (optional, can also save toconfig/opensubtitles.key)SUBTITLE_LANGUAGES: Default subtitle languages (default: zh-cn,en)
OpenSubtitles Setup
- 注册账号:https://www.opensubtitles.com
- 获取 API Key
- 保存到配置文件:
echo "your-api-key" > config/opensubtitles.key
Indexer Setup
The skill works with Jackett indexers. Currently configured indexers:
- The Pirate Bay
- TheRARBG
- YTS
Ensure these indexers are enabled and configured in your Jackett installation for best results.
Usage
Search Movies
Search for movies without downloading:
scripts/jackett-search.sh -q "Inception"
scripts/jackett-search.sh -q "The Matrix"
scripts/jackett-search.sh -q "死期将至" # Chinese movie names supported
Download with Automatic Subtitles 🆕
One-click download with automatic subtitle fetching:
# Download movie and automatically download subtitles after completion
scripts/download-movie.sh -q "Young Sheldon" -s -w
# Download with specific languages
scripts/download-movie.sh -q "Community" -s -l zh-cn,en
# Download movie only (no subtitles)
scripts/download-movie.sh -q "The Matrix"
参数说明:
-s, --with-subtitle: 启用自动字幕下载-w, --wait: 等待下载完成后自动下载字幕-l, --languages: 指定字幕语言(默认:zh-cn,en)
Manual Download Workflow
For more control over the download process:
- Search:
scripts/jackett-search.sh -q "movie name" - Review results and copy magnet link
- Add to qBittorrent:
scripts/qbittorrent-add.sh -m "magnet:?xt=urn:btih:..." - Download subtitles:
scripts/subtitle-download.sh -d "/path/to/downloaded/files"
Subtitle Download Only
Download subtitles for existing video files:
# Single file
scripts/subtitle-download.sh -f "/path/to/video.mkv" -l zh-cn,en
# Entire directory (recursive)
scripts/subtitle-download.sh -d "/path/to/tv/show" -r
# Specific languages
scripts/subtitle-download.sh -d "/media/Young Sheldon" -l zh-cn,en,ja
Language Codes:
zh-cn: 中文简体zh-tw: 中文繁体en: 英文ja: 日文ko: 韩文
Test Configuration
Verify your Jackett and qBittorrent setup:
scripts/test-config.sh
Quality Selection
The skill automatically prioritizes quality in this order:
- 4K/UHD: Contains "4K", "2160p", "UHD"
- 1080P/Full HD: Contains "1080p", "FHD"
- 720P/HD: Contains "720p", "HD"
- Other: Other quality levels
When using download-movie.sh, the highest quality available torrent will be selected automatically.
Script Details
jackett-search.sh
Search Jackett for torrents.
Parameters:
-q, --query: Search query (required)-u, --url: Jackett URL (optional, uses env var)-k, --api-key: API key (optional, uses env var)
Example:
scripts/jackett-search.sh -q "Inception" -u http://192.168.1.246:9117
qbittorrent-add.sh
Add torrent to qBittorrent.
Parameters:
-m, --magnet: Magnet link (required)-u, --url: qBittorrent URL (optional, uses env var)-n, --username: Username (optional, uses env var)-p, --password: Password (optional, uses env var)
Example:
scripts/qbittorrent-add.sh -m "magnet:?xt=urn:btih:..."
download-movie.sh
One-click search and download with optional subtitle support.
Parameters:
-q, --query: Movie name (required)-s, --with-subtitle: Enable automatic subtitle download-w, --wait: Wait for download to complete before downloading subtitles-l, --languages: Subtitle languages (default: zh-cn,en)
Example:
# Basic download
scripts/download-movie.sh -q "The Matrix"
# Download with subtitles
scripts/download-movie.sh -q "Young Sheldon" -s -w -l zh-cn,en
subtitle-download.sh 🆕
Download subtitles for video files using OpenSubtitles API.
Parameters:
-f, --file: Single video file path-d, --directory: Process all videos in directory-l, --languages: Subtitle languages, comma-separated (default: zh-cn,en)-k, --api-key: OpenSubtitles API Key (optional if configured)-r, --recursive: Recursively process subdirectories-h, --help: Show help
Example:
# Single file
scripts/subtitle-download.sh -f "/media/movie.mkv"
# Batch process directory
scripts/subtitle-download.sh -d "/media/TV Shows" -r -l zh-cn,en
Features:
- Automatically parses video filenames (TV episodes, movies)
- Downloads best-rated subtitles for each language
- Renames subtitles to match video filenames
- Skips existing subtitle files
- Supports batch processing
Tips and Best Practices
- Use English movie names for better search results
- Check Jackett indexer status if searches return no results
- Monitor qBittorrent to manage download progress
- Consider storage space when downloading 4K content
- Test configuration periodically to ensure services are running
- For TV series: Use
-s -wflag to auto-download subtitles for all episodes
Troubleshooting
No Search Results
- Verify Jackett is running:
curl http://192.168.1.246:9117 - Check Jackett indexers are enabled in Jackett UI
- Try English movie names
- Verify API key is correct
qBittorrent Connection Failed
- Confirm qBittorrent is running
- Check Web UI is enabled in qBittorrent settings
- Verify username and password
- Ensure network connectivity to qBittorrent server
Subtitle Download Issues
- No API Key: Save your key to
config/opensubtitles.keyor use-kflag - No subtitles found: Try different language codes or the video may not have subtitles available
- API limit: OpenSubtitles free tier has rate limits; wait a few minutes and retry
Permission Issues
Ensure scripts have execute permissions:
chmod +x scripts/*.sh
Security Notes
- Keep API keys secure and don't commit them to version control
- Use HTTPS connections when possible
- Consider setting up VPN for torrent traffic
- Monitor qBittorrent for unauthorized downloads
Dependencies
curl: For HTTP requestsjq: For JSON parsingbc: For floating point calculations (subtitle download progress)- Bash shell
Install dependencies if missing:
apt-get install curl jq bc
Changelog
v2.0 - 2025-02-17
- ✅ Added automatic subtitle download support
- ✅ New
subtitle-download.shscript - ✅ Updated
download-movie.shwith-sand-wflags - ✅ Support for OpenSubtitles API
- ✅ Multi-language subtitle support (zh-cn, en, ja, ko, etc.)