]> git.ipfire.org Git - ipfire.org.git/commitdiff
Fix tracker.ipfire.org.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 May 2014 19:15:06 +0000 (21:15 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 10 May 2014 19:15:06 +0000 (21:15 +0200)
templates/tracker-torrent-detail.html
templates/tracker-torrents.html
webapp/backend/releases.py
webapp/handlers_tracker.py
webapp/ui_modules.py

index 47072f89f3351493d93dd08ab4a6efa006501dae..0bdff532ae96f7f573a4c9bc0dc57cc29534ef39 100644 (file)
        </p>
 
        {% if peers %}
-               <h3>{{ _("Peers") }}</h3>
-               {% module TrackerPeerList(peers, percentages=True) %}
-       {% end %}
-
-       {% if seeds %}
-               <h3>{{ _("Seeds") }}</h3>
-               {% module TrackerPeerList(seeds) %}
+               <h3>{{ _("Peers & Seeds") }}</h3>
+               {% module TrackerPeerList(peers) %}
        {% end %}
 {% end block %}
index e9d0613f11c7284c24587adf4116624222612c06..96c03d7dd349596c91db333195fc07974460870d 100644 (file)
                                                        <a href="/{{ torrent.torrent_hash }}">{{ torrent.basename }}</a>
                                                </td>
                                                <td>
-                                                       {{ len(torrent.seeders) }}
+                                                       {{ torrent.seeders }}
                                                </td>
                                                <td>
-                                                       {{ len(torrent.peers) }}
+                                                       {{ torrent.peers }}
                                                </td>
                                                <td>
                                                        <a href="{{ torrent.magnet_link }}">
index 5da6c62b652eaf474b62cc2488a6ef2c9f089d47..c3b42d921584c62b5486b4c21d0eb0b50e96f6ac 100644 (file)
@@ -201,14 +201,14 @@ class File(Object):
                if not self.torrent_hash:
                        return
 
-               return self.tracker.get_seeds(self.torrent_hash)
+               return self.backend.tracker.complete(self.torrent_hash)
 
        @property
        def peers(self):
                if not self.torrent_hash:
                        return
 
-               return self.tracker.get_peers(self.torrent_hash)
+               return self.backend.tracker.incomplete(self.torrent_hash)
 
 
 class Release(Object):
index 3a1fd4978554a385bd8e97ddee18aa1379c90e7a..ba2f6618e35a7270abd33bd84b575890ac816166 100644 (file)
@@ -25,10 +25,9 @@ class TrackerDetailHandler(BaseHandler):
                        raise tornado.web.HTTPError(404, "Could not find torrent file for hash: %s" % torrent_hash)
 
                peers = self.tracker.get_peers(torrent_hash)
-               seeds = self.tracker.get_seeds(torrent_hash)
 
                self.render("tracker-torrent-detail.html", release=file.release,
-                       file=file, peers=peers, seeds=seeds)
+                       file=file, peers=peers)
 
 
 class TrackerDownloadHandler(BaseHandler):
index 7433134af7953ccf31143f8367f5cbd9e42bd411..433ea68ca2a9fdf85c0dc66c30cd3ff6e6d8ebbc 100644 (file)
@@ -228,10 +228,12 @@ class PlanetEntryModule(UIModule):
 
 
 class TrackerPeerListModule(UIModule):
-       def render(self, peers, percentages=False):
+       def render(self, peers):
                # Guess country code and hostname of the host
                for peer in peers:
-                       country_code = backend.GeoIP().get_country(peer["ip"])
+                       country_code = self.geoip.get_country(peer["ip"])
+                       if country_code:
+                               country_code = country_code.lower()
                        peer["country_code"] = country_code or "unknown"
 
                        try:
@@ -240,7 +242,7 @@ class TrackerPeerListModule(UIModule):
                                peer["hostname"] = ""
 
                return self.render_string("modules/tracker-peerlist.html",
-                       peers=[Row(p) for p in peers], percentages=percentages)
+                       peers=[Row(p) for p in peers])
 
 
 class StasyTableModule(UIModule):