Aberrant/aberrant.py

28 lines
668 B
Python
Raw Normal View History

2019-01-16 09:33:36 -05:00
#!/usr/bin/env python3
"""
The primary module for serving the Aberrant application.
"""
from flask import Flask, render_template
2019-01-16 12:49:42 -05:00
import rtorrent
2019-01-16 09:33:36 -05:00
app = Flask(__name__)
2019-01-16 12:49:42 -05:00
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
app.jinja_env.undefined = "StrictUndefined"
2019-01-16 09:33:36 -05:00
@app.route("/")
def index():
"""The index page."""
return render_template("index.html", **locals())
2019-01-16 12:49:42 -05:00
@app.route("/active")
def active():
"""Displays all currently active torrents."""
torrents = rtorrent.get_active()
torrents = [rtorrent.get_info(t) for t in torrents]
return render_template("view.html", **locals())
2019-01-16 09:33:36 -05:00
if __name__ == "__main__":
2019-01-16 12:49:42 -05:00
app.run(host='0.0.0.0', port=5250)