Skip to main content

Export/backup the cache directory of a torrent client, restoring original filenames and organized by tracker

Project description

Most torrent clients maintain a directory containing all the torrents that are currently loaded in the client. However they are unorganized and typically have been renamed to the infohash of the torrent. This script processes these torrents and restores them to their original name and organized by tracker based on the announce URL. It was written with private torrents in mind, which generally only have one announce URL. If the script encounters a torrent with multiple announce URLs, it will only consider the first URL for organization.

This has only been tested with qBittorrent, but it should work with any directory containing a flat list of valid torrents. Subdirectories are not traversed.

Dependencies:

Usage:

$ export_torrent_cache <source_dir> <destination_dir>

Examples:

$ ls ~/.local/share/data/qBittorrent/BT_backup/
[lots of .torrent files with unhelpful names]

$ export_torrent_cache ~/.local/share/data/qBittorrent/BT_backup/ ~/torrents_backup
Processing ~/.local/share/data/qBittorrent/BT_backup/[infohash].torrent 
All torrents processed succesfully

$ tree ~/torrents_backup
~/torrents_backup
├── Tracker URL
│   ├── Original_Filename.torrent

Installation

From PyPI

$ pip install export_torrent_cache

From source repository

$ git clone https://github.com/codeclem/export_torrent_cache
$ cd export_torrent_cache

From here you can manually install torrent_parser and run the export_torrent_cache.py script directly, or build and install a package like so:

$ python setup.py sdist
$ pip install dist/export_torrent_cache-0.1.tar.gz

Which will also fetch and install torrent_parser as a dependency for you.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

export_torrent_cache-0.1.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file export_torrent_cache-0.1.tar.gz.

File metadata

  • Download URL: export_torrent_cache-0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for export_torrent_cache-0.1.tar.gz
Algorithm Hash digest
SHA256 f0a73c51e8cedcac03ffeef594dcbf6445eadaee26fe353dc4bcdde787c6e94e
MD5 94aec4faa5274415a7e57256c24d2bca
BLAKE2b-256 2c7fe6698ef24077a7ea0872d8cc72ba5ada1af2a2d88ff47bd2f39e9d9662fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page