tracker stats added
This commit is contained in:
parent
e013d79e6e
commit
b80d3b989a
|
@ -20,6 +20,7 @@ signal.signal(signal.SIGINT, rtorrent.stop_watch)
|
||||||
def index():
|
def index():
|
||||||
"""The index page."""
|
"""The index page."""
|
||||||
torrents = rtorrent.get_active()
|
torrents = rtorrent.get_active()
|
||||||
|
tracker_stats = rtorrent.get_stats()
|
||||||
return render_template("index.html", **locals())
|
return render_template("index.html", **locals())
|
||||||
|
|
||||||
@app.route("/static/<path:path>")
|
@app.route("/static/<path:path>")
|
||||||
|
|
|
@ -119,3 +119,11 @@ def get_active():
|
||||||
"""Returns all actively seeding or leeching torrents."""
|
"""Returns all actively seeding or leeching torrents."""
|
||||||
active = [t for t in all_torrents() if t.downrate or t.uprate]
|
active = [t for t in all_torrents() if t.downrate or t.uprate]
|
||||||
return active
|
return active
|
||||||
|
|
||||||
|
def get_stats():
|
||||||
|
"""Returns various statistical information about the torrents."""
|
||||||
|
trackers = [t.tracker for t in all_torrents()]
|
||||||
|
tracker_stats = {tr: trackers.count(tr) for tr in set(trackers)}
|
||||||
|
tracker_stats = dict(sorted(tracker_stats.items()))
|
||||||
|
tracker_stats['total'] = len(trackers)
|
||||||
|
return tracker_stats
|
||||||
|
|
|
@ -32,5 +32,13 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<table id="tracker_stats">
|
||||||
|
{% for tracker, count in tracker_stats.items() %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ tracker }}</td>
|
||||||
|
<td>{{ count }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user