From ab4435ee293805bf4194a93b8a04886092b10e9d Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 26 Aug 2008 22:38:22 +0000 Subject: [PATCH] Tracker errors now change the tracker status --- deluge/core/torrentmanager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 9e399cc03..819afc1d0 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -145,6 +145,8 @@ class TorrentManager(component.Component): self.alerts.register_handler("tracker_alert", self.on_alert_tracker) self.alerts.register_handler("tracker_warning_alert", self.on_alert_tracker_warning) + self.alerts.register_handler("tracker_error_alert", + self.on_alert_tracker_error) self.alerts.register_handler("storage_moved_alert", self.on_alert_storage_moved) self.alerts.register_handler("torrent_resumed_alert", @@ -692,6 +694,16 @@ class TorrentManager(component.Component): self.torrents[torrent_id].set_tracker_status(tracker_status) except KeyError: log.debug("torrent_id doesn't exist.") + + def on_alert_tracker_error(self, alert): + log.debug("on_alert_tracker_error") + torrent = self.torrents[str(alert.handle.info_hash())] + + tracker_status = "%s: %s" % (_("Error"), str(alert.message())) + try: + torrent.set_tracker_status(tracker_status) + except KeyError: + log.debug("torrent_id doesn't exist.") def on_alert_storage_moved(self, alert): log.debug("on_alert_storage_moved")