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(" · ");
|
||||
}
|
||||
|
||||
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 {
|
||||
if (!n || n <= 0) return "—";
|
||||
const u = ["B", "KB", "MB", "GB", "TB"];
|
||||
|
|
@ -853,14 +873,13 @@ export default function DownloadsPage() {
|
|||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||
</div>
|
||||
<div className="muted downloads-source">{j.sourceTitle}</div>
|
||||
{j.subtitlePath && (
|
||||
<div className="ok-text">Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}</div>
|
||||
)}
|
||||
{j.hasSubtitle && !j.subtitlePath && (
|
||||
<div className="danger-text">
|
||||
{j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
|
||||
</div>
|
||||
)}
|
||||
{(() => {
|
||||
const sub = subtitleStatus(j);
|
||||
if (!sub) return null;
|
||||
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>}
|
||||
<div className="action-row">
|
||||
{(j.status === "FAILED" || j.status === "FINISHED") && (
|
||||
|
|
@ -903,11 +922,13 @@ export default function DownloadsPage() {
|
|||
<td>
|
||||
{j.movieTitle}
|
||||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||
{j.hasSubtitle && !j.subtitlePath && (
|
||||
<div className="danger-text">
|
||||
{j.subtitleError || j.error || "Ondertitel ontbreekt"}
|
||||
</div>
|
||||
)}
|
||||
{(() => {
|
||||
const sub = subtitleStatus(j);
|
||||
if (!sub) return null;
|
||||
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>}
|
||||
</td>
|
||||
<td className="muted">{j.sourceTitle}</td>
|
||||
|
|
@ -985,16 +1006,17 @@ export default function DownloadsPage() {
|
|||
))}
|
||||
</ul>
|
||||
)}
|
||||
{(!j.episodes || j.episodes.length === 0) && j.subtitlePath && (
|
||||
<div className="ok-text">Ondertitel: {j.subtitlePath.split(/[/\\]/).pop()}</div>
|
||||
)}
|
||||
{(!j.episodes || j.episodes.length === 0) && j.hasSubtitle && !j.subtitlePath && (
|
||||
<div className="danger-text">
|
||||
{j.subtitleError || j.error || "Ondertitel ontbreekt in map"}
|
||||
</div>
|
||||
)}
|
||||
{(!j.episodes || j.episodes.length === 0) &&
|
||||
(() => {
|
||||
const sub = subtitleStatus(j);
|
||||
if (!sub) return null;
|
||||
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>;
|
||||
})()}
|
||||
<div className="action-row">
|
||||
{(!j.episodes || j.episodes.length === 0) &&
|
||||
j.status === "IMPORTED" &&
|
||||
j.importedPath &&
|
||||
!j.subtitlePath && (
|
||||
<button type="button" onClick={() => void openSubtitlePicker(j)}>
|
||||
|
|
@ -1030,21 +1052,20 @@ export default function DownloadsPage() {
|
|||
<td>
|
||||
{j.movieTitle}
|
||||
{j.movieYear ? ` (${j.movieYear})` : ""}
|
||||
{j.subtitlePath && (
|
||||
<div className="ok-text">
|
||||
Sub: {j.subtitlePath.split(/[/\\]/).pop()}
|
||||
</div>
|
||||
)}
|
||||
{j.hasSubtitle && !j.subtitlePath && (
|
||||
<div className="danger-text">
|
||||
{j.subtitleError || j.error || "Ondertitel ontbreekt"}
|
||||
</div>
|
||||
)}
|
||||
{(() => {
|
||||
const sub = subtitleStatus(j);
|
||||
if (!sub || (j.episodes && j.episodes.length > 0)) return null;
|
||||
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>;
|
||||
})()}
|
||||
</td>
|
||||
<td className="muted">{j.sourceTitle}</td>
|
||||
<td>{j.nodeName}</td>
|
||||
<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)}>
|
||||
Sub kiezen
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue