Only warn missing subtitle after import, not while downloading.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
bd21b01956
commit
c75bfc4a97
1 changed files with 53 additions and 32 deletions
|
|
@ -136,6 +136,26 @@ function progressLabel(job: JobRow): string {
|
||||||
return parts.join(" · ");
|
return parts.join(" · ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function subtitleStatus(job: JobRow): { kind: "ok" | "pending" | "missing"; text: string } | null {
|
||||||
|
if (job.subtitlePath) {
|
||||||
|
return {
|
||||||
|
kind: "ok",
|
||||||
|
text: `Ondertitel: ${job.subtitlePath.split(/[/\\]/).pop()}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (!job.hasSubtitle && !job.subtitleError) return null;
|
||||||
|
if (job.status === "IMPORTED") {
|
||||||
|
return {
|
||||||
|
kind: "missing",
|
||||||
|
text: job.subtitleError || "Ondertitel ontbreekt in map",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
kind: "pending",
|
||||||
|
text: job.subtitleError || "Ondertitel gekozen — wordt bij import geschreven",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function formatBytes(n: number): string {
|
function formatBytes(n: number): string {
|
||||||
if (!n || n <= 0) return "—";
|
if (!n || n <= 0) return "—";
|
||||||
const u = ["B", "KB", "MB", "GB", "TB"];
|
const u = ["B", "KB", "MB", "GB", "TB"];
|
||||||
|
|
@ -853,14 +873,13 @@ export default function DownloadsPage() {
|
||||||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||||
</div>
|
</div>
|
||||||
<div className="muted downloads-source">{j.sourceTitle}</div>
|
<div className="muted downloads-source">{j.sourceTitle}</div>
|
||||||
{j.subtitlePath && (
|
{(() => {
|
||||||
<div className="ok-text">Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}</div>
|
const sub = subtitleStatus(j);
|
||||||
)}
|
if (!sub) return null;
|
||||||
{j.hasSubtitle && !j.subtitlePath && (
|
if (sub.kind === "ok") return <div className="ok-text">{sub.text}</div>;
|
||||||
<div className="danger-text">
|
if (sub.kind === "pending") return <div className="muted">{sub.text}</div>;
|
||||||
{j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
|
return <div className="danger-text">{sub.text}</div>;
|
||||||
</div>
|
})()}
|
||||||
)}
|
|
||||||
{j.error && !j.hasSubtitle && <div className="danger-text">{j.error}</div>}
|
{j.error && !j.hasSubtitle && <div className="danger-text">{j.error}</div>}
|
||||||
<div className="action-row">
|
<div className="action-row">
|
||||||
{(j.status === "FAILED" || j.status === "FINISHED") && (
|
{(j.status === "FAILED" || j.status === "FINISHED") && (
|
||||||
|
|
@ -903,11 +922,13 @@ export default function DownloadsPage() {
|
||||||
<td>
|
<td>
|
||||||
{j.movieTitle}
|
{j.movieTitle}
|
||||||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||||
{j.hasSubtitle && !j.subtitlePath && (
|
{(() => {
|
||||||
<div className="danger-text">
|
const sub = subtitleStatus(j);
|
||||||
{j.subtitleError || j.error || "Ondertitel ontbreekt"}
|
if (!sub) return null;
|
||||||
</div>
|
if (sub.kind === "ok") return <div className="ok-text">{sub.text}</div>;
|
||||||
)}
|
if (sub.kind === "pending") return <div className="muted">{sub.text}</div>;
|
||||||
|
return <div className="danger-text">{sub.text}</div>;
|
||||||
|
})()}
|
||||||
{j.error && !j.hasSubtitle && <div className="danger-text">{j.error}</div>}
|
{j.error && !j.hasSubtitle && <div className="danger-text">{j.error}</div>}
|
||||||
</td>
|
</td>
|
||||||
<td className="muted">{j.sourceTitle}</td>
|
<td className="muted">{j.sourceTitle}</td>
|
||||||
|
|
@ -985,16 +1006,17 @@ export default function DownloadsPage() {
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
{(!j.episodes || j.episodes.length === 0) && j.subtitlePath && (
|
{(!j.episodes || j.episodes.length === 0) &&
|
||||||
<div className="ok-text">Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}</div>
|
(() => {
|
||||||
)}
|
const sub = subtitleStatus(j);
|
||||||
{(!j.episodes || j.episodes.length === 0) && j.hasSubtitle && !j.subtitlePath && (
|
if (!sub) return null;
|
||||||
<div className="danger-text">
|
if (sub.kind === "ok") return <div className="ok-text">{sub.text}</div>;
|
||||||
{j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
|
if (sub.kind === "pending") return <div className="muted">{sub.text}</div>;
|
||||||
</div>
|
return <div className="danger-text">{sub.text}</div>;
|
||||||
)}
|
})()}
|
||||||
<div className="action-row">
|
<div className="action-row">
|
||||||
{(!j.episodes || j.episodes.length === 0) &&
|
{(!j.episodes || j.episodes.length === 0) &&
|
||||||
|
j.status === "IMPORTED" &&
|
||||||
j.importedPath &&
|
j.importedPath &&
|
||||||
!j.subtitlePath && (
|
!j.subtitlePath && (
|
||||||
<button type="button" onClick={() => void openSubtitlePicker(j)}>
|
<button type="button" onClick={() => void openSubtitlePicker(j)}>
|
||||||
|
|
@ -1030,21 +1052,20 @@ export default function DownloadsPage() {
|
||||||
<td>
|
<td>
|
||||||
{j.movieTitle}
|
{j.movieTitle}
|
||||||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||||
{j.subtitlePath && (
|
{(() => {
|
||||||
<div className="ok-text">
|
const sub = subtitleStatus(j);
|
||||||
Sub: {j.subtitlePath.split(/[/\\]/).pop()}
|
if (!sub || (j.episodes && j.episodes.length > 0)) return null;
|
||||||
</div>
|
if (sub.kind === "ok") return <div className="ok-text">{sub.text}</div>;
|
||||||
)}
|
if (sub.kind === "pending") return <div className="muted">{sub.text}</div>;
|
||||||
{j.hasSubtitle && !j.subtitlePath && (
|
return <div className="danger-text">{sub.text}</div>;
|
||||||
<div className="danger-text">
|
})()}
|
||||||
{j.subtitleError || j.error || "Ondertitel ontbreekt"}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</td>
|
</td>
|
||||||
<td className="muted">{j.sourceTitle}</td>
|
<td className="muted">{j.sourceTitle}</td>
|
||||||
<td>{j.nodeName}</td>
|
<td>{j.nodeName}</td>
|
||||||
<td className="downloads-job-actions">
|
<td className="downloads-job-actions">
|
||||||
{j.importedPath && !j.subtitlePath && (
|
{(!j.episodes || j.episodes.length === 0) &&
|
||||||
|
j.importedPath &&
|
||||||
|
!j.subtitlePath && (
|
||||||
<button type="button" onClick={() => void openSubtitlePicker(j)}>
|
<button type="button" onClick={() => void openSubtitlePicker(j)}>
|
||||||
Sub kiezen
|
Sub kiezen
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue