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

This commit is contained in:
Calum Lind 2011-06-30 19:24:38 +01:00
parent 420447e386
commit 0f625943c0
1 changed files with 6 additions and 3 deletions

View File

@ -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"]