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():
|
||||
"""The index page."""
|
||||
torrents = rtorrent.get_active()
|
||||
tracker_stats = rtorrent.get_stats()
|
||||
return render_template("index.html", **locals())
|
||||
|
||||
@app.route("/static/<path:path>")
|
||||
|
|
|
@ -119,3 +119,11 @@ def get_active():
|
|||
"""Returns all actively seeding or leeching torrents."""
|
||||
active = [t for t in all_torrents() if t.downrate or t.uprate]
|
||||
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 %}
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="tracker_stats">
|
||||
{% for tracker, count in tracker_stats.items() %}
|
||||
<tr>
|
||||
<td>{{ tracker }}</td>
|
||||
<td>{{ count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue
Block a user