Show Jellyfin handoff jobs in queue

This commit is contained in:
Dymas
2026-07-17 12:30:23 +02:00
parent ba408877b5
commit 604265c44f
7 changed files with 198 additions and 11 deletions
+15 -2
View File
@@ -390,6 +390,13 @@ QUEUE_HTML = r"""<!doctype html>
}
function buildJobSummary(job) {
if (job.job_type === "jellyfin_handoff") {
const progress = `${job.completed || 0}/${job.total || 0} entries`;
const moved = `${job.moved || 0} moved`;
const files = `${job.moved_files || 0} files`;
const target = job.target_dir || "Jellyfin libraries";
return `${progress} · ${moved} · ${files} · ${target}`;
}
const libraryName = job.anime_name || job.title;
const season = String(job.season || "1").padStart(2, "0");
const seasonFolder = `Season ${season}`;
@@ -403,6 +410,12 @@ QUEUE_HTML = r"""<!doctype html>
function renderJobActions(job, actions) {
actions.innerHTML = "";
if (job.job_type === "jellyfin_handoff") {
if (job.status !== "running" && job.status !== "pending") {
actions.append(actionButton("Remove", () => queueAction(job.id, "remove")));
}
return;
}
if (job.status === "running" || job.status === "pending") {
actions.append(actionButton("Cancel", () => queueAction(job.id, "cancel"), "danger"));
return;
@@ -416,14 +429,14 @@ QUEUE_HTML = r"""<!doctype html>
function updateJobCard(item, job) {
item.dataset.jobId = job.id;
item.dataset.jobStatus = job.status;
item.querySelector(".job-title").textContent = job.title;
item.querySelector(".job-title").textContent = job.title || "Untitled job";
item.querySelector(".job-head .muted").textContent = buildJobSummary(job);
const status = item.querySelector(".status");
status.textContent = job.status;
status.className = "status";
status.classList.add(job.status);
item.querySelector("pre").textContent = buildJobLog(job) || "Waiting...";
item.querySelector(".toolbar .muted").textContent = job.exit_code === null ? "" : `exit ${job.exit_code}`;
item.querySelector(".toolbar .muted").textContent = job.exit_code === null || job.exit_code === undefined ? "" : `exit ${job.exit_code}`;
renderJobActions(job, item.querySelector(".row"));
state.jobCards[job.id] = item;
}