From ca11e59511fa7b1e072a6311b67a9810c5399ea5 Mon Sep 17 00:00:00 2001 From: mg Date: Wed, 25 Sep 2019 17:23:31 -0300 Subject: [PATCH] Adding channel/start time info to Thrimshim to pass to Thrimbletrimmer. --- docker-compose.jsonnet | 2 ++ thrimbletrimmer/index.html | 2 +- thrimbletrimmer/scripts/IO.js | 5 +++-- thrimshim/thrimshim/main.py | 8 +++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docker-compose.jsonnet b/docker-compose.jsonnet index 337af51..0f3c71f 100644 --- a/docker-compose.jsonnet +++ b/docker-compose.jsonnet @@ -191,6 +191,8 @@ command: [ "--backdoor-port", std.toString($.backdoor_port), $.db_connect, + $.channel, + $.bustime_start, ] + if $.authentication then [] else ["--no-authentication"], // Mount the segments directory at /mnt volumes: ["%s:/mnt" % $.segments_path], diff --git a/thrimbletrimmer/index.html b/thrimbletrimmer/index.html index abd1ec9..154c682 100644 --- a/thrimbletrimmer/index.html +++ b/thrimbletrimmer/index.html @@ -40,7 +40,7 @@ - + diff --git a/thrimbletrimmer/scripts/IO.js b/thrimbletrimmer/scripts/IO.js index 75e8dc0..fe51219 100644 --- a/thrimbletrimmer/scripts/IO.js +++ b/thrimbletrimmer/scripts/IO.js @@ -1,5 +1,4 @@ -//var desertBusStart = new Date("1970-01-01T00:00:00Z"); -var desertBusStart = new Date("2019-09-20T18:00:00"); +var desertBusStart = new Date("1970-01-01T00:00:00Z"); pageSetup = function() { //Get values from ThrimShim @@ -11,6 +10,8 @@ pageSetup = function() { return; } //data = testThrimShim; + desertBusStart = new Date(data.bustime_start); + document.getElementById("StreamName").value = data.channel; document.getElementById("hiddenSubmissionID").value = data.id; document.getElementById("StreamName").value = data.video_channel ? data.video_channel:document.getElementById("StreamName").value; document.getElementById("StreamStart").value = data.event_start; diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index 70bb0e2..7e58a64 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -138,6 +138,8 @@ def get_row(ident): else value ) for key, value in response.items() } + response["channel"] = app.channel + response["bustime_start"] = app.bustime_start logging.info('Row {} fetched'.format(ident)) return json.dumps(response) @@ -268,14 +270,18 @@ def reset_row(ident, editor=None): @argh.arg('--host', help='Address or socket server will listen to. Default is 0.0.0.0 (everything on the local machine).') @argh.arg('--port', help='Port server will listen on. Default is 8004.') @argh.arg('connection-string', help='Postgres connection string, which is either a space-separated list of key=value pairs, or a URI like: postgresql://USER:PASSWORD@HOST/DBNAME?KEY=VALUE') +@argh.arg('channel', help='The channel this instance will serve events for') +@argh.arg('bustime_start', help='The start time in UTC for the event, for UTC-Bustime conversion') @argh.arg('--backdoor-port', help='Port for gevent.backdoor access. By default disabled.') @argh.arg('--no-authentication', help='Do not authenticate') -def main(connection_string, host='0.0.0.0', port=8004, backdoor_port=0, +def main(connection_string, channel, bustime_start, host='0.0.0.0', port=8004, backdoor_port=0, no_authentication=False): """Thrimshim service.""" server = WSGIServer((host, port), cors(app)) app.no_authentication = no_authentication + app.channel = channel + app.bustime_start = bustime_start stopping = gevent.event.Event() def stop():