edl integration work

This commit is contained in:
Sundog Jones 2024-09-17 10:27:56 -04:00
parent da339b3ddc
commit efffc35f30
2 changed files with 6 additions and 4 deletions

View File

@ -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)");

View File

@ -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, {