tidy up some deferred stuff
This commit is contained in:
parent
3ee434975c
commit
8b69d66bae
|
@ -567,7 +567,7 @@ class WebApi(JSONComponent):
|
||||||
dl.addCallback(on_complete)
|
dl.addCallback(on_complete)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def _on_got_files(self, torrent, d):
|
def _on_got_files(self, torrent):
|
||||||
files = torrent.get("files")
|
files = torrent.get("files")
|
||||||
file_progress = torrent.get("file_progress")
|
file_progress = torrent.get("file_progress")
|
||||||
file_priorities = torrent.get("file_priorities")
|
file_priorities = torrent.get("file_priorities")
|
||||||
|
@ -610,7 +610,7 @@ class WebApi(JSONComponent):
|
||||||
|
|
||||||
file_tree = uicommon.FileTree2(paths)
|
file_tree = uicommon.FileTree2(paths)
|
||||||
file_tree.walk(walk)
|
file_tree.walk(walk)
|
||||||
d.callback(file_tree.get_tree())
|
return file_tree.get_tree()
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def get_torrent_status(self, torrent_id, keys):
|
def get_torrent_status(self, torrent_id, keys):
|
||||||
|
@ -626,10 +626,8 @@ class WebApi(JSONComponent):
|
||||||
:returns: The torrents files in a tree
|
:returns: The torrents files in a tree
|
||||||
:rtype: dictionary
|
:rtype: dictionary
|
||||||
"""
|
"""
|
||||||
main_deferred = Deferred()
|
return component.get("SessionProxy").get_torrent_status(torrent_id, FILES_KEYS
|
||||||
d = component.get("SessionProxy").get_torrent_status(torrent_id, FILES_KEYS)
|
).addCallback(self._on_got_files)
|
||||||
d.addCallback(self._on_got_files, main_deferred)
|
|
||||||
return main_deferred
|
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def download_torrent_from_url(self, url, cookie=None):
|
def download_torrent_from_url(self, url, cookie=None):
|
||||||
|
|
Loading…
Reference in New Issue