From 2956a7db548945146dad2eccb0f0a29493f28f24 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 29 Mar 2010 18:49:41 -0700 Subject: [PATCH] Keep track of newly added torrents in the SessionProxy --- deluge/ui/sessionproxy.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py index f857fd98b..3e03253f1 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]