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"}, desertbus: {type: "youtube"},
unlisted: {type: "youtube", hidden: true, no_transcode_check: true}, unlisted: {type: "youtube", hidden: true, no_transcode_check: true},
}, },
default_location:: "desertbus",
// Fixed tags to add to all videos // 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"], 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), "--backdoor-port", std.toString($.backdoor_port),
"--title-header", $.title_header, "--title-header", $.title_header,
"--description-footer", $.description_footer, "--description-footer", $.description_footer,
"--upload-locations", std.join(",", [$.default_location] + [
location for location in std.objectFields($.cutter_config)
if location != $.default_location
]),
$.db_connect, $.db_connect,
$.channel, $.channel,
$.bustime_start, $.bustime_start,

@ -62,7 +62,7 @@
</tr> </tr>
<tr><td>Allow Holes: </td><td><input id="AllowHoles" type="checkbox" /></td></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>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>Uploader Whitelist: </td><td><input id="uploaderWhitelist" title="Uploader Whitelist" /></td></tr>
<tr> <tr>
<td>ThrimShim ID:</td> <td>ThrimShim ID:</td>

@ -23,6 +23,8 @@ pageSetup = function() {
document.getElementById("VideoTitle").value = data.video_title ? data.video_title : data.description; document.getElementById("VideoTitle").value = data.video_title ? data.video_title : data.description;
document.getElementById("VideoDescription").value = data.video_description ? data.video_description : 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); loadPlaylist(data.video_start, data.video_end);
}); });
} }
@ -63,6 +65,13 @@ setStreamRange = function() {
document.getElementById("StreamEnd").value = bustimeToTimestamp(document.getElementById("BusTimeEnd").value); 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) { loadPlaylist = function(startTrim, endTrim) {
var playlist = "/playlist/" + document.getElementById("StreamName").value + ".m3u8"; var playlist = "/playlist/" + document.getElementById("StreamName").value + ".m3u8";
@ -85,9 +94,7 @@ loadPlaylist = function(startTrim, endTrim) {
return; return;
} }
var qualityLevels = data.sort().reverse(); var qualityLevels = data.sort().reverse();
qualityLevels.forEach(function(level, index) { setOptions('qualityLevel', qualityLevels);
document.getElementById('qualityLevel').innerHTML += '<option value="'+level+'" '+(index==0 ? 'selected':'')+'>'+level+'</option>';
});
}); });
}; };

@ -147,6 +147,7 @@ def get_row(ident):
response["title_prefix"] = app.title_header response["title_prefix"] = app.title_header
response["title_max_length"] = MAX_TITLE_LENGTH - len(app.title_header) response["title_max_length"] = MAX_TITLE_LENGTH - len(app.title_header)
response["bustime_start"] = app.bustime_start 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 # remove any added headers or footers so round-tripping is a no-op
if ( if (
@ -308,8 +309,9 @@ def reset_row(ident, editor=None):
@argh.arg('--no-authentication', help='Do not authenticate') @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('--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('--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, 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.""" """Thrimshim service."""
server = WSGIServer((host, port), cors(app)) 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.bustime_start = bustime_start
app.title_header = "" if title_header is None else "{} - ".format(title_header) 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.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() stopping = gevent.event.Event()
def stop(): def stop():

Loading…
Cancel
Save