Magnet links can now be resumed properly! When you download a torrent via magnet link, the app now:
- Saves metadata automatically - When metadata arrives from peers, it's saved as a
.torrentfile - Loads metadata on resume - Next time you add the same magnet, it loads the saved metadata instantly
- Detects existing files - Scans your download directory for partial files and resumes from where you left off
# When you first add a magnet link:
python3 torrent-dl-enhanced.py "magnet:?xt=urn:btih:abc123..."
# What happens:
# 1. ↓ Connecting to peers...
# 2. 📥 Fetching metadata from peers...
# 3. ⏳ Downloading...
# 4. ✅ Saved metadata for [torrent name] ← New!Behind the scenes:
- Metadata is saved to:
~/.config/torrent-downloader/resume/{info_hash}.torrent - Resume data is saved to:
~/.config/torrent-downloader/resume/{info_hash}.fastresume
# Add the same magnet link again:
python3 torrent-dl-enhanced.py "magnet:?xt=urn:btih:abc123..."
# What happens now:
# 1. 📦 Saved torrent found - loading ← Instant!
# 2. 🔍 Checking for existing files...
# 3. ✅ Found existing data: 47.2% complete
# 4. ↓ Downloading from 47.2%...No more:
- ❌ Waiting for metadata from peers
- ❌ Starting from 0%
- ❌ Re-downloading existing data
# Start download
python3 torrent-dl-enhanced.py "magnet:?xt=..."
# Download gets to 30%, then power outage!
# Resume later - same magnet link
python3 torrent-dl-enhanced.py "magnet:?xt=..."
# ✅ Continues from 30%# Download a large file over multiple days
# Day 1: Download to 40%, then stop (Ctrl+C)
# Day 2: Resume, download to 75%, then stop
# Day 3: Resume, complete download
# Same magnet link works every time!# Download partial file on Computer A
# Copy partial files to Computer B
# Add magnet on Computer B
# If you have the saved .torrent file from Computer A:
cp ~/.config/torrent-downloader/resume/*.torrent [to Computer B]
# Then Computer B can resume the downloadAll resume data is stored in: ~/.config/torrent-downloader/resume/
For each magnet download, two files are created:
~/.config/torrent-downloader/resume/
├── abc123def456.torrent ← Torrent metadata (structure, files, hashes)
└── abc123def456.fastresume ← Download progress (which pieces complete)
The filename is the info hash - a unique identifier for the torrent.
- ✅ Backup this folder
- ✅ Move it to another computer
- ✅ Delete individual files to "forget" a torrent
- ❌ Delete while downloads are active
- ❌ Manually edit these files
-
Open the GUI:
python3 torrent-dl-gui-secure.py
-
Paste magnet link in the input field
-
Click "Add"
-
First time:
- Status shows: "Fetching metadata..."
- After metadata arrives: "✅ Saved metadata for [name]" (in console)
- Download continues
-
Resume later:
- Add the same magnet link again
- Status shows: "📦 Loading saved torrent..."
- No waiting for metadata!
- Shows progress: "47.2%" (not 0%)
# Add a magnet and wait for metadata
python3 torrent-dl-enhanced.py "magnet:?xt=urn:btih:abc123..."
# Look for this message:
# ✅ Saved metadata for [torrent name]
# Check the file exists:
ls -lh ~/.config/torrent-downloader/resume/*.torrent# Stop download with Ctrl+C after a few minutes
# Add same magnet again
python3 torrent-dl-enhanced.py "magnet:?xt=urn:btih:abc123..."
# Look for these messages:
# 📦 Saved torrent found - loading
# 🔍 Checking for existing files...
# ✅ Found existing data: [percentage]% completeMake sure you're using the same download directory:
# First download
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrents
# Resume - MUST use same -d parameter
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrentsThe download directory must be the same for resume to work:
# ✅ Correct
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrents
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrents
# ❌ Wrong - different paths
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrents
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads # Won't find files!The actual download files must stay in the same location with the same names.
You need the exact same magnet link to resume. If you lost it:
- Check browser history
- Check the saved .torrent file (filename is the info hash)
- Some torrent sites let you get magnet from info hash
First resume will scan existing files (can take 1-5 minutes for large files). Be patient!
Possible causes:
- Metadata wasn't saved (download stopped too early)
- Resume directory was deleted
- Different magnet link (different torrent)
Solution:
- Check if metadata file exists:
ls ~/.config/torrent-downloader/resume/ - If missing, you'll need to fetch metadata again (will still detect partial files)
Possible causes:
- Download path doesn't match
- Files were moved or renamed
- Wrong magnet link (different version/quality)
Solution:
# Verify download path matches
ls -la ~/Downloads/torrents/ # Check files are there
# Use exact same -d parameter
python3 torrent-dl-enhanced.py "magnet:..." -d ~/Downloads/torrentsThis is normal! Large files take time to verify:
- 500MB: ~30 seconds
- 2GB: 1-2 minutes
- 6GB: 2-5 minutes
- 10GB+: 5-10 minutes
Just wait - progress will update once checking completes.
Added:
- Line 88:
self.metadata_saved = {}- Track saved metadata - Lines 181-202:
save_metadata_if_ready()- Save .torrent when metadata arrives - Lines 114-152: Enhanced magnet handling with three scenarios:
- Has resume data + metadata → instant resume
- Has metadata only → load and check files
- Has neither → fetch from peers
- Line 225: Call metadata saving in download loop
Added:
- Line 30:
self.metadata_saved = set()- Track saved metadata - Lines 1249-1271:
save_metadata_if_ready()- Save .torrent when metadata arrives - Lines 1046-1102: Enhanced magnet handling (same three scenarios as CLI)
- Line 1286: Call metadata saving in update loop
You know it's working when you see:
First Download:
📥 Fetching metadata from peers...
... Done!
Name: Big Buck Bunny
Size: 365.05 MiB
Files: 1
[Downloading...]
✅ Saved metadata for Big Buck Bunny ← This means it worked!
Resume:
Adding magnet link...
📦 Saved torrent found - loading ← Instant!
🔍 Checking for existing files...
✅ Found existing data: 47.2% complete ← Detected partial!
[Continues from 47.2%]
# Backup your resume data
cp -r ~/.config/torrent-downloader/resume ~/backup/resume-$(date +%Y%m%d)If you want to help someone resume your download:
# Send them:
# 1. The magnet link
# 2. The saved .torrent file from resume directory
# 3. The partial download files
# They can copy the .torrent file to their resume directory
# Then add the magnet - it will load instantly!# Remove resume data for old completed torrents
rm ~/.config/torrent-downloader/resume/abc123def456.*Now that magnet resume works, you might want:
- Selective file download - Choose which files in a torrent to download
- Sequential download - Download pieces in order (for video streaming)
- Watch folder - Auto-add magnet links from a folder
- RSS feeds - Auto-download new episodes
See FEATURE_IDEAS.md for more ideas!
Updated: 2025-11-09
Status: ✅ Implemented and tested
Files Modified: torrent-dl-enhanced.py, torrent-dl-gui-secure.py