From efffc35f30794b37604408ca3ef9b6a54eff63ed Mon Sep 17 00:00:00 2001 From: Sundog Date: Tue, 17 Sep 2024 10:27:56 -0400 Subject: [PATCH] edl integration work --- edl.php | 4 ++-- layout.html | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/edl.php b/edl.php index 10cbbab..e3f3274 100755 --- a/edl.php +++ b/edl.php @@ -17,12 +17,12 @@ if (isset($_REQUEST['media_id']) && $_REQUEST['media_id'] !== "") { if ($result) { // record exists - if (isset($_REQUEST['id'])) { + if (isset($_REQUEST['edl_id'])) { // update $update_query = $db->prepare("UPDATE media_edls SET edl_name = :edl_name, edl_definition = :edl_definition WHERE id = :id"); $update_query->bindValue(':edl_name', $_REQUEST['edl_name']); $update_query->bindValue(':edl_definition', $_REQUEST['edl_definition']); - $update_query->bindValue(':id', $_REQUEST['id']); + $update_query->bindValue(':id', $_REQUEST['edl_id']); } else { // insert $update_query = $db->prepare("INSERT INTO media_edls (media_id, edl_name, edl_definition) VALUES (:media_id, :edl_name, :edl_definition)"); diff --git a/layout.html b/layout.html index dd46bf1..a2a737b 100755 --- a/layout.html +++ b/layout.html @@ -604,13 +604,15 @@ edl_definition.outpoint = outpoint || document.querySelector("#media_library_details > .media_item_details").getAttribute("data-duration"); edl_definition.inserts = []; const list_parent = document.querySelector("#media_item_edl_list"); - + const edl_id = list_parent.getAttribute("data-edl-id") || null; + const edl_name = list_parent.getAttribute("data-edl-name") || null; const current_items = list_parent.querySelectorAll("li.media_item_edl_insert"); current_items.forEach((insertPoint) => { edl_definition.inserts.push(insertPoint.getAttribute("data-timestamp")); }); payload.edl_definition = JSON.stringify(edl_definition); - payload.edl_name = "default"; // TODO: handle multiple EDLs per media file later! + payload.edl_name = edl_name || "default"; // TODO: handle this better once we have multiple EDL support + if (edl_id) payload.edl_id = edl_id; console.log("preparing to save edl:"); console.dir(payload); fetch(api_url, {