3.5 KiB
jelly-dedup
A command-line tool to identify and manage duplicate episodes in your Jellyfin media server. This tool analyzes your TV show library, detects duplicate episodes, and provides removal commands to free up storage space.
Features
- Scans all TV shows in your Jellyfin library
- Identifies duplicate episodes based on season and episode numbers
- Intelligently selects lower-quality files for removal
- Generates shell commands for safe file deletion
- Displays space savings estimates
- Supports custom path prefix removal for cleaner output
Build Reqs
- Latest Rust
- Access to a Jellyfin server
- A valid Jellyfin API key
Installation
From Source
- Build the project:
cargo build --release
- The binary will be available at
target/release/jelly-dedup
Optionally, install it system-wide:
cargo install --path .
Configuration
jelly-dedup can be configured using either environment variables or command-line arguments. Command-line arguments take precedence over environment variables.
Environment Variables
Create a .env file in the project directory:
JELLYFIN_URL=http://localhost:8096
JELLYFIN_API_KEY=your_api_key_here
PATH_PREFIX_TO_REMOVE=/mnt/media # Optional
Command-Line Arguments
All configuration can be passed as command-line arguments:
jelly-dedup --jellyfin-url http://localhost:8096 --api-key your_api_key_here
Usage
Basic Usage
Using environment variables (via .env file):
jelly-dedup
Using command-line arguments:
jelly-dedup --api-key YOUR_API_KEY
All Options
jelly-dedup [OPTIONS]
Options:
-j, --jellyfin-url <JELLYFIN_URL>
Jellyfin server URL [env: JELLYFIN_URL] [default: http://localhost:8096]
-a, --api-key <API_KEY>
Jellyfin API key [env: JELLYFIN_API_KEY]
-p, --path-prefix-to-remove <PATH_PREFIX_TO_REMOVE>
Path prefix to remove from displayed file paths [env: PATH_PREFIX_TO_REMOVE]
-h, --help
Print help
-V, --version
Print version
Examples
-
Using default local server with API key:
jelly-dedup --api-key abc123def456 -
Specifying a remote server:
jelly-dedup --jellyfin-url https://jellyfin.example.com --api-key abc123def456 -
Removing path prefix for cleaner output:
jelly-dedup --api-key abc123def456 --path-prefix-to-remove /mnt/media -
Using environment variables:
export JELLYFIN_URL=http://localhost:8096 export JELLYFIN_API_KEY=abc123def456 jelly-dedup
Getting Your Jellyfin API Key
- Log in to your Jellyfin server web interface
- Go to Dashboard → API Keys
- Click "+" to create a new API key
- Give it a name (e.g., "jelly-dedup")
- Copy the generated API key
Output
The tool will:
- Scan all TV shows in your library
- Display duplicate episodes found for each show
- Provide a summary with:
- Total episodes with duplicates
- Total files marked for deletion
- Estimated space savings in GB
- Generate
rmcommands for each file to be deleted
Note: The tool does NOT delete files automatically. It only generates the commands for you to review and execute manually.
Safety
- The tool is read-only and makes no modifications to your Jellyfin library or filesystem
- All file deletion commands are generated for manual review and execution
- File paths in deletion commands are properly escaped for shell safety
- Always review the generated commands before executing them