[AutoAdd|3295] Correctly fix auto-adding magnets
Properly fix adding magnets, first attempted in previous commit 2e466101fc
add_torrent_magnet does not return a deferred so wrap in maybeDeferred.
Fixed broken test due to new deluge website icon
This commit is contained in:
parent
2e466101fc
commit
5374d237a7
|
@ -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(
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue