Poll for the seam report now that measuring runs in the background
This commit is contained in:
parent
78689c7014
commit
2b611917be
1 changed files with 45 additions and 3 deletions
48
script.html
48
script.html
|
|
@ -507,12 +507,54 @@ async function bindFilm(p) {
|
||||||
|
|
||||||
function bindPost() {
|
function bindPost() {
|
||||||
var sb = document.getElementById("seams");
|
var sb = document.getElementById("seams");
|
||||||
|
function paintSeams(r) {
|
||||||
|
var el = document.getElementById("seamout");
|
||||||
|
if (!el) return;
|
||||||
|
el.innerHTML = '<p class="foot" style="margin:0 0 8px">' + esc(r.status_text || "") + '</p>'
|
||||||
|
+ (r.seams || []).map(function (x) {
|
||||||
|
var col = x.verdict === "smooth" ? "var(--good)"
|
||||||
|
: (x.verdict === "visible" ? "var(--accent2)" : "var(--bad)");
|
||||||
|
return '<div class="foot" style="padding:6px 0;border-top:1px solid var(--line)">'
|
||||||
|
+ 'shot ' + x.after_shot + ' → ' + x.before_shot + ' at ' + x.at_seconds + 's · '
|
||||||
|
+ 'shift ' + x.shift_x + ',' + x.shift_y + ' · drift ' + x.drift + ' · '
|
||||||
|
+ '<span style="color:' + col + '">' + esc(x.verdict) + '</span>'
|
||||||
|
+ (x.recommend_broll ? ' · worth a cutaway' : '')
|
||||||
|
+ '</div>';
|
||||||
|
}).join("");
|
||||||
|
}
|
||||||
|
|
||||||
if (sb) sb.onclick = async function () {
|
if (sb) sb.onclick = async function () {
|
||||||
sb.disabled = true; sb.textContent = "Measuring…";
|
sb.disabled = true; sb.textContent = "Measuring…";
|
||||||
var r = await api("seam_report", { email: email, project_id: pid });
|
|
||||||
sb.disabled = false; sb.textContent = "Measure the joins";
|
|
||||||
var el = document.getElementById("seamout");
|
var el = document.getElementById("seamout");
|
||||||
if (!r.ok) { showMsg("msg", r.error || "Could not measure."); return; }
|
var r = await api("seam_report", { email: email, project_id: pid });
|
||||||
|
if (!r.ok) {
|
||||||
|
sb.disabled = false; sb.textContent = "Measure the joins";
|
||||||
|
showMsg("msg", r.error || "Could not measure.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Measuring downloads every shot and searches each join for the best
|
||||||
|
// alignment, which is far too slow to answer inside one request.
|
||||||
|
if (r.pending) {
|
||||||
|
el.innerHTML = '<p class="foot">' + esc(r.status_text || "Measuring…") + '</p>';
|
||||||
|
var waited = 0;
|
||||||
|
var t = setInterval(async function () {
|
||||||
|
waited += 4;
|
||||||
|
var g = await api("seam_report", { email: email, project_id: pid });
|
||||||
|
if (g.ok && !g.pending) {
|
||||||
|
clearInterval(t);
|
||||||
|
sb.disabled = false; sb.textContent = "Measure the joins";
|
||||||
|
paintSeams(g);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (waited > 180) {
|
||||||
|
clearInterval(t);
|
||||||
|
sb.disabled = false; sb.textContent = "Measure the joins";
|
||||||
|
showMsg("msg", "Measuring is taking unusually long.");
|
||||||
|
}
|
||||||
|
}, 4000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sb.disabled = false; sb.textContent = "Measure the joins";
|
||||||
if (!r.seams || !r.seams.length) {
|
if (!r.seams || !r.seams.length) {
|
||||||
el.innerHTML = '<p class="foot">' + esc(r.status_text || "Nothing to measure.") + '</p>';
|
el.innerHTML = '<p class="foot">' + esc(r.status_text || "Nothing to measure.") + '</p>';
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue