Replace use of status key 'tracker' with 'tracker_host' in UIs
* Status key tracker can be empty so use tracker_host instead, also tracker_host is nicely formatted. * Remove unneeded tracker_host string from tracker_status.
This commit is contained in:
parent
061590665e
commit
af9fa15636
|
@ -597,7 +597,7 @@ class Torrent(object):
|
||||||
Args:
|
Args:
|
||||||
status (str): The tracker status.
|
status (str): The tracker status.
|
||||||
"""
|
"""
|
||||||
self.tracker_status = self.get_tracker_host() + ": " + status
|
self.tracker_status = status
|
||||||
|
|
||||||
def update_state(self):
|
def update_state(self):
|
||||||
"""Updates the state, based on libtorrent's torrent state"""
|
"""Updates the state, based on libtorrent's torrent state"""
|
||||||
|
@ -979,6 +979,7 @@ class Torrent(object):
|
||||||
"total_wanted": lambda: self.status.total_wanted,
|
"total_wanted": lambda: self.status.total_wanted,
|
||||||
"total_remaining": lambda: self.status.total_wanted - self.status.total_wanted_done,
|
"total_remaining": lambda: self.status.total_wanted - self.status.total_wanted_done,
|
||||||
"tracker": lambda: self.status.current_tracker,
|
"tracker": lambda: self.status.current_tracker,
|
||||||
|
"tracker_host": self.get_tracker_host,
|
||||||
"trackers": lambda: self.trackers,
|
"trackers": lambda: self.trackers,
|
||||||
"tracker_status": lambda: self.tracker_status,
|
"tracker_status": lambda: self.tracker_status,
|
||||||
"upload_payload_rate": lambda: self.status.upload_payload_rate,
|
"upload_payload_rate": lambda: self.status.upload_payload_rate,
|
||||||
|
@ -996,7 +997,6 @@ class Torrent(object):
|
||||||
"peers": self.get_peers,
|
"peers": self.get_peers,
|
||||||
"queue": lambda: self.status.queue_position,
|
"queue": lambda: self.status.queue_position,
|
||||||
"ratio": self.get_ratio,
|
"ratio": self.get_ratio,
|
||||||
"tracker_host": self.get_tracker_host,
|
|
||||||
"completed_time": lambda: self.status.completed_time,
|
"completed_time": lambda: self.status.completed_time,
|
||||||
"last_seen_complete": lambda: self.status.last_seen_complete,
|
"last_seen_complete": lambda: self.status.last_seen_complete,
|
||||||
"name": self.get_name,
|
"name": self.get_name,
|
||||||
|
|
|
@ -984,10 +984,8 @@ class TorrentManager(component.Component):
|
||||||
# Set the tracker status for the torrent
|
# Set the tracker status for the torrent
|
||||||
torrent.set_tracker_status("Announce OK")
|
torrent.set_tracker_status("Announce OK")
|
||||||
|
|
||||||
# Check to see if we got any peer information from the tracker
|
# Check for peer information from the tracker, if none then send a scrape request.
|
||||||
if alert.handle.status().num_complete == -1 or \
|
if alert.handle.status().num_complete == -1 or alert.handle.status().num_incomplete == -1:
|
||||||
alert.handle.status().num_incomplete == -1:
|
|
||||||
# We didn't get peer information, so lets send a scrape request
|
|
||||||
torrent.scrape_tracker()
|
torrent.scrape_tracker()
|
||||||
|
|
||||||
def on_alert_tracker_announce(self, alert):
|
def on_alert_tracker_announce(self, alert):
|
||||||
|
@ -1009,22 +1007,22 @@ class TorrentManager(component.Component):
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||||
except (RuntimeError, KeyError):
|
except (RuntimeError, KeyError):
|
||||||
return
|
return
|
||||||
tracker_status = 'Warning: %s' % decode_string(alert.message())
|
|
||||||
# Set the tracker status for the torrent
|
# Set the tracker status for the torrent
|
||||||
torrent.set_tracker_status(tracker_status)
|
torrent.set_tracker_status("Warning: %s" % decode_string(alert.message()))
|
||||||
|
|
||||||
def on_alert_tracker_error(self, alert):
|
def on_alert_tracker_error(self, alert):
|
||||||
"""Alert handler for libtorrent tracker_error_alert"""
|
"""Alert handler for libtorrent tracker_error_alert"""
|
||||||
error_message = decode_string(alert.msg)
|
error_message = decode_string(alert.msg)
|
||||||
|
# If alert.msg is empty then it's a '-1' code so fallback to a.e.message. Note that alert.msg
|
||||||
|
# cannot be replaced by a.e.message because the code is included in the string (for non-'-1').
|
||||||
if not error_message:
|
if not error_message:
|
||||||
# alert.msg empty for '-1' code so fallback to a.e.message(), alert.msg cannot be replaced
|
|
||||||
# by a.e.message() because with non '-1' codes, the code is in the message.
|
|
||||||
error_message = decode_string(alert.error.message())
|
error_message = decode_string(alert.error.message())
|
||||||
log.debug("Tracker Error Alert: %s [%s]", decode_string(alert.message()), error_message)
|
log.debug("Tracker Error Alert: %s [%s]", decode_string(alert.message()), error_message)
|
||||||
try:
|
try:
|
||||||
torrent = self.torrents[str(alert.handle.info_hash())]
|
torrent = self.torrents[str(alert.handle.info_hash())]
|
||||||
except (RuntimeError, KeyError):
|
except (RuntimeError, KeyError):
|
||||||
return
|
return
|
||||||
|
|
||||||
torrent.set_tracker_status("Error: " + error_message)
|
torrent.set_tracker_status("Error: " + error_message)
|
||||||
|
|
||||||
def on_alert_storage_moved(self, alert):
|
def on_alert_storage_moved(self, alert):
|
||||||
|
|
|
@ -49,7 +49,7 @@ from os.path import sep as dirsep
|
||||||
|
|
||||||
STATUS_KEYS = ["state",
|
STATUS_KEYS = ["state",
|
||||||
"download_location",
|
"download_location",
|
||||||
"tracker",
|
"tracker_host",
|
||||||
"tracker_status",
|
"tracker_status",
|
||||||
"next_announce",
|
"next_announce",
|
||||||
"name",
|
"name",
|
||||||
|
@ -350,7 +350,7 @@ class Command(BaseCommand):
|
||||||
s += " {!info!}Active: {!input!}%s" % format_time(status["active_time"])
|
s += " {!info!}Active: {!input!}%s" % format_time(status["active_time"])
|
||||||
self.console.write(s)
|
self.console.write(s)
|
||||||
|
|
||||||
s = "{!info!}Tracker: {!input!}%s" % status["tracker"]
|
s = "{!info!}Tracker: {!input!}%s" % status["tracker_host"]
|
||||||
self.console.write(s)
|
self.console.write(s)
|
||||||
|
|
||||||
self.console.write("{!info!}Tracker status: {!input!}%s" % status["tracker_status"])
|
self.console.write("{!info!}Tracker status: {!input!}%s" % status["tracker_status"])
|
||||||
|
|
|
@ -111,7 +111,7 @@ class StatusTab(Tab):
|
||||||
(builder.get_object("progressbar"), fpcnt, ("progress",)),
|
(builder.get_object("progressbar"), fpcnt, ("progress",)),
|
||||||
(builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)),
|
(builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)),
|
||||||
(builder.get_object("summary_torrent_status"), str, ("message",)),
|
(builder.get_object("summary_torrent_status"), str, ("message",)),
|
||||||
(builder.get_object("summary_tracker"), None, ("tracker",)),
|
(builder.get_object("summary_tracker"), None, ("tracker_host",)),
|
||||||
]
|
]
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
@ -132,7 +132,7 @@ class StatusTab(Tab):
|
||||||
"upload_payload_rate", "max_upload_speed", "num_peers", "num_seeds", "total_peers",
|
"upload_payload_rate", "max_upload_speed", "num_peers", "num_seeds", "total_peers",
|
||||||
"total_seeds", "eta", "ratio", "tracker_status", "next_announce", "active_time",
|
"total_seeds", "eta", "ratio", "tracker_status", "next_announce", "active_time",
|
||||||
"seeding_time", "seed_rank", "is_auto_managed", "progress", "last_seen_complete",
|
"seeding_time", "seed_rank", "is_auto_managed", "progress", "last_seen_complete",
|
||||||
"message", "tracker"
|
"message", "tracker_host"
|
||||||
]
|
]
|
||||||
if self.config['show_piecesbar']:
|
if self.config['show_piecesbar']:
|
||||||
status_keys.extend(["pieces", "state", "num_pieces"])
|
status_keys.extend(["pieces", "state", "num_pieces"])
|
||||||
|
|
|
@ -91,7 +91,7 @@ Deluge.Keys = {
|
||||||
*/
|
*/
|
||||||
Details: [
|
Details: [
|
||||||
'name', 'download_location', 'total_size', 'num_files', 'message',
|
'name', 'download_location', 'total_size', 'num_files', 'message',
|
||||||
'tracker', 'comment'
|
'tracker_host', 'comment'
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
|
||||||
this.addItem('files', _('Total Files'));
|
this.addItem('files', _('Total Files'));
|
||||||
this.addItem('comment', _('Comment'));
|
this.addItem('comment', _('Comment'));
|
||||||
this.addItem('status', _('Status'));
|
this.addItem('status', _('Status'));
|
||||||
this.addItem('tracker', _('Tracker'));
|
this.addItem('tracker_host', _('Tracker'));
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function(ct, position) {
|
onRender: function(ct, position) {
|
||||||
|
|
Loading…
Reference in New Issue