Fix #146
This commit is contained in:
parent
622a0053d8
commit
c012427edc
|
@ -244,12 +244,20 @@ class Torrent:
|
||||||
client = str(peer.client).decode("utf-8")
|
client = str(peer.client).decode("utf-8")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
client = str(peer.client).decode("latin-1")
|
client = str(peer.client).decode("latin-1")
|
||||||
|
|
||||||
|
# Make country a proper string
|
||||||
|
country = str()
|
||||||
|
for c in peer.country:
|
||||||
|
if not c.isalpha():
|
||||||
|
country += " "
|
||||||
|
else:
|
||||||
|
country += c
|
||||||
|
|
||||||
ret.append({
|
ret.append({
|
||||||
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
|
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
|
||||||
"up_speed": peer.up_speed,
|
"up_speed": peer.up_speed,
|
||||||
"down_speed": peer.down_speed,
|
"down_speed": peer.down_speed,
|
||||||
"country": deluge.xmlrpclib.Binary(peer.country),
|
"country": country,
|
||||||
"client": client,
|
"client": client,
|
||||||
"seed": peer.flags & peer.seed
|
"seed": peer.flags & peer.seed
|
||||||
})
|
})
|
||||||
|
|
|
@ -217,10 +217,9 @@ class PeersTab:
|
||||||
client.get_torrent_status(self._on_get_torrent_status, torrent_id, ["peers"])
|
client.get_torrent_status(self._on_get_torrent_status, torrent_id, ["peers"])
|
||||||
|
|
||||||
def get_flag_pixbuf(self, country):
|
def get_flag_pixbuf(self, country):
|
||||||
country = str(country)
|
if country == " ":
|
||||||
if not country.isalpha():
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not self.cached_flag_pixbufs.has_key(country):
|
if not self.cached_flag_pixbufs.has_key(country):
|
||||||
# We haven't created a pixbuf for this country yet
|
# We haven't created a pixbuf for this country yet
|
||||||
try:
|
try:
|
||||||
|
@ -266,13 +265,14 @@ class PeersTab:
|
||||||
# Create an int IP address for sorting purposes
|
# Create an int IP address for sorting purposes
|
||||||
ip_int = sum([int(byte) << shift
|
ip_int = sum([int(byte) << shift
|
||||||
for byte, shift in izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
|
for byte, shift in izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))])
|
||||||
|
|
||||||
if peer["seed"]:
|
if peer["seed"]:
|
||||||
icon = self.seed_pixbuf
|
icon = self.seed_pixbuf
|
||||||
else:
|
else:
|
||||||
icon = self.peer_pixbuf
|
icon = self.peer_pixbuf
|
||||||
|
|
||||||
row = self.liststore.append([
|
row = self.liststore.append([
|
||||||
self.get_flag_pixbuf(peer["country"]),
|
self.get_flag_pixbuf(peer["country"]),
|
||||||
peer["ip"],
|
peer["ip"],
|
||||||
peer["client"],
|
peer["client"],
|
||||||
peer["down_speed"],
|
peer["down_speed"],
|
||||||
|
|
Loading…
Reference in New Issue