from flask import Flask, request, render_template, make_response, redirect

app = Flask(__name__)
app.config["TEMPLATES_AUTO_RELOAD"] = True

import command

@app.route("/")
def index():
    return render_template("index.html")

@app.route("/tv/<cmd>")
def action_tv(cmd):
    command.send_code(cmd, "tv")
    #return redirect("/", code=307)
    return "<p>Sent '{0}'</p>".format(cmd)

@app.route("/mb/<cmd>")
def action_mb(cmd):
    command.send_code(cmd, "mb")
    #return redirect("/", code=307)
    return "<p>Sent '{0}'</p>".format(cmd)
