Edit BitTorrent metadata (trackers and private flag)
Project description
A small command-line tool to modify BitTorrent .torrent files.
This tool is designed to perform simple metadata edits without recreating the torrent.
Features
- Toggle torrent private/public flag
- Add new trackers
- Remove existing trackers
- Replace the entire tracker list
- Automatic
.bakbackup before writing
Installation
From pypi
pip install torrent-edit
From source
git clone https://github.com/yourname/torrent-edit.git
cd torrent-edit
pip install .
Editable install (recommended for development)
pip install -e .
Usage
usage: torrent-edit [-h] [--public | --private] [--add URL [URL ...]] [--remove URL [URL ...]] [--replace URL [URL ...]] [-v] torrent
Edit BitTorrent metadata (private flag and trackers).
positional arguments:
torrent Path to the .torrent file(s)
options:
-h, --help show this help message and exit
--public Remove the private flag
--private Set the torrent as private (disable DHT/PEX)
--add URL [URL ...] Add all trackers with the provided list
--remove URL [URL ...]
Remove all trackers with the provided list
--replace URL [URL ...]
Replace all trackers with the provided list
-v, --verbose Enable verbose output (debug logging)
Examples
You can specify multiple files:
$ torrent-edit *.torrent [...]
- Make a torrent private
$ torrent-edit "Mr.and.Mr.Macron's.holidays.financed.by.your.taxes.mkv.torrent" --private
This sets the private flag in the torrent metadata. Most BitTorrent clients will disable DHT, PEX, and LSD when the torrent is private.
- Make a torrent public
$ torrent-edit movie.torrent --public
Removes the private flag.
- Add a tracker
$ torrent-edit movie.torrent \
--add https://tracker/announce
You can specify multiple trackers:
$ torrent-edit movie.torrent \
--add \
https://tracker1/announce \
https://tracker2/announce
- Remove a tracker
$ torrent-edit movie.torrent \
--remove http://oldtracker/announce
- Replace all trackers
$ torrent-edit movie.torrent \
--replace \
https://tracker1/announce \
https://tracker2/announce
This removes all existing trackers and replaces them with the provided ones.
How to use in real life (GNU/Linux)
-
Stop the BitTorrent service or application (Transmission, qBittorrent, etc.)
-
Find the directory with the torrents used by your application, and go into it.
- For Transmission server:
/var/lib/transmission-daemon/info/torrents - For Transmission client:
~/.config/transmission/torrents/
- For Transmission server:
-
Execute the script with your own arguments.
-
If you are using a simple client, just restart it, it's done.
-
If you are using Transmission server, restart the service and reload the torrents with the remote administration tool.
sudo find . -iname "*.torrent" -exec transmission-remote 127.0.0.1:9091 -n transmission_login:transmission_pass -a {} \;
Done!
Alternative
The tool transmission-edit allows you to update the tracker list, but will NOT
allow you to toggle the private flag.
Example:
cd /var/lib/transmission-daemon/info/torrents
sudo transmission-edit -r "old_url" "new_url" *.torrent
Contributions
This project is open for any contribution! Any bug report can be posted by opening an issue.
License
torrent-edit is released under the GNU General Public License v3 (GPLv3+).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torrent_edit-0.1.0.tar.gz.
File metadata
- Download URL: torrent_edit-0.1.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47df10fb0d77375386adc0e1c71ceb33abe287549d63291a6220efef3eacca45
|
|
| MD5 |
8c377ed8163770027b98e0d814f59e22
|
|
| BLAKE2b-256 |
77a557635838eb0bf3b97a3a0bd6cc7e09af05f4def1655a180f5a9cee1a0849
|
File details
Details for the file torrent_edit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: torrent_edit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a090e6990402c7c3e2bea764e1efdba06bfdc238f327993811e38c3269c5dbd6
|
|
| MD5 |
9a0232d960b77cf6659b02801d86872a
|
|
| BLAKE2b-256 |
7805f905e9eb39083b7863cef7920d9a0ae739925e4d7dc097845c83c10a7c23
|