Fix #1477: Execute Plugin should ignore Added events from state file on startup
This commit is contained in:
parent
420447e386
commit
0f625943c0
|
@ -87,8 +87,8 @@ class Core(CorePluginBase):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def create_event_handler(event):
|
def create_event_handler(event):
|
||||||
def event_handler(torrent_id):
|
def event_handler(torrent_id, *arg):
|
||||||
self.execute_commands(torrent_id, event)
|
self.execute_commands(torrent_id, event, *arg)
|
||||||
return event_handler
|
return event_handler
|
||||||
event_handler = create_event_handler(event)
|
event_handler = create_event_handler(event)
|
||||||
event_manager.register_event_handler(EVENT_MAP[event], event_handler)
|
event_manager.register_event_handler(EVENT_MAP[event], event_handler)
|
||||||
|
@ -96,7 +96,7 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
log.debug("Execute core plugin enabled!")
|
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]
|
torrent = component.get("TorrentManager").torrents[torrent_id]
|
||||||
info = torrent.get_status(["name", "save_path", "move_on_completed", "move_on_completed_path"])
|
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"]
|
torrent_name = info["name"]
|
||||||
if event == "complete":
|
if event == "complete":
|
||||||
save_path = info["move_on_completed_path"] if info ["move_on_completed"] else info["save_path"]
|
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:
|
else:
|
||||||
save_path = info["save_path"]
|
save_path = info["save_path"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue