Skip to content

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

C#

Updated frontend connection settings.

nzbdav-deve613a75ee86a
diff --git a/frontend/app/routes/settings/maintenance/strm-to-symlinks/strm-to-symlinks.tsx b/frontend/app/routes/settings/maintenance/strm-to-symlinks/strm-to-symlinks.tsx
index bcc3b4c5..a37471ad 100644
--- a/frontend/app/routes/settings/maintenance/strm-to-symlinks/strm-to-symlinks.tsx
+++ b/frontend/app/routes/settings/maintenance/strm-to-symlinks/strm-to-symlinks.tsx
@@ -91,7 +91,7 @@ export function ConvertStrmToSymlinks({ savedConfig }: ConvertStrmToSymlinksProp
<br />
This task will scan your organized media library for all *.strm files.
Every *.strm file that links to nzbdav media will be deleted and be replaced by a symlink.
- The newly created symlniks will all point to the corresponding file within your rclone mount.
+ The newly created symlinks will all point to the corresponding file within your rclone mount.
</Form.Text>
</Form.Group>
</div>
diff --git a/frontend/app/routes/settings/repairs/repairs.tsx b/frontend/app/routes/settings/repairs/repairs.tsx
index a2c68efe..28522ea2 100644
--- a/frontend/app/routes/settings/repairs/repairs.tsx
+++ b/frontend/app/routes/settings/repairs/repairs.tsx
@@ -50,40 +50,11 @@ export function RepairsSettings({ config, setNewConfig }: RepairsSettingsProps)
Make sure this path is visible to your NzbDAV container.
</Form.Text>
</Form.Group>
- <hr />
- <Form.Group>
- <Form.Label htmlFor="repairs-connections-input">Max Connections for Health Checks</Form.Label>
- <Form.Control
- {...className([styles.input, !isValidRepairsConnections(config["repair.connections"]) && styles.error])}
- type="text"
- id="repairs-connections-input"
- aria-describedby="repairs-connections-help"
- placeholder={"All"}
- value={config["repair.connections"] || ""}
- onChange={e => setNewConfig({ ...config, "repair.connections": e.target.value })} />
- <Form.Text id="repairs-connections-help" muted>
- The background health-check job will not use any more than this number of connections. Will default to your overall Max Connections if left empty.
- </Form.Text>
- </Form.Group>
</div>
);
}
export function isRepairsSettingsUpdated(config: Record<string, string>, newConfig: Record<string, string>) {
return config["repair.enable"] !== newConfig["repair.enable"]
- || config["repair.connections"] !== newConfig["repair.connections"]
|| config["media.library-dir"] !== newConfig["media.library-dir"];
}
-
-export function isRepairsSettingsValid(newConfig: Record<string, string>) {
- return isValidRepairsConnections(newConfig["repair.connections"]);
-}
-
-function isValidRepairsConnections(repairsConnections: string): boolean {
- return repairsConnections === "" || isNonNegativeInteger(repairsConnections);
-}
-
-function isNonNegativeInteger(value: string) {
- const num = Number(value);
- return Number.isInteger(num) && num >= 0 && value.trim() === num.toString();
-}
diff --git a/frontend/app/routes/settings/route.tsx b/frontend/app/routes/settings/route.tsx
index 451339e0..2d2e92ca 100644
--- a/frontend/app/routes/settings/route.tsx
+++ b/frontend/app/routes/settings/route.tsx
@@ -8,14 +8,13 @@ import { isSabnzbdSettingsUpdated, isSabnzbdSettingsValid, SabnzbdSettings } fro
import { isWebdavSettingsUpdated, isWebdavSettingsValid, WebdavSettings } from "./webdav/webdav";
import { isArrsSettingsUpdated, isArrsSettingsValid, ArrsSettings } from "./arrs/arrs";
import { Maintenance } from "./maintenance/maintenance";
-import { isRepairsSettingsUpdated, isRepairsSettingsValid, RepairsSettings } from "./repairs/repairs";
+import { isRepairsSettingsUpdated, RepairsSettings } from "./repairs/repairs";
const defaultConfig = {
"general.base-url": "",
"api.key": "",
"api.categories": "",
"api.manual-category": "uncategorized",
- "api.max-queue-connections": "",
"api.ensure-importable-video": "true",
"api.ensure-article-existence": "false",
"api.ignore-history-limit": "true",
@@ -24,7 +23,8 @@ const defaultConfig = {
"api.import-strategy": "symlinks",
"api.completed-downloads-dir": "",
"usenet.providers": "",
- "usenet.connections-per-stream": "5",
+ "usenet.max-download-connections": "15",
+ "usenet.streaming-priority": "80",
"webdav.user": "admin",
"webdav.pass": "",
"webdav.show-hidden-files": "false",
@@ -33,7 +33,6 @@ const defaultConfig = {
"rclone.mount-dir": "",
"media.library-dir": "",
"arr.instances": "{\"RadarrInstances\":[],\"SonarrInstances\":[],\"QueueRules\":[]}",
- "repair.connections": "",
"repair.enable": "false",
}
@@ -87,7 +86,6 @@ function Body(props: BodyProps) {
: isSabnzbdUpdated && !isSabnzbdSettingsValid(newConfig) ? "Invalid SABnzbd settings"
: isWebdavUpdated && !isWebdavSettingsValid(newConfig) ? "Invalid WebDAV settings"
: isArrsUpdated && !isArrsSettingsValid(newConfig) ? "Invalid Arrs settings"
- : isRepairsUpdated && !isRepairsSettingsValid(newConfig) ? "Invalid Repairs settings"
: "Save";
const saveButtonVariant = saveButtonLabel === "Save" ? "primary"
: saveButtonLabel === "Saved ✅" ? "success"
diff --git a/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx b/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
index f3af3236..b18b3d97 100644
--- a/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
+++ b/frontend/app/routes/settings/sabnzbd/sabnzbd.tsx
@@ -127,21 +127,6 @@ export function SabnzbdSettings({ config, setNewConfig }: SabnzbdSettingsProps)
</Form.Group>
</>}
<hr />
- <Form.Group>
- <Form.Label htmlFor="max-queue-connections-input">Max Connections for Queue Processing</Form.Label>
- <Form.Control
- {...className([styles.input, !isValidQueueConnections(config["api.max-queue-connections"]) && styles.error])}
- type="text"
- id="max-queue-connections-input"
- aria-describedby="max-queue-connections-help"
- placeholder="All"
- value={config["api.max-queue-connections"]}
- onChange={e => setNewConfig({ ...config, "api.max-queue-connections": e.target.value })} />
- <Form.Text id="max-queue-connections-help" muted>
- Queue processing tasks will not use any more than this number of connections. Will default to your overall Max Connections if left empty.
- </Form.Text>
- </Form.Group>
- <hr />
<Form.Group>
<Form.Label htmlFor="ignored-file-extensions-input">Ignored File Extensions</Form.Label>
<Form.Control
@@ -158,16 +143,17 @@ export function SabnzbdSettings({ config, setNewConfig }: SabnzbdSettingsProps)
</Form.Group>
<hr />
<Form.Group>
- <Form.Label htmlFor="duplicate-nzb-input">Behavior for Duplicate NZBs</Form.Label>
+ <Form.Label htmlFor="duplicate-nzb-behavior-input">Behavior for Duplicate NZBs</Form.Label>
<Form.Select
className={styles.input}
+ aria-describedby="duplicate-nzb-behavior-help"
value={config["api.duplicate-nzb-behavior"]}
onChange={e => setNewConfig({ ...config, "api.duplicate-nzb-behavior": e.target.value })}
>
<option value="increment">Download again with suffix (2)</option>
<option value="mark-failed">Mark the download as failed</option>
</Form.Select>
- <Form.Text id="max-queue-connections-help" muted>
+ <Form.Text id="duplicate-nzb-behavior-help" muted>
When an NZB is added, a new folder is created on the webdav. What should be done when the download folder for an NZB already exists?
</Form.Text>
</Form.Group>
@@ -223,7 +209,6 @@ export function isSabnzbdSettingsUpdated(config: Record<string, string>, newConf
|| config["api.categories"] !== newConfig["api.categories"]
|| config["api.manual-category"] !== newConfig["api.manual-category"]
|| 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"]
|| config["api.ignore-history-limit"] !== newConfig["api.ignore-history-limit"]
@@ -235,8 +220,7 @@ export function isSabnzbdSettingsUpdated(config: Record<string, string>, newConf
}
export function isSabnzbdSettingsValid(newConfig: Record<string, string>) {
- return isValidCategories(newConfig["api.categories"])
- && isValidQueueConnections(newConfig["api.max-queue-connections"]);
+ return isValidCategories(newConfig["api.categories"]);
}
export function generateNewApiKey(): string {
@@ -253,7 +237,3 @@ function isAlphaNumericWithDashes(input: string): boolean {
const regex = /^[A-Za-z0-9-]+$/;
return regex.test(input);
}
-
-function isValidQueueConnections(maxQueueConnections: string): boolean {
- return maxQueueConnections === "" || isPositiveInteger(maxQueueConnections);
-}
diff --git a/frontend/app/routes/settings/webdav/webdav.tsx b/frontend/app/routes/settings/webdav/webdav.tsx
index 57965a56..ff2f8dad 100644
--- a/frontend/app/routes/settings/webdav/webdav.tsx
+++ b/frontend/app/routes/settings/webdav/webdav.tsx
@@ -1,4 +1,4 @@
-import { Form } from "react-bootstrap";
+import { Form, InputGroup } from "react-bootstrap";
import styles from "./webdav.module.css"
import { type Dispatch, type SetStateAction } from "react";
import { className } from "~/utils/styling";
@@ -42,17 +42,36 @@ export function WebdavSettings({ config, setNewConfig }: SabnzbdSettingsProps) {
</Form.Group>
<hr />
<Form.Group>
- <Form.Label htmlFor="connections-per-stream-input">Connections Per Stream</Form.Label>
+ <Form.Label htmlFor="max-download-connections-input">Max Download Connections</Form.Label>
<Form.Control
- {...className([styles.input, !isValidConnectionsPerStream(config["usenet.connections-per-stream"]) && styles.error])}
+ {...className([styles.input, !isValidMaxDownloadConnections(config["usenet.max-download-connections"]) && styles.error])}
type="text"
- id="connections-per-stream-input"
- aria-describedby="connections-per-stream-help"
- placeholder="5"
- value={config["usenet.connections-per-stream"]}
- onChange={e => setNewConfig({ ...config, "usenet.connections-per-stream": e.target.value })} />
- <Form.Text id="connections-per-stream-help" muted>
- When a file is requested from the webdav, how many usenet connections should be used to stream that file?
+ id="max-download-connections-input"
+ aria-describedby="max-download-connections-help"
+ placeholder="15"
+ value={config["usenet.max-download-connections"]}
+ onChange={e => setNewConfig({ ...config, "usenet.max-download-connections": e.target.value })} />
+ <Form.Text id="max-download-connections-help" muted>
+ The maximum number of connections that will be used for downloading articles from your usenet provider(s).
+ Configure this to the minimum number of connections that will fully saturate your server's bandwidth.
+ </Form.Text>
+ </Form.Group>
+ <hr />
+ <Form.Group>
+ <Form.Label htmlFor="streaming-priority-input">Streaming Priority</Form.Label>
+ <InputGroup className={styles.input}>
+ <Form.Control
+ className={!isValidStreamingPriority(config["usenet.streaming-priority"]) ? styles.error : undefined}
+ type="text"
+ id="streaming-priority-input"
+ aria-describedby="streaming-priority-help"
+ placeholder="80"
+ value={config["usenet.streaming-priority"]}
+ onChange={e => setNewConfig({ ...config, "usenet.streaming-priority": e.target.value })} />
+ <InputGroup.Text>%</InputGroup.Text>
+ </InputGroup>
+ <Form.Text id="streaming-priority-help" muted>
+ When streaming from the webdav while the queue is also active, how much bandwidth should be dedicated to streaming?
</Form.Text>
</Form.Group>
<hr />
@@ -104,7 +123,8 @@ export function WebdavSettings({ config, setNewConfig }: SabnzbdSettingsProps) {
export function isWebdavSettingsUpdated(config: Record<string, string>, newConfig: Record<string, string>) {
return config["webdav.user"] !== newConfig["webdav.user"]
|| config["webdav.pass"] !== newConfig["webdav.pass"]
- || config["usenet.connections-per-stream"] !== newConfig["usenet.connections-per-stream"]
+ || config["usenet.max-download-connections"] !== newConfig["usenet.max-download-connections"]
+ || config["usenet.streaming-priority"] !== newConfig["usenet.streaming-priority"]
|| config["webdav.show-hidden-files"] !== newConfig["webdav.show-hidden-files"]
|| config["webdav.enforce-readonly"] !== newConfig["webdav.enforce-readonly"]
|| config["webdav.preview-par2-files"] !== newConfig["webdav.preview-par2-files"]
@@ -112,7 +132,8 @@ export function isWebdavSettingsUpdated(config: Record<string, string>, newConfi
export function isWebdavSettingsValid(newConfig: Record<string, string>) {
return isValidUser(newConfig["webdav.user"])
- && isValidConnectionsPerStream(newConfig["usenet.connections-per-stream"]);
+ && isValidMaxDownloadConnections(newConfig["usenet.max-download-connections"])
+ && isValidStreamingPriority(newConfig["usenet.streaming-priority"]);
}
function isValidUser(user: string): boolean {
@@ -120,6 +141,12 @@ function isValidUser(user: string): boolean {
return regex.test(user);
}
-function isValidConnectionsPerStream(value: string): boolean {
+function isValidMaxDownloadConnections(value: string): boolean {
return isPositiveInteger(value);
+}
+
+function isValidStreamingPriority(value: string): boolean {
+ if (value.trim() === "") return false;
+ const num = Number(value);
+ return Number.isInteger(num) && num >= 0 && num <= 100;
}
\ No newline at end of file