diff --git a/edl.php b/edl.php index e36ea77..8841c99 100755 --- a/edl.php +++ b/edl.php @@ -17,16 +17,16 @@ if (isset($_REQUEST['media_id']) && $_REQUEST['media_id'] !== "") { // record exists if (isset($_REQUEST['id'])) { // update - $update_query = $db->prepare("UPDATE media_edls SET edl_name = :edl_name, edl_contents = :edl_contents WHERE id = :id"); + $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_contents', $_REQUEST['edl_contents']); + $update_query->bindValue(':edl_definition', $_REQUEST['edl_definition']); $update_query->bindValue(':id', $_REQUEST['id']); } else { // insert - $update_query = $db->prepare("INSERT INTO media_edls (media_id, edl_name, edl_contents) VALUES (:media_id, :edl_name, :edl_contents)"); + $update_query = $db->prepare("INSERT INTO media_edls (media_id, edl_name, edl_definition) VALUES (:media_id, :edl_name, :edl_definition)"); $update_query->bindValue(':media_id', $_REQUEST['id']); $update_query->bindValue(':edl_name', $_REQUEST['edl_name']); - $update_query->bindValue(':edl_contents', $_REQUEST['edl_contents']); + $update_query->bindValue(':edl_definition', $_REQUEST['edl_definition']); } error_log($update_query->getSQL(true)); $update_result = $update_query->execute(); diff --git a/layout.html b/layout.html index 95267ce..8147a2c 100755 --- a/layout.html +++ b/layout.html @@ -559,18 +559,20 @@ edl_save_button.addEventListener("click", (e) => { e.preventDefault(); const api_url = "edl.php"; + const edl_definition = {}; const payload = {}; const inpoint = document.querySelector("#media_item_edl_inpoint_listitem").getAttribute("data-start"); const outpoint = document.querySelector("#media_item_edl_outpoint_listitem").getAttribute("data-stop"); payload.media_id = document.querySelector("#media_library_details > .media_item_details").getAttribute("data-media-id"); - payload.inpoint = inpoint || "0"; - payload.outpoint = outpoint || document.querySelector("#media_library_details > .media_item_details").getAttribute("data-duration"); - payload.inserts = []; + edl_definition.inpoint = inpoint || "0"; + 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 current_items = list_parent.querySelectorAll("li.media_item_edl_insert"); current_items.forEach((insertPoint) => { - payload.inserts.push(insertPoint.getAttribute("data-timestamp")); + edl_definition.inserts.push(insertPoint.getAttribute("data-timestamp")); }); + payload.edl_definition = edl_definition; console.log("preparing to save edl:"); console.dir(payload); fetch(api_url, {