feat(videos): add manual Convert button per MOV file on Pi

- New POST /api/local-video/convert route triggers queue_convert(force=True)
- queue_convert() now returns True/False/None and accepts force param
  to bypass the auto-convert toggle (manual always works)
- Convert button shown for non-MP4, non-converting files in video list
- Clicking spins the button and refreshes list after 1s to show badge

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-10 01:28:56 -04:00
co-authored by Copilot
parent ba712bd6db
commit c995599512
3 changed files with 46 additions and 8 deletions
+26
View File
@@ -172,6 +172,16 @@
playButton.innerHTML = '<i class="fas fa-play"></i><span class="btn-label"> Play</span>';
actionsDiv.appendChild(playButton);
// Convert button — only for non-MP4 files not already converting
if (!file.converting && !file.path.toLowerCase().endsWith(".mp4")) {
const convertButton = document.createElement("button");
convertButton.type = "button";
convertButton.className = "btn btn-sm btn-outline-secondary btn-icon-mobile";
convertButton.dataset.convertPath = file.path;
convertButton.innerHTML = '<i class="fas fa-exchange-alt"></i><span class="btn-label"> Convert</span>';
actionsDiv.appendChild(convertButton);
}
const deleteButton = document.createElement("button");
deleteButton.type = "button";
deleteButton.className = "btn btn-sm btn-outline-danger btn-icon-mobile";
@@ -238,6 +248,22 @@
deleteVideo(deleteButton.dataset.deleteLocalPath).finally(function () {
deleteButton.disabled = false;
});
return;
}
const convertButton = event.target.closest("[data-convert-path]");
if (convertButton) {
convertButton.disabled = true;
convertButton.innerHTML = '<i class="fas fa-spinner fa-spin"></i>';
fetch("/api/local-video/convert", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: convertButton.dataset.convertPath }),
}).then(function () {
setTimeout(refreshFiles, 1000);
}).catch(function (err) {
summary.textContent = `Convert failed: ${err.message}`;
convertButton.disabled = false;
});
}
});