Only request needed torrent ids from deluge.

This commit is contained in:
Techmunk committed 2014-01-11 15:46:24 +10:00
1 parent fb9d52c2b9
commit 99b99a992d
1 file changed
+3 -4
+3 -4
View File
@@ -95,7 +95,7 @@ class Deluge(Downloader):
release_downloads = ReleaseDownloadList(self) release_downloads = ReleaseDownloadList(self)
queue = self.drpc.get_alltorrents() queue = self.drpc.get_alltorrents(ids)
if not queue: if not queue:
log.debug('Nothing in queue or error') log.debug('Nothing in queue or error')
@@ -103,7 +103,6 @@ class Deluge(Downloader):
for torrent_id in queue: for torrent_id in queue:
torrent = queue[torrent_id] torrent = queue[torrent_id]
if torrent['hash'] in ids:
log.debug('name=%s / id=%s / save_path=%s / move_completed_path=%s / hash=%s / progress=%s / state=%s / eta=%s / ratio=%s / stop_ratio=%s / is_seed=%s / is_finished=%s / paused=%s', (torrent['name'], torrent['hash'], torrent['save_path'], torrent['move_completed_path'], torrent['hash'], torrent['progress'], torrent['state'], torrent['eta'], torrent['ratio'], torrent['stop_ratio'], torrent['is_seed'], torrent['is_finished'], torrent['paused'])) log.debug('name=%s / id=%s / save_path=%s / move_completed_path=%s / hash=%s / progress=%s / state=%s / eta=%s / ratio=%s / stop_ratio=%s / is_seed=%s / is_finished=%s / paused=%s', (torrent['name'], torrent['hash'], torrent['save_path'], torrent['move_completed_path'], torrent['hash'], torrent['progress'], torrent['state'], torrent['eta'], torrent['ratio'], torrent['stop_ratio'], torrent['is_seed'], torrent['is_finished'], torrent['paused']))
# Deluge has no easy way to work out if a torrent is stalled or failing. # Deluge has no easy way to work out if a torrent is stalled or failing.
@@ -209,11 +208,11 @@ class DelugeRPC(object):
return torrent_id return torrent_id
def get_alltorrents(self): def get_alltorrents(self, ids):
ret = False ret = False
try: try:
self.connect() self.connect()
ret = self.client.core.get_torrents_status({}, {}).get() ret = self.client.core.get_torrents_status({'id': ids}, {}).get()
except Exception, err: except Exception, err:
log.error('Failed to get all torrents: %s %s', (err, traceback.format_exc())) log.error('Failed to get all torrents: %s %s', (err, traceback.format_exc()))
finally: finally: