|
3 | 3 | * Interacts with Radarr, Sonarr, Lidarr, Readarr, Whisparr APIs |
4 | 4 | */ |
5 | 5 |
|
6 | | -import { debugLog } from "../utils/debug" |
| 6 | +import type { NamingConfig } from "./naming-config" |
| 7 | +import type { AppId } from "~/config/schema" |
| 8 | +import { getCategoryFieldName, getCategoryForApp } from "~/utils/categories" |
| 9 | +import { debugLog } from "~/utils/debug" |
| 10 | +import { TRASH_NAMING_CONFIG } from "./naming-config" |
7 | 11 |
|
8 | 12 | // Types for Root Folder API |
9 | 13 | export interface RootFolder { |
@@ -44,10 +48,6 @@ export interface RemotePathMapping { |
44 | 48 | localPath: string |
45 | 49 | } |
46 | 50 |
|
47 | | -import type { AppId } from "../config/schema" |
48 | | -import { getCategoryForApp, getCategoryFieldName } from "../utils/categories" |
49 | | -import { TRASH_NAMING_CONFIG, type NamingConfig } from "./naming-config" |
50 | | - |
51 | 51 | // qBittorrent download client config |
52 | 52 | export function createQBittorrentConfig( |
53 | 53 | host: string, |
@@ -82,7 +82,12 @@ export function createQBittorrentConfig( |
82 | 82 | } |
83 | 83 |
|
84 | 84 | // SABnzbd download client config |
85 | | -export function createSABnzbdConfig(host: string, port: number, apiKey: string, appId?: AppId): DownloadClientConfig { |
| 85 | +export function createSABnzbdConfig( |
| 86 | + host: string, |
| 87 | + port: number, |
| 88 | + apiKey: string, |
| 89 | + appId?: AppId |
| 90 | +): DownloadClientConfig { |
86 | 91 | const category = appId ? getCategoryForApp(appId) : "default" |
87 | 92 | const categoryField = appId ? getCategoryFieldName(appId) : "category" |
88 | 93 |
|
@@ -214,7 +219,11 @@ export class ArrApiClient { |
214 | 219 | return this.request<HostConfig>("/config/host") |
215 | 220 | } |
216 | 221 |
|
217 | | - async updateHostConfig(username: string, password: string, override = false): Promise<HostConfig | null> { |
| 222 | + async updateHostConfig( |
| 223 | + username: string, |
| 224 | + password: string, |
| 225 | + override = false |
| 226 | + ): Promise<HostConfig | null> { |
218 | 227 | // First get current config to preserve all other settings |
219 | 228 | const currentConfig = await this.getHostConfig() |
220 | 229 |
|
@@ -293,11 +302,15 @@ export class ArrApiClient { |
293 | 302 | // 3. Update configuration |
294 | 303 | await this.updateNamingConfig(newConfig) |
295 | 304 | } catch (e) { |
296 | | - throw new Error(`Failed to configure naming: ${e}`) |
| 305 | + throw new Error(`Failed to configure naming: ${e}`, { cause: e }) |
297 | 306 | } |
298 | 307 | } |
299 | 308 |
|
300 | | - async addRemotePathMapping(host: string, remotePath: string, localPath: string): Promise<RemotePathMapping> { |
| 309 | + async addRemotePathMapping( |
| 310 | + host: string, |
| 311 | + remotePath: string, |
| 312 | + localPath: string |
| 313 | + ): Promise<RemotePathMapping> { |
301 | 314 | return this.request<RemotePathMapping>("/remotepathmapping", { |
302 | 315 | method: "POST", |
303 | 316 | body: JSON.stringify({ host, remotePath, localPath }), |
|
0 commit comments