Add tracklisting options UI.

This commit is contained in:
Matthew Stratford 2021-04-22 23:14:55 +01:00
parent 669489068a
commit 1a7a57e4bb
2 changed files with 17 additions and 0 deletions

View file

@ -33,6 +33,18 @@
<br>
<label for="myradio_api_key">MyRadio API Key:</label>
<input type="text" id="myradio_api_key" name="myradio_api_key" class="form-control" placeholder="Hidden ({% if data.state.myradio_api_key %}value set, type to replace{% else %}value not set yet{% endif %})" value="">
<br>
<label for="myradio_api_tracklist_source">Tracklist Source ID (char):</label>
<input type="text" id="myradio_api_tracklist_source" name="myradio_api_tracklist_source" class="form-control" value="{{data.state.myradio_api_tracklist_source}}">
<br>
<label for="serial_port">Tracklist Mode:</label>
<select class="form-control" name="tracklist_mode">
<label>Modes</label>
{% for mode in data.tracklist_modes %}
<option value="{{mode}}" {% if mode == data.state.tracklist_mode %}selected{% endif %}>{{ mode.capitalize() }}</option>
{% endfor %}
</select>
<p><small>Delayed tracklisting is 20s, to account for cueing with fader down.</small></p>
<hr>
<input type="submit" class="btn btn-primary" value="Save & Restart Server">
</form>

View file

@ -97,12 +97,15 @@ def ui_config_server(request):
"ui_title": "Server Config",
"state": server_state.get(),
"ser_ports": DeviceManager.getSerialPorts(),
"tracklist_modes": ["off", "on", "delayed"]
}
return render_template("config_server.html", data=data)
@app.route("/config/server/update", methods=["POST"])
def ui_config_server_update(request):
# TODO Validation!
server_state.update("server_name", request.form.get("name"))
server_state.update("host", request.form.get("host"))
server_state.update("port", int(request.form.get("port")))
@ -116,6 +119,8 @@ def ui_config_server_update(request):
server_state.update("myradio_base_url", request.form.get("myradio_base_url"))
server_state.update("myradio_api_url", request.form.get("myradio_api_url"))
server_state.update("myradio_api_tracklist_source", request.form.get("myradio_api_tracklist_source"))
server_state.update("tracklist_mode", request.form.get("tracklist_mode"))
return redirect("/restart")