kuuko pushed a commit to branch master.

http://git.enlightenment.org/apps/epour.git/commit/?id=9037ecddc447dc3efc68ae7e8b1c36dcbc6a7ee7

commit 9037ecddc447dc3efc68ae7e8b1c36dcbc6a7ee7
Author: Kai Huuhko <kai.huu...@gmail.com>
Date:   Wed Sep 7 18:17:18 2016 +0300

    Change gui to use add_torrent_alert instead of torrent_added_alert
    
    This may fix a bug that I was unable to reproduce. Anyway, should be more 
robust.
---
 epour/gui/__init__.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/epour/gui/__init__.py b/epour/gui/__init__.py
index e0d13f2..89ed6c4 100644
--- a/epour/gui/__init__.py
+++ b/epour/gui/__init__.py
@@ -172,20 +172,22 @@ class MainInterface(object):
         topbox.stack_above(mbox)
         topbox.show()
 
-        def torrent_added_cb(a):
+        def _add_torrent_cb(a):
+            e = a.error
+            if e.value() > 0:
+                return
             h = a.handle
             info_hash = h.info_hash()
-            log.debug("Torrent added: %s" % str(info_hash))
             torrent = session.torrents[str(info_hash)]
             self.add_torrent_item(torrent)
 
-        def torrent_removed_cb(a):
+        def _torrent_removed_cb(a):
             self.remove_torrent_item(str(a.info_hash))
 
         session.alert_manager.callback_add(
-            "torrent_added_alert", torrent_added_cb)
+            "add_torrent_alert", _add_torrent_cb)
         session.alert_manager.callback_add(
-            "torrent_removed_alert", torrent_removed_cb)
+            "torrent_removed_alert", _torrent_removed_cb)
 
         def torrent_paused_resumed_cb(a):
             h = a.handle

-- 


Reply via email to