def handle_finished_download():
torrent_id = os.environ['TR_TORRENT_ID']
syslog.syslog('Beginning processing of torrent {0}'.format(torrent_id))
transmission_client = transmissionrpc.Client(
transmission_host, port=transmission_port, user=transmission_user,
password=transmission_password
)
torrent = transmission_client.get_torrent(torrent_id)
# Make sure transmission called us with a completed torrent
if torrent.progress != 100.0:
syslog.syslog(syslog.LOG_ERR, 'Called with an incomplete torrent')
sys.exit(1)
if couchpotato_category in torrent.downloadDir:
if not ignore_couchpotato:
handle_couchpotato(torrent)
elif sonarr_category in torrent.downloadDir:
if not ignore_sonarr:
handle_sonarr(torrent)
else:
handle_manual(torrent)
# Immediately remove torrents that are not whitelisted (by tracker)
if not whitelisted(torrent):
transmission_client.remove_torrent(torrent_id)
pb_notify('Removed non-whitelisted torrent {0}'.format(torrent.name))
评论列表
文章目录