Browse Source

removed more ".get()"s

(cherry picked from commit 678d6acb40d27cdd304e4cf8eae1d2236431bcf5)
pull/7311/head
Marijn 5 years ago
committed by MrAlfabet
parent
commit
57f75c53a5
  1. 14
      couchpotato/core/downloaders/deluge.py

14
couchpotato/core/downloaders/deluge.py

@ -236,12 +236,12 @@ class DelugeRPC(object):
torrent_id = False torrent_id = False
try: try:
self.connect() self.connect()
torrent_id = self.client.core.add_torrent_magnet(torrent, options).get() torrent_id = self.client.core.add_torrent_magnet(torrent, options)
if not torrent_id: if not torrent_id:
torrent_id = self._check_torrent(True, torrent) torrent_id = self._check_torrent(True, torrent)
if torrent_id and options['label']: if torrent_id and options['label']:
self.client.label.set_torrent(torrent_id, options['label']).get() self.client.label.set_torrent(torrent_id, options['label'])
except Exception as err: except Exception as err:
log.error('Failed to add torrent magnet %s: %s %s', (torrent, err, traceback.format_exc())) log.error('Failed to add torrent magnet %s: %s %s', (torrent, err, traceback.format_exc()))
finally: finally:
@ -272,7 +272,7 @@ class DelugeRPC(object):
ret = False ret = False
try: try:
self.connect() self.connect()
ret = self.client.core.get_torrents_status({'id': ids}, ('name', 'hash', 'save_path', 'move_completed_path', 'progress', 'state', 'eta', 'ratio', 'stop_ratio', 'is_seed', 'is_finished', 'paused', 'move_on_completed', 'files')).get() ret = self.client.core.get_torrents_status({'id': ids}, ('name', 'hash', 'save_path', 'move_completed_path', 'progress', 'state', 'eta', 'ratio', 'stop_ratio', 'is_seed', 'is_finished', 'paused', 'move_on_completed', 'files'))
except Exception as err: except Exception as 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:
@ -283,7 +283,7 @@ class DelugeRPC(object):
def pause_torrent(self, torrent_ids): def pause_torrent(self, torrent_ids):
try: try:
self.connect() self.connect()
self.client.core.pause_torrent(torrent_ids).get() self.client.core.pause_torrent(torrent_ids)
except Exception as err: except Exception as err:
log.error('Failed to pause torrent: %s %s', (err, traceback.format_exc())) log.error('Failed to pause torrent: %s %s', (err, traceback.format_exc()))
finally: finally:
@ -293,7 +293,7 @@ class DelugeRPC(object):
def resume_torrent(self, torrent_ids): def resume_torrent(self, torrent_ids):
try: try:
self.connect() self.connect()
self.client.core.resume_torrent(torrent_ids).get() self.client.core.resume_torrent(torrent_ids)
except Exception as err: except Exception as err:
log.error('Failed to resume torrent: %s %s', (err, traceback.format_exc())) log.error('Failed to resume torrent: %s %s', (err, traceback.format_exc()))
finally: finally:
@ -304,7 +304,7 @@ class DelugeRPC(object):
ret = False ret = False
try: try:
self.connect() self.connect()
ret = self.client.core.remove_torrent(torrent_id, remove_local_data).get() ret = self.client.core.remove_torrent(torrent_id, remove_local_data)
except Exception as err: except Exception as err:
log.error('Failed to remove torrent: %s %s', (err, traceback.format_exc())) log.error('Failed to remove torrent: %s %s', (err, traceback.format_exc()))
finally: finally:
@ -328,7 +328,7 @@ class DelugeRPC(object):
torrent_hash = b16encode(b32decode(torrent_hash)) torrent_hash = b16encode(b32decode(torrent_hash))
torrent_hash = torrent_hash.lower() torrent_hash = torrent_hash.lower()
torrent_check = self.client.core.get_torrent_status(torrent_hash, {}).get() torrent_check = self.client.core.get_torrent_status(torrent_hash, {})
if torrent_check['hash']: if torrent_check['hash']:
return torrent_hash return torrent_hash

Loading…
Cancel
Save