edl integration work

This commit is contained in:
Sundog Jones 2024-09-17 09:46:32 -04:00
parent 8dd54ce801
commit 582464c6f7

View File

@ -513,12 +513,22 @@
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 // populate EDL if it exists
const thisRowEDL = media_item_element.getAttribute("data-edl-definition"); const thisRowEDL = media_item_element.getAttribute("data-edl-definition");
if (thisRowEDL && thisRowEDL !== "") { if (thisRowEDL && thisRowEDL !== "") {
edl = JSON.parse(thisRowEDL); edl = JSON.parse(thisRowEDL);
console.log("Parsed EDL:"); edl.inserts.forEach((insert) => {
console.dir(edl); const current_timecode = insert;
const template = document.getElementById("media_item_edl_insert_listitem");
const template_clone = template.content.cloneNode(true);
const formatted_timestamp = secs_to_human_duration(current_timecode);
template_clone.querySelector('input[name="media_item_edl_insert"]').value = formatted_timestamp;
template_clone.firstElementChild.setAttribute('data-timestamp', current_timecode);
const target = document.querySelector("#media_item_edl_outpoint_listitem");
const parent = document.querySelector("#media_item_edl_list");
parent.insertBefore(template_clone, target);
});
sort_inserts();
} }
target.innerHTML = ""; target.innerHTML = "";