Module: deluge
Branch: 1.3-stable
Commit: 2cceb3a3498820b89371ba44fc9f819a498ccafb

Author: Calum Lind <[email protected]>
Date:   Tue Jun 28 01:42:26 2011 +0100

Update append trackers commit to ignore state file adds

---

 deluge/core/torrentmanager.py |   47 +++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 6b6d061..ebdc96b 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -410,31 +410,32 @@ class TorrentManager(component.Component):
         add_torrent_params["duplicate_is_error"] = True
 
         # If torrent already exists just append any extra trackers.
-        add_torrent_id = str(add_torrent_params["ti"].info_hash())
-        if add_torrent_id in self.get_torrent_list():
-            log.debug("Torrent (%s) exists, checking for trackers to add...", 
add_torrent_id)
-            add_torrent_trackers = []
-            for value in add_torrent_params["ti"].trackers():
-                tracker = {}
-                tracker["url"] = value.url
-                tracker["tier"] = value.tier
-                add_torrent_trackers.append(tracker)
-
-            torrent_trackers = {}
-            tracker_list = []
-            for tracker in  
self[add_torrent_id].get_status(["trackers"])["trackers"]:
-                torrent_trackers[(tracker["url"])] = tracker
-                tracker_list.append(tracker)
-
-            added_tracker = False
-            for tracker in add_torrent_trackers:
-                if tracker['url'] not in torrent_trackers:
+        if state is None:
+            add_torrent_id = str(add_torrent_params["ti"].info_hash())
+            if add_torrent_id in self.get_torrent_list():
+                log.debug("Torrent (%s) exists, checking for trackers to 
add...", add_torrent_id)
+                add_torrent_trackers = []
+                for value in add_torrent_params["ti"].trackers():
+                    tracker = {}
+                    tracker["url"] = value.url
+                    tracker["tier"] = value.tier
+                    add_torrent_trackers.append(tracker)
+
+                torrent_trackers = {}
+                tracker_list = []
+                for tracker in  
self[add_torrent_id].get_status(["trackers"])["trackers"]:
+                    torrent_trackers[(tracker["url"])] = tracker
                     tracker_list.append(tracker)
-                    added_tracker = True
 
-            if added_tracker:
-                self[add_torrent_id].set_trackers(tracker_list)
-            return
+                added_tracker = False
+                for tracker in add_torrent_trackers:
+                    if tracker['url'] not in torrent_trackers:
+                        tracker_list.append(tracker)
+                        added_tracker = True
+
+                if added_tracker:
+                    self[add_torrent_id].set_trackers(tracker_list)
+                return
 
         # We need to pause the AlertManager momentarily to prevent alerts
         # for this torrent being generated before a Torrent object is created.

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to