qbt-clean 0.3.0

Automated rules-based cleaning of qBittorrent torrents.
qbt-clean-0.3.0 is not a library.

qbt-clean

A tool for cleaning up torrents in qBittorrent. The defining feature is that it attempts to identify groups of torrents that are the same content. For example torrents that are likely hard-linked or ref-linked to the same underlying data.

Running

The only argument is a path to a config file. See information about the supported config fields below.

qbt-clean config.scfg

Grouping

The current grouping is incredibly simple. It just sums up the size of substantial files in each torrent. Any files that share the exact same total size are considered a group.

Config

Operational Config

target_free

Clean up torrents until this much space is free on the filesystem.

Note: This assumes that each deleted group frees up the amount of the space of the torrent size. This can underestimate (if the backing blocks are still used by other files) or overestimate (if the torrents in the group did not share data).

target_free: 100 GiB

dry_run

Calculate the work to do but don't actually perform any modifications.

Note: This is enabled by default. You must but dry_run: false into your config in order to actually perform modifications.

dry_run: true

qbt_url

The URL to interact with qBittorrent at. This should also contain the username and password for authentication.

qbt_url: http://localhost:8080

Filters

Filters are applied to each torrent individually. Any torrent that matches a filter will block the group from being cleaned up.

The default values have been show.

categories_allowed

The torrent must be in one of these categories to be cleaned up.

There are no defaults (meaning that if this isn't set no torrents will match).

last_activity_min

If the torrent was active within this period it won't be cleaned up.

last_activity_min: 7d

names_pinned

If the torrent name matches any of these regexes it won't be cleaned up. These must match the full name.

There are no defaults.

trackers_pinned

If any of the tracker URLs name match any of these regexes it won't be cleaned up. These must match the full tracker URL.

There are no defaults.

seed_time_min

If the total torrent seed time is less than this it won't be cleaned up.

seed_time_min: 14d

seeder_count_min

If the torrent doesn't have this many seeders it won't be cleaned up.

seeder_count_min: 3

state_allowed

If the torrent isn't in one of these states it won't be cleaned up.

state_allowed:
	stalledUP
	stopped

Ranking

Ranking determines which torrents to delete first. The highest ranked torrents will be deleted until the desired space is reclaimed.

All ranking parameters take a floating point number and default to zero. If all ranking parameters are zero seeder_count_weight: 1.0 will be applied.

age_d_max_weight

Rank based on the age of the oldest torrent in the group.

Note: If you want to prefer keeping older torrents the weight should be negative.

copies_weight

Rank based on number of torrents in the group.

Note: If you want to prefer keeping larger groups the weight should be negative.

last_activity_d_weight

Rank based on the last activity in the group.

seeder_count_weight

Rank based on total seeder count.

size_weight

Rank based on the size expected to be freed by deleting.

Note: This is roughly the size of a torrent in the group.