thrimbletrimmer: Misc cleanup

pull/116/head
Mike Lang 5 years ago
parent 93fc202394
commit b0ea790407

@ -4,7 +4,7 @@ pageSetup = function() {
//Get values from ThrimShim //Get values from ThrimShim
if(/id=/.test(document.location.search)) { if(/id=/.test(document.location.search)) {
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1]; var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
fetch("/thrimshim/"+rowId).then(data => data.json()).then(function (data) { fetch("/thrimshim/"+rowId).then(data => data.json()).then(function (data) {
if (!data) { if (!data) {
alert("No video available for stream."); alert("No video available for stream.");
return; return;
@ -32,7 +32,7 @@ pageSetup = function() {
var startOfHour = new Date(new Date().setMinutes(0,0,0)); var startOfHour = new Date(new Date().setMinutes(0,0,0));
document.getElementById("StreamStart").value = new Date(startOfHour.getTime() - 1000*60*60).toISOString().substring(0,19); document.getElementById("StreamStart").value = new Date(startOfHour.getTime() - 1000*60*60).toISOString().substring(0,19);
document.getElementById("StreamEnd").value = startOfHour.toISOString().substring(0,19); document.getElementById("StreamEnd").value = startOfHour.toISOString().substring(0,19);
loadPlaylist(); loadPlaylist();
} }
}; };
@ -79,7 +79,7 @@ loadPlaylist = function(startTrim, endTrim) {
//Get quality levels for advanced properties. //Get quality levels for advanced properties.
document.getElementById('qualityLevel').innerHTML = ""; document.getElementById('qualityLevel').innerHTML = "";
fetch('/files/' + document.getElementById('StreamName').value).then(data => data.json()).then(function (data) { fetch('/files/' + document.getElementById('StreamName').value).then(data => data.json()).then(function (data) {
if (!data.length) { if (!data.length) {
console.log("Could not retrieve quality levels"); console.log("Could not retrieve quality levels");
return; return;
@ -136,20 +136,18 @@ thrimbletrimmerSubmit = function(state) {
}; };
thrimbletrimmerDownload = function() { thrimbletrimmerDownload = function() {
document.getElementById('SubmitButton').disabled = true;
if(player.trimmingControls().options.startTrim >= player.trimmingControls().options.endTrim) { if(player.trimmingControls().options.startTrim >= player.trimmingControls().options.endTrim) {
alert("End Time must be greater than Start Time"); alert("End Time must be greater than Start Time");
document.getElementById('SubmitButton').disabled = false;
} else { } else {
var discontinuities = mapDiscontinuities(); var discontinuities = mapDiscontinuities();
var downloadStart = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.startTrim); var downloadStart = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.startTrim);
var downloadEnd = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.endTrim); var downloadEnd = getRealTimeForPlayerTime(discontinuities, player.trimmingControls().options.endTrim);
var targetURL = "/cut/" + document.getElementById("StreamName").value + var targetURL = "/cut/" + document.getElementById("StreamName").value +
"/"+document.getElementById('qualityLevel').options[document.getElementById('qualityLevel').options.selectedIndex].value+".ts" + "/"+document.getElementById('qualityLevel').options[document.getElementById('qualityLevel').options.selectedIndex].value+".ts" +
"?start=" + downloadStart + "?start=" + downloadStart +
"&end=" + downloadEnd + "&end=" + downloadEnd +
"&allow_holes=" + String(document.getElementById('AllowHoles').checked); "&allow_holes=" + String(document.getElementById('AllowHoles').checked);
console.log(targetURL); console.log(targetURL);
document.getElementById('outputFile').src = targetURL; document.getElementById('outputFile').src = targetURL;

Loading…
Cancel
Save