diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 65811f0a3..9c2e875d3 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -244,12 +244,20 @@ class Torrent: client = str(peer.client).decode("utf-8") except UnicodeDecodeError: 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({ "ip": "%s:%s" % (peer.ip[0], peer.ip[1]), "up_speed": peer.up_speed, "down_speed": peer.down_speed, - "country": deluge.xmlrpclib.Binary(peer.country), + "country": country, "client": client, "seed": peer.flags & peer.seed }) diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index c523f3f90..d2e812e0c 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -217,10 +217,9 @@ class PeersTab: client.get_torrent_status(self._on_get_torrent_status, torrent_id, ["peers"]) def get_flag_pixbuf(self, country): - country = str(country) - if not country.isalpha(): + if country == " ": return None - + if not self.cached_flag_pixbufs.has_key(country): # We haven't created a pixbuf for this country yet try: @@ -266,13 +265,14 @@ class PeersTab: # Create an int IP address for sorting purposes ip_int = sum([int(byte) << shift for byte, shift in izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))]) + if peer["seed"]: icon = self.seed_pixbuf else: icon = self.peer_pixbuf row = self.liststore.append([ - self.get_flag_pixbuf(peer["country"]), + self.get_flag_pixbuf(peer["country"]), peer["ip"], peer["client"], peer["down_speed"],