Module: deluge Branch: 1.3-stable Commit: 7e51c827052bd23812d7d1897a9a05115650c778
Author: Calum Lind <[email protected]> Date: Thu Jun 30 22:38:07 2011 +0100 Improved fix for losing Labels upon restart --- deluge/plugins/label/label/core.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/deluge/plugins/label/label/core.py b/deluge/plugins/label/label/core.py index 7b1ea6f..615d828 100644 --- a/deluge/plugins/label/label/core.py +++ b/deluge/plugins/label/label/core.py @@ -97,6 +97,7 @@ class Core(CorePluginBase): log.info("*** Start Label plugin ***") self.plugin = component.get("CorePluginManager") self.plugin.register_status_field("label", self._status_get_label) + self.torrent_manager = component.get("TorrentManager") #__init__ core = component.get("Core") @@ -110,9 +111,7 @@ class Core(CorePluginBase): self.clean_initial_config() - def on_session_started(): - component.get("EventManager").register_event_handler("TorrentAddedEvent", self.post_torrent_add) - component.get("EventManager").register_event_handler("SessionStartedEvent", on_session_started) + component.get("EventManager").register_event_handler("TorrentAddedEvent", self.post_torrent_add) component.get("EventManager").register_event_handler("TorrentRemovedEvent", self.post_torrent_remove) #register tree: @@ -132,6 +131,8 @@ class Core(CorePluginBase): ## Plugin hooks ## def post_torrent_add(self, torrent_id): + if not self.torrent_manager.session_started: + return log.debug("post_torrent_add") torrent = self.torrents[torrent_id] -- 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.
