Module: deluge Branch: master Commit: 2956a7db548945146dad2eccb0f0a29493f28f24
Author: Andrew Resch <[email protected]> Date: Mon Mar 29 18:49:41 2010 -0700 Keep track of newly added torrents in the SessionProxy --- deluge/ui/sessionproxy.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py index f857fd9..3e03253 100644 --- a/deluge/ui/sessionproxy.py +++ b/deluge/ui/sessionproxy.py @@ -68,6 +68,7 @@ class SessionProxy(component.Component): client.register_event_handler("TorrentStateChangedEvent", self.on_torrent_state_changed) client.register_event_handler("TorrentRemovedEvent", self.on_torrent_removed) + client.register_event_handler("TorrentAddedEvent", self.on_torrent_added) def start(self): def on_torrent_status(status): @@ -223,5 +224,11 @@ class SessionProxy(component.Component): def on_torrent_state_changed(self, torrent_id, state): self.torrents[torrent_id][1]["state"] = state + def on_torrent_added(self, torrent_id): + self.torrents[torrent_id] = [time.time() - self.cache_time - 1, {}] + def on_status(status): + self.torrents[torrent_id][1].update(status) + client.core.get_torrent_status(torrent_id, []).addCallback(on_status) + def on_torrent_removed(self, torrent_id): del 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.
