summaryrefslogtreecommitdiffstats
path: root/deluge
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2019-05-17 13:22:39 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2019-05-18 16:12:08 +0100
commitb961e11df67f34f9ef4eb44621781b3bc4b37735 (patch)
tree0039f0656b3500efc57a8a4cf2405bc7fbc1f329 /deluge
parent2ca683e8fe8653bf7946f4237f562aef6a2a010a (diff)
downloaddeluge-b961e11df67f34f9ef4eb44621781b3bc4b37735.tar.gz
deluge-b961e11df67f34f9ef4eb44621781b3bc4b37735.tar.bz2
deluge-b961e11df67f34f9ef4eb44621781b3bc4b37735.zip
[GTK] Fix handling failed magnet prefetching in Add dialog
If a torrent already exists when trying to prefetch magnet metadata the exception is not handled and dialog does not update correctly.
Diffstat (limited to 'deluge')
-rw-r--r--deluge/ui/gtk3/addtorrentdialog.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/deluge/ui/gtk3/addtorrentdialog.py b/deluge/ui/gtk3/addtorrentdialog.py
index b741c9d4d..72841c616 100644
--- a/deluge/ui/gtk3/addtorrentdialog.py
+++ b/deluge/ui/gtk3/addtorrentdialog.py
@@ -268,6 +268,10 @@ class AddTorrentDialog(component.Component):
self.prefetching_magnets.remove(info_hash)
self._on_torrent_changed(self.listview_torrents.get_selection())
+ def _on_uri_metadata_fail(self, result, info_hash):
+ self.prefetching_magnets.remove(info_hash)
+ self._on_torrent_changed(self.listview_torrents.get_selection())
+
def prefetch_waiting_message(self, torrent_id, files):
"""Show magnet files fetching or failed message above files list."""
if torrent_id in self.prefetching_magnets:
@@ -306,10 +310,11 @@ class AddTorrentDialog(component.Component):
if files:
continue
+ self.prefetching_magnets.append(torrent_id)
+ self.prefetch_waiting_message(torrent_id, None)
d = client.core.prefetch_magnet_metadata(uri)
d.addCallback(self._on_uri_metadata, uri)
- self.prefetching_magnets.append(magnet['info_hash'])
- self.prefetch_waiting_message(torrent_id, None)
+ d.addErrback(self._on_uri_metadata_fail, torrent_id)
if already_added:
self.show_already_added_dialog(already_added)
@@ -903,7 +908,7 @@ class AddTorrentDialog(component.Component):
)
)
elif is_magnet(filename):
- client.core.add_torrent_magnet(filename, options)
+ client.core.add_torrent_magnet(filename, options).addErrback(log.debug)
row = self.torrent_liststore.iter_next(row)