Created
June 30, 2015 08:16
-
-
Save brokkr/981e3316e631eaaf7f88 to your computer and use it in GitHub Desktop.
Remove finished torrents from Transmission BitTorrent client daemon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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