diff options
Diffstat (limited to 'deluge/core/torrentmanager.py')
-rw-r--r-- | deluge/core/torrentmanager.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 3efc9a400..6dafd1939 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -57,7 +57,7 @@ from deluge.core.authmanager import AUTH_LEVEL_ADMIN from deluge.core.torrent import Torrent from deluge.core.torrent import TorrentOptions import deluge.core.oldstateupgrader -from deluge.common import utf8_encoded +from deluge.common import utf8_encoded, decode_string log = logging.getLogger(__name__) @@ -390,7 +390,8 @@ class TorrentManager(component.Component): resume_data = self.legacy_get_resume_data_from_file(state.torrent_id) self.legacy_delete_resume_data(state.torrent_id) - add_torrent_params["resume_data"] = resume_data + if resume_data: + add_torrent_params["resume_data"] = resume_data else: # We have a torrent_info object or magnet uri so we're not loading from state. if torrent_info: @@ -970,15 +971,14 @@ class TorrentManager(component.Component): def on_alert_tracker_reply(self, alert): if log.isEnabledFor(logging.DEBUG): - log.debug("on_alert_tracker_reply: %s", alert.message().decode("utf8")) + log.debug("on_alert_tracker_reply: %s", decode_string(alert.message())) try: torrent = self.torrents[str(alert.handle.info_hash())] except: return # Set the tracker status for the torrent - if alert.message() != "Got peers from DHT": - torrent.set_tracker_status(_("Announce OK")) + torrent.set_tracker_status(_("Announce OK")) # Check to see if we got any peer information from the tracker if alert.handle.status().num_complete == -1 or \ @@ -1003,7 +1003,7 @@ class TorrentManager(component.Component): torrent = self.torrents[str(alert.handle.info_hash())] except: return - tracker_status = '%s: %s' % (_("Warning"), str(alert.message())) + tracker_status = '%s: %s' % (_("Warning"), decode_string(alert.message())) # Set the tracker status for the torrent torrent.set_tracker_status(tracker_status) @@ -1013,7 +1013,7 @@ class TorrentManager(component.Component): torrent = self.torrents[str(alert.handle.info_hash())] except: return - tracker_status = "%s: %s" % (_("Error"), alert.msg) + tracker_status = "%s: %s" % (_("Error"), decode_string(alert.msg)) torrent.set_tracker_status(tracker_status) def on_alert_storage_moved(self, alert): @@ -1073,11 +1073,11 @@ class TorrentManager(component.Component): self.waiting_on_resume_data[torrent_id].callback(None) def on_alert_save_resume_data_failed(self, alert): - log.debug("on_alert_save_resume_data_failed: %s", alert.message()) + log.debug("on_alert_save_resume_data_failed: %s", decode_string(alert.message())) torrent_id = str(alert.handle.info_hash()) if torrent_id in self.waiting_on_resume_data: - self.waiting_on_resume_data[torrent_id].errback(Exception(alert.message())) + self.waiting_on_resume_data[torrent_id].errback(Exception(decode_string(alert.message()))) def on_alert_file_renamed(self, alert): log.debug("on_alert_file_renamed") @@ -1107,7 +1107,7 @@ class TorrentManager(component.Component): torrent.write_torrentfile() def on_alert_file_error(self, alert): - log.debug("on_alert_file_error: %s", alert.message()) + log.debug("on_alert_file_error: %s", decode_string(alert.message())) try: torrent = self.torrents[str(alert.handle.info_hash())] except: @@ -1115,7 +1115,7 @@ class TorrentManager(component.Component): torrent.update_state() def on_alert_file_completed(self, alert): - log.debug("file_completed_alert: %s", alert.message()) + log.debug("file_completed_alert: %s", decode_string(alert.message())) try: torrent_id = str(alert.handle.info_hash()) except: |