|
|
@ -2,7 +2,7 @@ from base64 import b64encode, b16encode, b32decode |
|
|
|
from bencode import bencode as benc, bdecode |
|
|
|
from couchpotato.core.downloaders.base import Downloader, ReleaseDownloadList |
|
|
|
from couchpotato.core.helpers.encoding import isInt, sp |
|
|
|
from couchpotato.core.helpers.variable import tryFloat |
|
|
|
from couchpotato.core.helpers.variable import tryFloat, cleanHost |
|
|
|
from couchpotato.core.logger import CPLog |
|
|
|
from datetime import timedelta |
|
|
|
from hashlib import sha1 |
|
|
@ -22,7 +22,7 @@ class Deluge(Downloader): |
|
|
|
|
|
|
|
def connect(self): |
|
|
|
# Load host from config and split out port. |
|
|
|
host = self.conf('host').split(':') |
|
|
|
host = cleanHost(self.conf('host'), protocol = False).split(':') |
|
|
|
if not isInt(host[1]): |
|
|
|
log.error('Config properties are not filled in correctly, port is missing.') |
|
|
|
return False |
|
|
@ -103,7 +103,12 @@ class Deluge(Downloader): |
|
|
|
|
|
|
|
for torrent_id in queue: |
|
|
|
torrent = queue[torrent_id] |
|
|
|
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'])) |
|
|
|
|
|
|
|
if not 'hash' in torrent: |
|
|
|
# When given a list of ids, deluge will return an empty item for a non-existant torrent. |
|
|
|
continue |
|
|
|
|
|
|
|
log.debug('name=%s / id=%s / save_path=%s / move_on_completed=%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_on_completed'], 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. |
|
|
|
#status = 'failed' |
|
|
@ -212,7 +217,7 @@ class DelugeRPC(object): |
|
|
|
ret = False |
|
|
|
try: |
|
|
|
self.connect() |
|
|
|
ret = self.client.core.get_torrents_status({'id': ids}, {}).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')).get() |
|
|
|
except Exception, err: |
|
|
|
log.error('Failed to get all torrents: %s %s', (err, traceback.format_exc())) |
|
|
|
finally: |
|
|
|