summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/AutoAdd
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2021-07-24 10:14:47 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2021-07-24 11:25:25 +0100
commit5374d237a774abb2a34756c1ce7cec3611c3081d (patch)
tree4b367c22d1dfad8b7492f7af0dd2356a11fe9601 /deluge/plugins/AutoAdd
parent2e466101fc20aa4314049d942d56e2be75fd70ae (diff)
downloaddeluge-5374d237a774abb2a34756c1ce7cec3611c3081d.tar.gz
deluge-5374d237a774abb2a34756c1ce7cec3611c3081d.tar.bz2
deluge-5374d237a774abb2a34756c1ce7cec3611c3081d.zip
[AutoAdd|3295] Correctly fix auto-adding magnets
Properly fix adding magnets, first attempted in previous commit 2e466101fc20a add_torrent_magnet does not return a deferred so wrap in maybeDeferred. Fixed broken test due to new deluge website icon
Diffstat (limited to 'deluge/plugins/AutoAdd')
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/core.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/core.py b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
index 668f461f8..9a2260610 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/core.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
@@ -21,7 +21,9 @@ import shutil
from base64 import b64encode
from twisted.internet import reactor
+from twisted.internet.defer import maybeDeferred
from twisted.internet.task import LoopingCall, deferLater
+from twisted.python.failure import Failure
import deluge.component as component
import deluge.configmanager
@@ -325,6 +327,9 @@ class Core(CorePluginBase):
os.remove(filepath)
def fail_torrent_add(err_msg, filepath, magnet):
+ if isinstance(err_msg, Failure):
+ err_msg = err_msg.getErrorMessage()
+
# torrent handle is invalid and so is the magnet link
log.error(
'Cannot Autoadd %s: %s: %s',
@@ -337,8 +342,10 @@ class Core(CorePluginBase):
try:
# The torrent looks good, so lets add it to the session.
if magnet:
- d = component.get('Core').add_torrent_magnet(
- filedump.strip(), options
+ d = maybeDeferred(
+ component.get('Core').add_torrent_magnet,
+ filedump.strip(),
+ options,
)
else:
d = component.get('Core').add_torrent_file_async(