Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove finished torrents from Transmission BitTorrent client daemon
#! /usr/bin/python2
import transmissionrpc
## connection paramters - change to match your own settings
creds = {'address':'localhost', 'port':9091 'user':'my_user_name_here', 'password':'my_password_here'}
## establishing contact
tm_client = transmissionrpc.Client(creds['address'], creds['port'], creds['user'], creds['password'])
torrents_lst = tm_client.list()
## going through torrents, removing and trashing old ones
## set to only remove finished and stopped torrents that have at least a ration of 1.2
for torrent_no in torrents_lst:
torrent = torrents_lst[torrent_no]
if torrent.progress < 100 \
or torrent.status != 'stopped' \
or torrent.ratio < 1.2:
continue
tm_client.remove_torrent(torrent_no, delete_data=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment