Add local dashcam video library

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-09 19:04:47 -04:00
co-authored by Copilot
parent c57457b934
commit 3a981f5c6d
14 changed files with 659 additions and 29 deletions
+2 -11
View File
@@ -25,15 +25,6 @@ function fetchJson(url, options) {
}));
}
function formatBytes(bytes) {
if (bytes === 0) {
return '0 B';
}
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
const unit = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
return `${(bytes / (1024 ** unit)).toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`;
}
function createCell(text) {
const cell = document.createElement('td');
cell.textContent = text;
@@ -93,7 +84,7 @@ function renderDashcamFiles(summary) {
row.appendChild(selection);
row.appendChild(createCell(file.path));
row.appendChild(createCell(formatBytes(file.size)));
row.appendChild(createCell(YarisUI.formatBytes(file.size)));
row.appendChild(createCell(new Date(file.modified_at * 1000).toLocaleString()));
const actions = document.createElement('td');
@@ -116,7 +107,7 @@ function renderDashcamFiles(summary) {
fileListBody.appendChild(row);
});
fileSummary.textContent = `${files.length} video(s), ${formatBytes(summary.total_size || 0)} total`;
fileSummary.textContent = `${files.length} video(s), ${YarisUI.formatBytes(summary.total_size || 0)} total`;
if (summary.errors && summary.errors.length) {
fileSummary.textContent += ` (${summary.errors.length} file error(s))`;
}