Add failed download handling to Transmission

This commit is contained in:
mano3m
2013-06-29 10:23:08 +02:00
parent 18a88eab51
commit cfd23c395a
2 changed files with 20 additions and 2 deletions

View File

@@ -78,6 +78,18 @@ config = [{
'advanced': True,
'description': 'Disable this downloader for automated searches, but use it when I manually send a release.',
},
{
'name': 'stalled_as_failed',
'default': True,
'type': 'bool',
'description': 'Consider a stalled torrent as failed',
},
{
'name': 'delete_failed',
'default': True,
'type': 'bool',
'description': 'Delete a release after the download has failed.',
},
],
}
],

View File

@@ -89,7 +89,7 @@ class Transmission(Downloader):
statuses = StatusList(self)
return_params = {
'fields': ['id', 'name', 'hashString', 'percentDone', 'status', 'eta', 'isFinished', 'downloadDir', 'uploadRatio', 'secondsSeeding', 'seedIdleLimit']
'fields': ['id', 'name', 'hashString', 'percentDone', 'status', 'eta', 'isStalled', 'isFinished', 'downloadDir', 'uploadRatio', 'secondsSeeding', 'seedIdleLimit']
}
queue = self.trpc.get_alltorrents(return_params)
@@ -105,7 +105,9 @@ class Transmission(Downloader):
return
status = 'busy'
if item['status'] == 0 and item['percentDone'] == 1:
if item['isStalled'] and self.conf('stalled_as_failed'):
status = 'failed'
elif item['status'] == 0 and item['percentDone'] == 1:
status = 'completed'
elif item['status'] in [5, 6]:
status = 'seeding'
@@ -128,6 +130,10 @@ class Transmission(Downloader):
else:
return self.trpc.start_torrent(item['hashString'])
def removeFailed(self, item):
log.info('%s failed downloading, deleting...', item['name'])
return self.trpc.remove_torrent(self, item['hashString'], True)
def processComplete(self, item, delete_files = False):
log.debug('Requesting Transmission to remove the torrent %s%s.', (item['name'], ' and cleanup the downloaded files' if delete_files else ''))
return self.trpc.remove_torrent(self, item['hashString'], delete_files)