Module: deluge
Branch: master
Commit: 0f625943c040a4330d81216a4f299d8466ae8c3f

Author: Calum Lind <[email protected]>
Date:   Thu Jun 30 19:24:38 2011 +0100

Fix #1477: Execute Plugin should ignore Added events from state file on startup

---

 .../plugins/Execute/deluge/plugins/execute/core.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/deluge/plugins/Execute/deluge/plugins/execute/core.py 
b/deluge/plugins/Execute/deluge/plugins/execute/core.py
index 23237da..cc7e105 100644
--- a/deluge/plugins/Execute/deluge/plugins/execute/core.py
+++ b/deluge/plugins/Execute/deluge/plugins/execute/core.py
@@ -87,8 +87,8 @@ class Core(CorePluginBase):
                 continue
 
             def create_event_handler(event):
-                def event_handler(torrent_id):
-                    self.execute_commands(torrent_id, event)
+                def event_handler(torrent_id, *arg):
+                    self.execute_commands(torrent_id, event, *arg)
                 return event_handler
             event_handler = create_event_handler(event)
             event_manager.register_event_handler(EVENT_MAP[event], 
event_handler)
@@ -96,7 +96,7 @@ class Core(CorePluginBase):
 
         log.debug("Execute core plugin enabled!")
 
-    def execute_commands(self, torrent_id, event):
+    def execute_commands(self, torrent_id, event, *arg):
         torrent = component.get("TorrentManager").torrents[torrent_id]
         info = torrent.get_status(["name", "save_path", "move_on_completed", 
"move_on_completed_path"])
 
@@ -104,6 +104,9 @@ class Core(CorePluginBase):
         torrent_name = info["name"]
         if event == "complete":
             save_path = info["move_on_completed_path"] if info 
["move_on_completed"] else info["save_path"]
+        elif event == "added" and arg[0]:
+            # No futher action as from_state (arg[0]) is True
+            return
         else:
             save_path = info["save_path"]
 

-- 
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