diff --git a/layout.html b/layout.html index 58638b2..3be541f 100755 --- a/layout.html +++ b/layout.html @@ -513,12 +513,22 @@ 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")); - // TODO: populate EDL if it exists + // 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); + edl.inserts.forEach((insert) => { + 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 = "";