Small program that simplifies common chores on multiple torrents (currently only supports Transmission).
Project description
Transmission Lever
Small program that simplifies common chores on torrents by wrapping the RPC. This program is not meant to be a manager by itself, only a lever for others to write their own automatized tools.
Installation
This program is written in python and is platform agnostic.
- Clone the repo:
git clone https://github.com/Tomodoro/transmission-lever.git tlever
- Enter the repo:
cd tlever
- Create an environment
python -m venv .env
- Activate the environment
. .env/bin/activate
- Install
transmission-rpc:
pip3 install transmission-rpc
- Copy configuration file from example:
cp transmission-lever.json.example ~/.config/transmission-lever.json
- Check help:
python src/tlever.py --help
CLI Usage
Categories
To organize torrents in folders the same way as clients like qBittorrent, a label-based system marks the torrents and moves them to the location.
All paths are relative to the Downloads directory, this is read from
the transmission configuration file.
For example, to move <torrent-hash> into the movies category.
python src/tlever.py category add movies <torrent-hash>
This will add the label @movies to the torrent and move its data to:
Downloads/
└── movies
└── torrent-name
To undo the action:
python src/tlever.py category remove movies <torrent-hash>
This will remove the label @movies to the torrent and movie its data to:
Downloads/
└── torrent-name
This command does not clean up empty directories, this is because the program is using the RPC to move torrent data and it does not have permissions over the filesystem in all use cases.
Hooking the command
find /path/to/Downloads -type d -empty -deleteto a script triggered by added|done|done_seeding of a torrent does the trick.
If labels get desync from the torrent directory, you can enforce the category label directory:
python src/tlever.py enforce category
Tags
To separate common labels from category labels, a tag with a prefix is used.
For example, to tag <torrent-hash> with best-of-the-year:
python src/tlever.py tag add best-of-the-year <torrent-hash>
This will add the label #best-of-the-year to the torrent.
To undo the action:
python src/tlever.py tag remove best-of-the-year <torrent-hash>
This will remove the label #best-of-the-year to the torrent.
This command is not equivalent to
tier.py label ...as it is always prefixed.
Tiers
To set upload speed throttling based on ratio, this is based on qbitseedmgr.
To start managing torrents:
python src/tlever.py tier set
To stop managing torrents:
python src/tlever.py tier unset
To resume paused torrents:
python src/tlever.py tier activate
It seems that the RPC does not expose the number of seeds, so it's not possible to port
not-popular.
To keep the tiers updated and active:
python src/tlever.py enforce tier
TUI
Basic terminal interface to show live a torrent stats.
For example, given the torrent <torrent-hash>:
python src/tlever.py tui show <torrent-hash>
Labels
To manage labels without prefixes, useful to fix torrents that have invalid categories or tags because of a change on their prefix.
For example, given the prefixes @ and # for categories and tags respectively,
it's desired to remove the invalid tag %monthly-release
from <torrent-hash>:
python src/tlever.py label remove %monthly-release <torrent-hash>
To add an arbitrary label:
python src/tlever.py label add custom-label <torrent-hash>
Module Usage
Overview
The functions are split into three namespaces:
core: direct calls to RPCextra: extended functionality (i.e. categories)community: extended functionality added from user's PR
The goal is to have a friendly wrapper with proper docstrings that is modular and extendable.
If a PR usecase is generic enough it is moved into extra.
How to use?
The main file tlever.py that handles the CLI
it's only a series of if/else statements around functions.
To build a custom program you only need to call this functions inside your program, making the respective module imports.
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 transmission_lever-0.1.0.tar.gz.
File metadata
- Download URL: transmission_lever-0.1.0.tar.gz
- Upload date:
- Size: 21.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
214b0786a9071098e674b4626fefb8937a988d1c9167d1a6fa56f6e6e17d011a
|
|
| MD5 |
7fc57a1b0c22d69a3251c656ee790bc5
|
|
| BLAKE2b-256 |
08fa247c7884ff8d5e3046ecbd311ae5a1a903217903c73d7a01c2cd9057fe51
|
File details
Details for the file transmission_lever-0.1.0-py3-none-any.whl.
File metadata
- Download URL: transmission_lever-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f52620d10d574780fb4901e1d6f52fdce4708e8e8d45c710eea9a5ec77b8e6d
|
|
| MD5 |
7f7a662a141b97c2c6ded3a7bd29c4ca
|
|
| BLAKE2b-256 |
7316e3234ecedfc0b0b06abd0d9f6f5e3ab9f6b8aebf2176129a0a9bc6aee4f5
|