edl integration work

This commit is contained in:
Sundog Jones 2024-09-17 09:41:07 -04:00
parent 17848110cf
commit a4bd80fa3c

View File

@ -476,7 +476,8 @@
console.dir(row['edl_definition']); console.dir(row['edl_definition']);
const edl = JSON.parse(row['edl_definition']); const edl = JSON.parse(row['edl_definition']);
thisRow.setAttribute("data-inpoint", edl.inpoint); thisRow.setAttribute("data-inpoint", edl.inpoint);
thisRow.setAttribute("data-outpoint", edl.outpoint) thisRow.setAttribute("data-outpoint", edl.outpoint);
thisRow.setAttribute("data-edl-definition");
} else { } else {
// no EDL yet, use start as inpoint and duration as outpoint // no EDL yet, use start as inpoint and duration as outpoint
thisRow.setAttribute("data-inpoint", 0); thisRow.setAttribute("data-inpoint", 0);
@ -504,13 +505,22 @@
template_clone.querySelector('input[name="description"]').value = media_item_element.getAttribute("data-description"); template_clone.querySelector('input[name="description"]').value = media_item_element.getAttribute("data-description");
template_clone.querySelector('input[name="season"]').value = media_item_element.getAttribute("data-season"); template_clone.querySelector('input[name="season"]').value = media_item_element.getAttribute("data-season");
template_clone.querySelector('input[name="episode_number"]').value = media_item_element.getAttribute("data-episode-number"); template_clone.querySelector('input[name="episode_number"]').value = media_item_element.getAttribute("data-episode-number");
// TODO: fetch related EDLs from API here
const formatted_inpoint = new Date(media_item_element.getAttribute("data-inpoint") * 1000).toISOString().substring(11, 19); const formatted_inpoint = new Date(media_item_element.getAttribute("data-inpoint") * 1000).toISOString().substring(11, 19);
const formatted_outpoint = new Date(media_item_element.getAttribute("data-outpoint") * 1000).toISOString().substring(11, 19); const formatted_outpoint = new Date(media_item_element.getAttribute("data-outpoint") * 1000).toISOString().substring(11, 19);
template_clone.querySelector('input[name="media_item_edl_inpoint"]').value = formatted_inpoint; template_clone.querySelector('input[name="media_item_edl_inpoint"]').value = formatted_inpoint;
template_clone.querySelector('input[name="media_item_edl_outpoint"]').value = formatted_outpoint; template_clone.querySelector('input[name="media_item_edl_outpoint"]').value = formatted_outpoint;
template_clone.firstElementChild.setAttribute("data-duration", media_item_element.getAttribute("data-duration")); template_clone.firstElementChild.setAttribute("data-duration", media_item_element.getAttribute("data-duration"));
template_clone.firstElementChild.setAttribute("data-media-id", media_item_element.getAttribute("data-id")); template_clone.firstElementChild.setAttribute("data-media-id", media_item_element.getAttribute("data-id"));
// TODO: populate EDL if it exists
const thisRowEDL = media_item_element.getAttribute("data-edl-definition");
if (thisRowEDL && thisRowEDL !== "") {
edl = JSON.parse(thisRowEDL);
console.log("Parsed EDL:");
console.dir(edl);
}
target.innerHTML = ""; target.innerHTML = "";
target.appendChild(template_clone); target.appendChild(template_clone);
fetch_item_tags(item_id); fetch_item_tags(item_id);