Identifies and removes dead, unavailable, or error torrents from Real-Debrid account using the API. Shows torrent status, filters by health, and safely deletes torrents with missing files. Use this when Jellyfin scans are slow, when troubleshooting 404 errors, to clean account storage, or before major library refreshes.
Removes dead, unavailable, or error torrents from Real-Debrid account using the API. Identifies torrents with magnet_error, dead, virus, or 404 status, shows reclaimable space, and safely deletes them with confirmation and whitelist support.
/plugin marketplace add theflysurfer/claude-skills-marketplace/plugin install theflysurfer-claude-skills-marketplace@theflysurfer/claude-skills-marketplaceThis skill is limited to using the following tools:
reference.mdscripts/cleanup_realdebrid.pyAutomatically detect and remove dead torrents from your Real-Debrid account.
ssh automation@srv759970.hstgr.cloud
cd /home/automation/scripts
# Download script (from repo or copy manually)
wget https://raw.githubusercontent.com/YOUR_REPO/main/.claude/skills/realdebrid-cleanup/scripts/cleanup_realdebrid.py
# Or copy from local repo
cat > cleanup_realdebrid.py << 'EOF'
[paste script from scripts/cleanup_realdebrid.py]
EOF
chmod +x cleanup_realdebrid.py
python3 /home/automation/scripts/cleanup_realdebrid.py --dry-run
Expected output:
š Fetching Real-Debrid torrents...
Total torrents: 537
Total size: 2.30 TB
--- Status Breakdown ---
š¢ downloaded: 480
š“ magnet_error: 23
š“ dead: 18
š“ virus: 4
š” downloading: 12
š“ Found 45 dead torrents
Reclaimable: 156 GB
--- Dead Torrents ---
1. [MAGNET_ERROR] Movie.XYZ.2024.mkv
2. [DEAD] Old.Show.S01.Complete
...
š DRY-RUN MODE - No torrents will be deleted
python3 /home/automation/scripts/cleanup_realdebrid.py
# Type 'DELETE' when prompted
After cleanup, refresh the media stack:
# See media-stack-refresh skill for complete workflow
docker restart zurg rclone
sleep 15
curl -X POST 'http://localhost:8096/Library/Refresh' \
-H 'X-Emby-Token: 9af5f56a66e44ee68ddeec7bd07c9db8'
Edit script to protect specific torrents:
# In cleanup_realdebrid.py
WHITELIST = [
"Naruto", # By filename (partial match)
"Breaking Bad",
"4QMHWXG66PW64" # By torrent ID (exact match)
]
| Status | Meaning | Action |
|---|---|---|
downloaded | Fully available | ā Keep |
downloading | In progress | ā Keep |
queued | Waiting to start | ā Keep |
magnet_error | Failed to resolve | š“ Delete |
dead | Files unavailable | š“ Delete |
virus | Flagged by RD | š“ Delete |
error | Generic error | š“ Delete |
timeout | Download timeout | š“ Delete |
| Scenario | Torrents Deleted | Space Freed | Time Saved |
|---|---|---|---|
| First cleanup | 30-50% | 100-200 GB | Scans 5-10x faster |
| Monthly | 5-10% | 20-50 GB | Minor improvement |
| After bulk add | 10-20% | 50-100 GB | Moderate improvement |
Before cleanup:
āā server-diagnostics (check disk space)
āā backup-status (ensure configs backed up)
Run cleanup:
āā realdebrid-torrent-cleanup ā YOU ARE HERE
After cleanup:
āā media-stack-refresh (restart Zurg/Rclone)
āā jellyfin-scan (monitor library update)
SECRETS.md (not committed to Git)RD_API_KEY (optional)Cause: Invalid or expired API key
Solution:
# Update API key in script or set environment variable
export RD_API_KEY="your_new_key_here"
python3 cleanup_realdebrid.py
Cause: Torrent is active or locked
Solution: Wait for torrent to finish or cancel it manually in Real-Debrid web UI
Cause: Sonarr/Radarr re-added the torrent
Solution: Remove from *arr apps first, then cleanup
See reference.md for:
See scripts/cleanup_realdebrid.py for:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.