Pass a list of upload locations from thrimshim to thrimbletrimmer

with the first one being the default.
pull/116/head
Mike Lang 5 years ago
parent b11fe39371
commit da3cc24ed1

@ -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,

@ -62,7 +62,7 @@
</tr>
<tr><td>Allow Holes: </td><td><input id="AllowHoles" type="checkbox" /></td></tr>
<tr><td>Quality Level: </td><td><select id="qualityLevel"></select></td></tr>
<tr><td>Upload Location: </td><td><select id="uploadLocation"><option value="YouTube" selected>YouTube</option></select></td></tr>
<tr><td>Upload Location: </td><td><select id="uploadLocation"></select></td></tr>
<tr><td>Uploader Whitelist: </td><td><input id="uploaderWhitelist" title="Uploader Whitelist" /></td></tr>
<tr>
<td>ThrimShim ID:</td>

@ -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 += '<option value="'+option+'" '+(index==0 ? 'selected':'')+'>'+option+'</option>';
});
}
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 += '<option value="'+level+'" '+(index==0 ? 'selected':'')+'>'+level+'</option>';
});
setOptions('qualityLevel', qualityLevels);
});
};

@ -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():

Loading…
Cancel
Save