Skip to content

Usenet streaming with a WebDAV server and a SABnzbd-compatible API

C#

Added frontend setting to perform article health checks during queue downloads.

nzbdav-deva6766ab01b50
diff --git a/frontend/app/clients/backend-client.server.ts b/frontend/app/clients/backend-client.server.ts
index 0ee2c19c..7df87438 100644
--- a/frontend/app/clients/backend-client.server.ts
+++ b/frontend/app/clients/backend-client.server.ts
@@ -197,6 +197,7 @@ export type QueueSlot = {
filename: string,
cat: string,
percentage: string,
+ true_percentage: string,
status: string,
mb: string,
mbleft: string,
diff --git a/frontend/app/routes/queue/components/queue-table/queue-table.tsx b/frontend/app/routes/queue/components/queue-table/queue-table.tsx
index 4c690812..61dbfdbd 100644
--- a/frontend/app/routes/queue/components/queue-table/queue-table.tsx
+++ b/frontend/app/routes/queue/components/queue-table/queue-table.tsx
@@ -133,7 +133,7 @@ export function QueueRow({ slot, onIsSelectedChanged, onIsRemovingChanged, onRem
name={slot.filename}
category={slot.cat}
status={slot.status}
- percentage={slot.percentage}
+ percentage={slot.true_percentage}
fileSizeBytes={Number(slot.mb) * 1024 * 1024}
actions={<ActionButton type="delete" disabled={!!slot.isRemoving} onClick={onRemove} />}
onRowSelectionChanged={isSelected => onIsSelectedChanged(slot.nzo_id, isSelected)}
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.module.css b/frontend/app/routes/queue/components/status-badge/status-badge.module.css
index 06bf485f..a84cc187 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.module.css
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.module.css
@@ -33,6 +33,10 @@
transition: width 500ms ease-in-out;
}
+.healthcheck-progress {
+ background-color: #60aa4a;
+}
+
@media not (min-width: 900px) {
.container {
display: flex;
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts b/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
index ceb53426..e4b373d6 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.module.css.d.ts
@@ -3,6 +3,7 @@ declare const styles: {
readonly "badge": string;
readonly "badge-text": string;
readonly "progress": string;
+ readonly "healthcheck-progress": string;
readonly "failure-badge": string;
};
export = styles;
diff --git a/frontend/app/routes/queue/components/status-badge/status-badge.tsx b/frontend/app/routes/queue/components/status-badge/status-badge.tsx
index a7e7bda0..381b39fd 100644
--- a/frontend/app/routes/queue/components/status-badge/status-badge.tsx
+++ b/frontend/app/routes/queue/components/status-badge/status-badge.tsx
@@ -22,7 +22,7 @@ export function StatusBadge({ status, percentage, error }: StatusBadgeProps) {
// determine badge text
let badgeText = statusLower;
- if (statusLower === "downloading" || percentNum > 0) badgeText = `${percentNum}%`;
+ if (statusLower === "downloading" || percentNum > 0) badgeText = `${percentNum % 100}%`;
// determine class name
if (error?.startsWith("Article with message-id")) error = "Missing articles";
@@ -48,13 +48,19 @@ type BadgeProps = {
}
function Badge(props: BadgeProps) {
- let style = (props.percentNum >= 0)
- ? { width: `${props.percentNum}%` }
+ const isHealthCheck = props.percentNum > 100;
+
+ const progressClassName = isHealthCheck
+ ? styles.progress + " " + styles["healthcheck-progress"]
+ : styles.progress;
+
+ const style = (props.percentNum >= 0)
+ ? { width: `${props.percentNum % 100}%` }
: undefined;
return (
<div {...className([styles.badge, props.className])} style={{ backgroundColor: props.color }}>
- <div className={styles.progress} style={style} />
+ <div className={progressClassName} style={style} />
<div className={styles["badge-text"]}>{props.children}</div>
</div>
);
diff --git a/frontend/app/routes/queue/route.tsx b/frontend/app/routes/queue/route.tsx
index da46fd7c..6ab561ec 100644
--- a/frontend/app/routes/queue/route.tsx
+++ b/frontend/app/routes/queue/route.tsx
@@ -66,8 +66,8 @@ export default function Queue(props: Route.ComponentProps) {
}, [setQueueSlots]);
const onChangeQueueSlotPercentage = useCallback((message: string) => {
- const [nzo_id, percentage] = message.split('|');
- setQueueSlots(slots => slots.map(x => x.nzo_id === nzo_id ? { ...x, percentage } : x));
+ const [nzo_id, true_percentage] = message.split('|');
+ setQueueSlots(slots => slots.map(x => x.nzo_id === nzo_id ? { ...x, true_percentage } : x));
}, [setQueueSlots]);
// history events
diff --git a/frontend/app/routes/settings/route.tsx b/frontend/app/routes/settings/route.tsx
index d55098fd..a91e9465 100644
--- a/frontend/app/routes/settings/route.tsx
+++ b/frontend/app/routes/settings/route.tsx
@@ -14,6 +14,7 @@ const defaultConfig = {
"api.categories": "",
"api.max-queue-connections": "",
"api.ensure-importable-video": "true",
+ "api.ensure-article-existence": "false",
"usenet.host": "",
"usenet.port": "",
"usenet.use-ssl": "false",
diff --git a/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx b/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
index 63235f29..a206e419 100644
--- a/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
+++ b/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
@@ -92,6 +92,19 @@ export function SabnzbdSettings({ config, setNewConfig }: SabnzbdSettingsProps)
Whether to mark downloads as `failed` when no single video file is found inside the nzb. This will force Radarr / Sonarr to automatically look for a new nzb.
</Form.Text>
</Form.Group>
+ <hr />
+ <Form.Group>
+ <Form.Check
+ className={styles.input}
+ type="checkbox"
+ aria-describedby="ensure-article-existence-help"
+ label={`Perform article health check during downloads`}
+ checked={config["api.ensure-article-existence"] === "true"}
+ onChange={e => setNewConfig({ ...config, "api.ensure-article-existence": "" + e.target.checked })} />
+ <Form.Text id="ensure-article-existence-help" muted>
+ Whether to check for the existence of all articles within an NZB during queue processing. This process may be slow.
+ </Form.Text>
+ </Form.Group>
</div>
);
}
@@ -102,6 +115,7 @@ export function isSabnzbdSettingsUpdated(config: Record<string, string>, newConf
|| config["rclone.mount-dir"] !== newConfig["rclone.mount-dir"]
|| config["api.max-queue-connections"] !== newConfig["api.max-queue-connections"]
|| config["api.ensure-importable-video"] !== newConfig["api.ensure-importable-video"]
+ || config["api.ensure-article-existence"] !== newConfig["api.ensure-article-existence"]
}
export function isSabnzbdSettingsValid(newConfig: Record<string, string>) {