diff --git a/docker-compose.jsonnet b/docker-compose.jsonnet index 33d2f6e..d71d2de 100644 --- a/docker-compose.jsonnet +++ b/docker-compose.jsonnet @@ -94,6 +94,7 @@ desertbus: {type: "youtube"}, unlisted: {type: "youtube", hidden: true, no_transcode_check: true}, }, + default_location:: "desertbus", // Fixed tags to add to all videos video_tags:: ["DB13", "DB2019", "2019", "Desert Bus", "Desert Bus for Hope", "Child's Play Charity", "Child's Play", "Charity Fundraiser"], @@ -219,6 +220,10 @@ "--backdoor-port", std.toString($.backdoor_port), "--title-header", $.title_header, "--description-footer", $.description_footer, + "--upload-locations", std.join(",", [$.default_location] + [ + location for location in std.objectFields($.cutter_config) + if location != $.default_location + ]), $.db_connect, $.channel, $.bustime_start, diff --git a/thrimbletrimmer/index.html b/thrimbletrimmer/index.html index eea7623..33d1700 100644 --- a/thrimbletrimmer/index.html +++ b/thrimbletrimmer/index.html @@ -62,7 +62,7 @@ Allow Holes: Quality Level: - Upload Location: + Upload Location: Uploader Whitelist: ThrimShim ID: diff --git a/thrimbletrimmer/scripts/IO.js b/thrimbletrimmer/scripts/IO.js index 6edccf8..c0241a6 100644 --- a/thrimbletrimmer/scripts/IO.js +++ b/thrimbletrimmer/scripts/IO.js @@ -23,6 +23,8 @@ pageSetup = function() { document.getElementById("VideoTitle").value = data.video_title ? data.video_title : data.description; document.getElementById("VideoDescription").value = data.video_description ? data.video_description : data.description; + setOptions('uploadLocation', data.upload_locations); + loadPlaylist(data.video_start, data.video_end); }); } @@ -63,6 +65,13 @@ setStreamRange = function() { document.getElementById("StreamEnd").value = bustimeToTimestamp(document.getElementById("BusTimeEnd").value); } +// For a given select input element id, add the given list of options, defaulting to the first one. +setOptions = function(element, options) { + options.forEach(function(option, index) { + document.getElementById(element).innerHTML += ''; + }); +} + loadPlaylist = function(startTrim, endTrim) { var playlist = "/playlist/" + document.getElementById("StreamName").value + ".m3u8"; @@ -85,9 +94,7 @@ loadPlaylist = function(startTrim, endTrim) { return; } var qualityLevels = data.sort().reverse(); - qualityLevels.forEach(function(level, index) { - document.getElementById('qualityLevel').innerHTML += ''; - }); + setOptions('qualityLevel', qualityLevels); }); }; diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index a96e26e..4e69860 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -147,6 +147,7 @@ def get_row(ident): response["title_prefix"] = app.title_header response["title_max_length"] = MAX_TITLE_LENGTH - len(app.title_header) response["bustime_start"] = app.bustime_start + response["upload_locations"] = app.upload_locations # remove any added headers or footers so round-tripping is a no-op if ( @@ -308,8 +309,9 @@ def reset_row(ident, editor=None): @argh.arg('--no-authentication', help='Do not authenticate') @argh.arg('--title-header', help='A header to prefix all titles with, seperated from the submitted title by " - "') @argh.arg('--description-footer', help='A footer to suffix all descriptions with, seperated from the submitted description by a blank line.') +@argh.arg('--upload-locations', help='A comma-seperated list of valid upload locations, to pass to thrimbletrimmer. The first is the default. Note this is NOT validated on write.') def main(connection_string, default_channel, bustime_start, host='0.0.0.0', port=8004, backdoor_port=0, - no_authentication=False, title_header=None, description_footer=None): + no_authentication=False, title_header=None, description_footer=None, upload_locations=''): """Thrimshim service.""" server = WSGIServer((host, port), cors(app)) @@ -318,6 +320,7 @@ def main(connection_string, default_channel, bustime_start, host='0.0.0.0', port app.bustime_start = bustime_start app.title_header = "" if title_header is None else "{} - ".format(title_header) app.description_footer = "" if description_footer is None else "\n\n{}".format(description_footer) + app.upload_locations = upload_locations.split(',') if upload_locations else [] stopping = gevent.event.Event() def stop():