Aberrant/aberrant.py
2019-01-16 12:49:42 -05:00

28 lines
668 B
Python

#!/usr/bin/env python3
"""
The primary module for serving the Aberrant application.
"""
from flask import Flask, render_template
import rtorrent
app = Flask(__name__)
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
app.jinja_env.undefined = "StrictUndefined"
@app.route("/")
def index():
"""The index page."""
return render_template("index.html", **locals())
@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())
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5250)