tsarr 2.7.4 → 2.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/lidarr.d.ts.map +1 -1
- package/dist/cli/commands/prowlarr.d.ts.map +1 -1
- package/dist/cli/commands/qbit.d.ts +1 -1
- package/dist/cli/commands/qbit.d.ts.map +1 -1
- package/dist/cli/commands/radarr.d.ts +1 -1
- package/dist/cli/commands/radarr.d.ts.map +1 -1
- package/dist/cli/commands/readarr.d.ts.map +1 -1
- package/dist/cli/commands/seerr.d.ts +1 -1
- package/dist/cli/commands/seerr.d.ts.map +1 -1
- package/dist/cli/commands/service.d.ts +6 -0
- package/dist/cli/commands/service.d.ts.map +1 -1
- package/dist/cli/commands/sonarr.d.ts +1 -1
- package/dist/cli/commands/sonarr.d.ts.map +1 -1
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/index.js +170 -297
- package/dist/clients/bazarr.d.ts +3 -2
- package/dist/clients/bazarr.d.ts.map +1 -1
- package/dist/clients/lidarr.d.ts +4 -3
- package/dist/clients/lidarr.d.ts.map +1 -1
- package/dist/clients/prowlarr.d.ts +4 -3
- package/dist/clients/prowlarr.d.ts.map +1 -1
- package/dist/clients/qbittorrent.d.ts +3 -2
- package/dist/clients/qbittorrent.d.ts.map +1 -1
- package/dist/clients/radarr.d.ts +4 -3
- package/dist/clients/radarr.d.ts.map +1 -1
- package/dist/clients/readarr.d.ts +4 -3
- package/dist/clients/readarr.d.ts.map +1 -1
- package/dist/clients/seerr.d.ts +4 -3
- package/dist/clients/seerr.d.ts.map +1 -1
- package/dist/clients/sonarr.d.ts +4 -3
- package/dist/clients/sonarr.d.ts.map +1 -1
- package/dist/core/client.d.ts +1 -1
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/types.d.ts +0 -5
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +17 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -41
- package/dist/tsarr-2.7.6.tgz +0 -0
- package/package.json +1 -1
- package/dist/core/response.d.ts +0 -13
- package/dist/core/response.d.ts.map +0 -1
- package/dist/tsarr-2.7.4.tgz +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -564,7 +564,7 @@ var init_dist = __esm(() => {
|
|
|
564
564
|
});
|
|
565
565
|
|
|
566
566
|
// src/core/errors.ts
|
|
567
|
-
var TsarrError, ApiKeyError, ConnectionError
|
|
567
|
+
var TsarrError, ApiKeyError, ConnectionError;
|
|
568
568
|
var init_errors = __esm(() => {
|
|
569
569
|
TsarrError = class TsarrError extends Error {
|
|
570
570
|
code;
|
|
@@ -590,12 +590,6 @@ var init_errors = __esm(() => {
|
|
|
590
590
|
this.name = "ConnectionError";
|
|
591
591
|
}
|
|
592
592
|
};
|
|
593
|
-
NotFoundError = class NotFoundError extends TsarrError {
|
|
594
|
-
constructor(resource) {
|
|
595
|
-
super(`Resource not found: ${resource}`, "NOT_FOUND", 404);
|
|
596
|
-
this.name = "NotFoundError";
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
593
|
});
|
|
600
594
|
|
|
601
595
|
// src/core/client.ts
|
|
@@ -4882,11 +4876,7 @@ function normalizeConfig(config) {
|
|
|
4882
4876
|
function readJsonFile(path) {
|
|
4883
4877
|
if (!existsSync(path))
|
|
4884
4878
|
return {};
|
|
4885
|
-
|
|
4886
|
-
return normalizeConfig(JSON.parse(readFileSync(path, "utf-8")));
|
|
4887
|
-
} catch {
|
|
4888
|
-
return {};
|
|
4889
|
-
}
|
|
4879
|
+
return normalizeConfig(JSON.parse(readFileSync(path, "utf-8")));
|
|
4890
4880
|
}
|
|
4891
4881
|
function getEnvConfig() {
|
|
4892
4882
|
const services = {};
|
|
@@ -5293,14 +5283,10 @@ function formatBytes(bytes) {
|
|
|
5293
5283
|
function formatDate(value) {
|
|
5294
5284
|
if (typeof value !== "string" && !(value instanceof Date))
|
|
5295
5285
|
return String(value);
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
if (Number.isNaN(d2.getTime()))
|
|
5299
|
-
return String(value);
|
|
5300
|
-
return d2.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
5301
|
-
} catch {
|
|
5286
|
+
const d2 = new Date(value);
|
|
5287
|
+
if (Number.isNaN(d2.getTime()))
|
|
5302
5288
|
return String(value);
|
|
5303
|
-
}
|
|
5289
|
+
return d2.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
5304
5290
|
}
|
|
5305
5291
|
function stripAnsi3(str) {
|
|
5306
5292
|
return str.replace(ANSI_PATTERN, "");
|
|
@@ -5322,6 +5308,7 @@ var init_output = __esm(() => {
|
|
|
5322
5308
|
});
|
|
5323
5309
|
|
|
5324
5310
|
// src/cli/commands/service.ts
|
|
5311
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
5325
5312
|
function limitResults(results, limit) {
|
|
5326
5313
|
if (limit === undefined)
|
|
5327
5314
|
return results;
|
|
@@ -5409,6 +5396,12 @@ function buildServiceCommand(serviceName, description, clientFactory, resources)
|
|
|
5409
5396
|
const raw = await action.run(client2, resolvedArgs);
|
|
5410
5397
|
if (raw?.error !== undefined) {
|
|
5411
5398
|
const err = raw.error;
|
|
5399
|
+
const networkMsg = classifyNetworkError(err, serviceName);
|
|
5400
|
+
if (networkMsg) {
|
|
5401
|
+
consola.error(`${networkMsg}
|
|
5402
|
+
Run \`tsarr doctor\` to diagnose.`);
|
|
5403
|
+
process.exit(1);
|
|
5404
|
+
}
|
|
5412
5405
|
const status = err?.status ?? raw?.response?.status;
|
|
5413
5406
|
if (status === 401) {
|
|
5414
5407
|
const authHint = serviceName === "qbittorrent" ? "Check your username and password." : `Check your API key.
|
|
@@ -5416,18 +5409,6 @@ Run \`tsarr config init\` or set TSARR_${serviceName.toUpperCase()}_API_KEY`;
|
|
|
5416
5409
|
consola.error(`Unauthorized. ${authHint}`);
|
|
5417
5410
|
} else if (status === 404) {
|
|
5418
5411
|
consola.error("Not found.");
|
|
5419
|
-
} else if (!status && err?.code) {
|
|
5420
|
-
const code = err.code;
|
|
5421
|
-
if (code === "ConnectionRefused" || code === "ECONNREFUSED") {
|
|
5422
|
-
consola.error(`Connection refused. Is ${serviceName} running?
|
|
5423
|
-
Run \`tsarr doctor\` to diagnose.`);
|
|
5424
|
-
} else if (code === "ConnectionReset" || code === "ECONNRESET") {
|
|
5425
|
-
consola.error(`Connection reset. ${serviceName} may have crashed.
|
|
5426
|
-
Run \`tsarr doctor\` to diagnose.`);
|
|
5427
|
-
} else {
|
|
5428
|
-
consola.error(`${err?.message ?? `Network error (${code})`}
|
|
5429
|
-
Run \`tsarr doctor\` to diagnose.`);
|
|
5430
|
-
}
|
|
5431
5412
|
} else {
|
|
5432
5413
|
consola.error(err?.title ?? err?.message ?? `API error (${status ?? "unknown"})`);
|
|
5433
5414
|
}
|
|
@@ -5480,6 +5461,44 @@ Run \`tsarr doctor\` to diagnose.`);
|
|
|
5480
5461
|
subCommands
|
|
5481
5462
|
});
|
|
5482
5463
|
}
|
|
5464
|
+
function unwrapData(result) {
|
|
5465
|
+
return result?.data ?? result;
|
|
5466
|
+
}
|
|
5467
|
+
function readJsonInput(filePath) {
|
|
5468
|
+
const raw = filePath === "-" ? readFileSync2(0, "utf-8") : readFileSync2(filePath, "utf-8");
|
|
5469
|
+
return JSON.parse(raw);
|
|
5470
|
+
}
|
|
5471
|
+
function parseBooleanArg(value, fallback) {
|
|
5472
|
+
if (value === undefined)
|
|
5473
|
+
return fallback;
|
|
5474
|
+
if (typeof value === "boolean")
|
|
5475
|
+
return value;
|
|
5476
|
+
if (typeof value === "string") {
|
|
5477
|
+
const normalized = value.trim().toLowerCase();
|
|
5478
|
+
if (normalized === "true")
|
|
5479
|
+
return true;
|
|
5480
|
+
if (normalized === "false")
|
|
5481
|
+
return false;
|
|
5482
|
+
}
|
|
5483
|
+
return Boolean(value);
|
|
5484
|
+
}
|
|
5485
|
+
function resolveQualityProfileId(profiles, profileId) {
|
|
5486
|
+
const profile = profiles.find((item) => item?.id === profileId);
|
|
5487
|
+
if (!profile) {
|
|
5488
|
+
throw new Error(`Quality profile ${profileId} was not found.`);
|
|
5489
|
+
}
|
|
5490
|
+
return profileId;
|
|
5491
|
+
}
|
|
5492
|
+
function resolveRootFolderPath(folders, rootFolderPath) {
|
|
5493
|
+
const folder = folders.find((item) => item?.path === rootFolderPath);
|
|
5494
|
+
if (!folder) {
|
|
5495
|
+
throw new Error(`Root folder "${rootFolderPath}" was not found.`);
|
|
5496
|
+
}
|
|
5497
|
+
return rootFolderPath;
|
|
5498
|
+
}
|
|
5499
|
+
function getApiStatus(result) {
|
|
5500
|
+
return result?.error?.status ?? result?.response?.status;
|
|
5501
|
+
}
|
|
5483
5502
|
function coerceBooleanArg(value) {
|
|
5484
5503
|
if (typeof value === "boolean")
|
|
5485
5504
|
return value;
|
|
@@ -5520,8 +5539,6 @@ Run \`tsarr config init\` or set TSARR_${serviceName.toUpperCase()}_API_KEY`);
|
|
|
5520
5539
|
} else if (error instanceof ConnectionError) {
|
|
5521
5540
|
consola.error(`Connection error: ${error.message}
|
|
5522
5541
|
Run \`tsarr doctor\` to diagnose.`);
|
|
5523
|
-
} else if (error instanceof NotFoundError) {
|
|
5524
|
-
consola.error(error.message);
|
|
5525
5542
|
} else if (error instanceof TsarrError) {
|
|
5526
5543
|
consola.error(`Error: ${error.message}`);
|
|
5527
5544
|
} else if (error instanceof Error) {
|
|
@@ -5538,9 +5555,12 @@ Run \`tsarr doctor\` to diagnose.`);
|
|
|
5538
5555
|
process.exit(1);
|
|
5539
5556
|
}
|
|
5540
5557
|
function classifyNetworkError(error, serviceName) {
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
const
|
|
5558
|
+
if (!error || typeof error !== "object")
|
|
5559
|
+
return null;
|
|
5560
|
+
const err = error;
|
|
5561
|
+
const cause = err.cause;
|
|
5562
|
+
const code = cause?.code ?? err.code;
|
|
5563
|
+
const msg = err.message ?? "";
|
|
5544
5564
|
if (code === "ECONNREFUSED" || code === "ConnectionRefused") {
|
|
5545
5565
|
return `Connection refused. Is ${serviceName} running?`;
|
|
5546
5566
|
}
|
|
@@ -5575,51 +5595,12 @@ __export(exports_radarr3, {
|
|
|
5575
5595
|
resources: () => resources,
|
|
5576
5596
|
radarr: () => radarr
|
|
5577
5597
|
});
|
|
5578
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
5579
|
-
function unwrapData(result) {
|
|
5580
|
-
return result?.data ?? result;
|
|
5581
|
-
}
|
|
5582
|
-
function parseBooleanArg(value, fallback) {
|
|
5583
|
-
if (value === undefined)
|
|
5584
|
-
return fallback;
|
|
5585
|
-
if (typeof value === "boolean")
|
|
5586
|
-
return value;
|
|
5587
|
-
if (typeof value === "string") {
|
|
5588
|
-
const normalized = value.trim().toLowerCase();
|
|
5589
|
-
if (normalized === "true")
|
|
5590
|
-
return true;
|
|
5591
|
-
if (normalized === "false")
|
|
5592
|
-
return false;
|
|
5593
|
-
}
|
|
5594
|
-
return Boolean(value);
|
|
5595
|
-
}
|
|
5596
|
-
function resolveQualityProfileId(profiles, profileId) {
|
|
5597
|
-
const profile = profiles.find((item) => item?.id === profileId);
|
|
5598
|
-
if (!profile) {
|
|
5599
|
-
throw new Error(`Quality profile ${profileId} was not found.`);
|
|
5600
|
-
}
|
|
5601
|
-
return profileId;
|
|
5602
|
-
}
|
|
5603
|
-
function resolveRootFolderPath(folders, rootFolderPath) {
|
|
5604
|
-
const folder = folders.find((item) => item?.path === rootFolderPath);
|
|
5605
|
-
if (!folder) {
|
|
5606
|
-
throw new Error(`Root folder "${rootFolderPath}" was not found.`);
|
|
5607
|
-
}
|
|
5608
|
-
return rootFolderPath;
|
|
5609
|
-
}
|
|
5610
5598
|
async function findMovieByTmdbId(client2, tmdbId) {
|
|
5611
5599
|
if (tmdbId === undefined)
|
|
5612
5600
|
return;
|
|
5613
5601
|
const movies = unwrapData(await client2.getMovies());
|
|
5614
5602
|
return movies.find((movie) => movie?.tmdbId === tmdbId);
|
|
5615
5603
|
}
|
|
5616
|
-
function getApiStatus(result) {
|
|
5617
|
-
return result?.error?.status ?? result?.response?.status;
|
|
5618
|
-
}
|
|
5619
|
-
function readJsonInput(filePath) {
|
|
5620
|
-
const raw = filePath === "-" ? readFileSync2(0, "utf-8") : readFileSync2(filePath, "utf-8");
|
|
5621
|
-
return JSON.parse(raw);
|
|
5622
|
-
}
|
|
5623
5604
|
var resources, radarr;
|
|
5624
5605
|
var init_radarr3 = __esm(() => {
|
|
5625
5606
|
init_radarr2();
|
|
@@ -8687,38 +8668,6 @@ __export(exports_sonarr3, {
|
|
|
8687
8668
|
sonarr: () => sonarr,
|
|
8688
8669
|
resources: () => resources2
|
|
8689
8670
|
});
|
|
8690
|
-
import { readFileSync as readFileSync3 } from "node:fs";
|
|
8691
|
-
function unwrapData2(result) {
|
|
8692
|
-
return result?.data ?? result;
|
|
8693
|
-
}
|
|
8694
|
-
function parseBooleanArg2(value, fallback) {
|
|
8695
|
-
if (value === undefined)
|
|
8696
|
-
return fallback;
|
|
8697
|
-
if (typeof value === "boolean")
|
|
8698
|
-
return value;
|
|
8699
|
-
if (typeof value === "string") {
|
|
8700
|
-
const normalized = value.trim().toLowerCase();
|
|
8701
|
-
if (normalized === "true")
|
|
8702
|
-
return true;
|
|
8703
|
-
if (normalized === "false")
|
|
8704
|
-
return false;
|
|
8705
|
-
}
|
|
8706
|
-
return Boolean(value);
|
|
8707
|
-
}
|
|
8708
|
-
function resolveQualityProfileId2(profiles, profileId) {
|
|
8709
|
-
const profile = profiles.find((item) => item?.id === profileId);
|
|
8710
|
-
if (!profile) {
|
|
8711
|
-
throw new Error(`Quality profile ${profileId} was not found.`);
|
|
8712
|
-
}
|
|
8713
|
-
return profileId;
|
|
8714
|
-
}
|
|
8715
|
-
function resolveRootFolderPath2(folders, rootFolderPath) {
|
|
8716
|
-
const folder = folders.find((item) => item?.path === rootFolderPath);
|
|
8717
|
-
if (!folder) {
|
|
8718
|
-
throw new Error(`Root folder "${rootFolderPath}" was not found.`);
|
|
8719
|
-
}
|
|
8720
|
-
return rootFolderPath;
|
|
8721
|
-
}
|
|
8722
8671
|
function formatSeriesListItem(series) {
|
|
8723
8672
|
const seasons = Array.isArray(series?.seasons) ? series.seasons.filter((season) => season?.seasonNumber !== 0) : [];
|
|
8724
8673
|
const statistics = series?.statistics ?? {};
|
|
@@ -8731,26 +8680,19 @@ function formatSeriesListItem(series) {
|
|
|
8731
8680
|
};
|
|
8732
8681
|
}
|
|
8733
8682
|
async function lookupSeriesByTvdbId(client3, tvdbId) {
|
|
8734
|
-
const tvdbSearch =
|
|
8683
|
+
const tvdbSearch = unwrapData(await client3.searchSeries(`tvdb:${tvdbId}`));
|
|
8735
8684
|
const exactTvdbMatch = tvdbSearch.find((series) => series?.tvdbId === tvdbId);
|
|
8736
8685
|
if (exactTvdbMatch)
|
|
8737
8686
|
return exactTvdbMatch;
|
|
8738
|
-
const fallbackSearch =
|
|
8687
|
+
const fallbackSearch = unwrapData(await client3.searchSeries(String(tvdbId)));
|
|
8739
8688
|
return fallbackSearch.find((series) => series?.tvdbId === tvdbId);
|
|
8740
8689
|
}
|
|
8741
8690
|
async function findSeriesByTvdbId(client3, tvdbId) {
|
|
8742
8691
|
if (tvdbId === undefined)
|
|
8743
8692
|
return;
|
|
8744
|
-
const series =
|
|
8693
|
+
const series = unwrapData(await client3.getSeries());
|
|
8745
8694
|
return series.find((item) => item?.tvdbId === tvdbId);
|
|
8746
8695
|
}
|
|
8747
|
-
function getApiStatus2(result) {
|
|
8748
|
-
return result?.error?.status ?? result?.response?.status;
|
|
8749
|
-
}
|
|
8750
|
-
function readJsonInput2(filePath) {
|
|
8751
|
-
const raw = filePath === "-" ? readFileSync3(0, "utf-8") : readFileSync3(filePath, "utf-8");
|
|
8752
|
-
return JSON.parse(raw);
|
|
8753
|
-
}
|
|
8754
8696
|
var resources2, sonarr;
|
|
8755
8697
|
var init_sonarr3 = __esm(() => {
|
|
8756
8698
|
init_sonarr2();
|
|
@@ -8775,7 +8717,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
8775
8717
|
"status"
|
|
8776
8718
|
],
|
|
8777
8719
|
run: async (c3) => {
|
|
8778
|
-
const series =
|
|
8720
|
+
const series = unwrapData(await c3.getSeries());
|
|
8779
8721
|
return series.map(formatSeriesListItem);
|
|
8780
8722
|
}
|
|
8781
8723
|
},
|
|
@@ -8795,7 +8737,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
8795
8737
|
],
|
|
8796
8738
|
run: async (c3, a2) => {
|
|
8797
8739
|
const result = await c3.getSeriesById(a2.id);
|
|
8798
|
-
const series =
|
|
8740
|
+
const series = unwrapData(result);
|
|
8799
8741
|
return formatSeriesListItem(series);
|
|
8800
8742
|
}
|
|
8801
8743
|
},
|
|
@@ -8808,7 +8750,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
8808
8750
|
],
|
|
8809
8751
|
columns: ["tvdbId", "title", "year", "overview"],
|
|
8810
8752
|
run: async (c3, a2) => {
|
|
8811
|
-
const results =
|
|
8753
|
+
const results = unwrapData(await c3.searchSeries(a2.term));
|
|
8812
8754
|
return limitResults(results, a2.limit);
|
|
8813
8755
|
}
|
|
8814
8756
|
},
|
|
@@ -8832,7 +8774,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
8832
8774
|
} else {
|
|
8833
8775
|
const term = await promptIfMissing(a2.term, "Search term:");
|
|
8834
8776
|
const searchResult = await c3.searchSeries(term);
|
|
8835
|
-
const results =
|
|
8777
|
+
const results = unwrapData(searchResult);
|
|
8836
8778
|
if (!Array.isArray(results) || results.length === 0) {
|
|
8837
8779
|
throw new Error("No series found.");
|
|
8838
8780
|
}
|
|
@@ -8846,17 +8788,17 @@ var init_sonarr3 = __esm(() => {
|
|
|
8846
8788
|
}
|
|
8847
8789
|
}
|
|
8848
8790
|
const profilesResult = await c3.getQualityProfiles();
|
|
8849
|
-
const profiles =
|
|
8791
|
+
const profiles = unwrapData(profilesResult);
|
|
8850
8792
|
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
8851
8793
|
throw new Error("No quality profiles found. Configure one in Sonarr first.");
|
|
8852
8794
|
}
|
|
8853
|
-
const profileId = a2["quality-profile-id"] !== undefined ?
|
|
8795
|
+
const profileId = a2["quality-profile-id"] !== undefined ? resolveQualityProfileId(profiles, a2["quality-profile-id"]) : Number(await promptSelect("Select quality profile:", profiles.map((p) => ({ label: p.name, value: String(p.id) }))));
|
|
8854
8796
|
const foldersResult = await c3.getRootFolders();
|
|
8855
|
-
const folders =
|
|
8797
|
+
const folders = unwrapData(foldersResult);
|
|
8856
8798
|
if (!Array.isArray(folders) || folders.length === 0) {
|
|
8857
8799
|
throw new Error("No root folders found. Configure one in Sonarr first.");
|
|
8858
8800
|
}
|
|
8859
|
-
const rootFolderPath = a2["root-folder"] !== undefined ?
|
|
8801
|
+
const rootFolderPath = a2["root-folder"] !== undefined ? resolveRootFolderPath(folders, a2["root-folder"]) : await promptSelect("Select root folder:", folders.map((f3) => ({ label: f3.path, value: f3.path })));
|
|
8860
8802
|
const confirmed = await promptConfirm(`Add "${series.title} (${series.year})"?`, !!a2.yes);
|
|
8861
8803
|
if (!confirmed)
|
|
8862
8804
|
throw new Error("Cancelled.");
|
|
@@ -8864,10 +8806,10 @@ var init_sonarr3 = __esm(() => {
|
|
|
8864
8806
|
...series,
|
|
8865
8807
|
qualityProfileId: profileId,
|
|
8866
8808
|
rootFolderPath,
|
|
8867
|
-
monitored:
|
|
8809
|
+
monitored: parseBooleanArg(a2.monitored, true),
|
|
8868
8810
|
addOptions: { searchForMissingEpisodes: true }
|
|
8869
8811
|
});
|
|
8870
|
-
if (addResult?.error &&
|
|
8812
|
+
if (addResult?.error && getApiStatus(addResult) === 400) {
|
|
8871
8813
|
const existingSeries = await findSeriesByTvdbId(c3, series.tvdbId);
|
|
8872
8814
|
if (existingSeries) {
|
|
8873
8815
|
throw new Error(`${existingSeries.title} is already in your library (ID: ${existingSeries.id})`);
|
|
@@ -8929,7 +8871,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
8929
8871
|
const seriesResult = await c3.getSeriesById(a2.id);
|
|
8930
8872
|
if (seriesResult?.error)
|
|
8931
8873
|
return seriesResult;
|
|
8932
|
-
const series =
|
|
8874
|
+
const series = unwrapData(seriesResult);
|
|
8933
8875
|
const deleteResult = await c3.deleteSeries(a2.id, {
|
|
8934
8876
|
deleteFiles: a2["delete-files"],
|
|
8935
8877
|
addImportListExclusion: a2["add-import-list-exclusion"]
|
|
@@ -9030,7 +8972,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9030
8972
|
const tagResult = await c3.getTag(a2.id);
|
|
9031
8973
|
if (tagResult?.error)
|
|
9032
8974
|
return tagResult;
|
|
9033
|
-
const tag =
|
|
8975
|
+
const tag = unwrapData(tagResult);
|
|
9034
8976
|
const deleteResult = await c3.deleteTag(a2.id);
|
|
9035
8977
|
if (deleteResult?.error)
|
|
9036
8978
|
return deleteResult;
|
|
@@ -9100,7 +9042,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9100
9042
|
run: async (c3, a2) => {
|
|
9101
9043
|
if (a2.since) {
|
|
9102
9044
|
const result2 = await c3.getHistorySince(a2.since, a2["series-id"]);
|
|
9103
|
-
const items2 =
|
|
9045
|
+
const items2 = unwrapData(result2);
|
|
9104
9046
|
if (a2.until) {
|
|
9105
9047
|
const untilDate = new Date(a2.until);
|
|
9106
9048
|
return items2.filter((item) => new Date(item.date) <= untilDate);
|
|
@@ -9108,7 +9050,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9108
9050
|
return items2;
|
|
9109
9051
|
}
|
|
9110
9052
|
const result = await c3.getHistory(undefined, undefined, undefined, undefined, a2["series-id"]);
|
|
9111
|
-
const items =
|
|
9053
|
+
const items = unwrapData(result);
|
|
9112
9054
|
if (a2.until) {
|
|
9113
9055
|
const untilDate = new Date(a2.until);
|
|
9114
9056
|
return items.filter((item) => new Date(item.date) <= untilDate);
|
|
@@ -9158,7 +9100,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9158
9100
|
columns: ["id", "seriesTitle", "title", "seasonNumber", "episodeNumber", "airDateUtc"],
|
|
9159
9101
|
run: async (c3, a2) => {
|
|
9160
9102
|
const result = await c3.getCalendar(a2.start, a2.end, a2.unmonitored);
|
|
9161
|
-
const episodes =
|
|
9103
|
+
const episodes = unwrapData(result);
|
|
9162
9104
|
return episodes.map((ep) => ({
|
|
9163
9105
|
...ep,
|
|
9164
9106
|
seriesTitle: ep.seriesTitle || ep.series?.title || "—"
|
|
@@ -9187,7 +9129,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9187
9129
|
name: "add",
|
|
9188
9130
|
description: "Add a notification from JSON file or stdin",
|
|
9189
9131
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
9190
|
-
run: async (c3, a2) => c3.addNotification(
|
|
9132
|
+
run: async (c3, a2) => c3.addNotification(readJsonInput(a2.file))
|
|
9191
9133
|
},
|
|
9192
9134
|
{
|
|
9193
9135
|
name: "edit",
|
|
@@ -9197,8 +9139,8 @@ var init_sonarr3 = __esm(() => {
|
|
|
9197
9139
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
9198
9140
|
],
|
|
9199
9141
|
run: async (c3, a2) => {
|
|
9200
|
-
const existing =
|
|
9201
|
-
return c3.updateNotification(a2.id, { ...existing, ...
|
|
9142
|
+
const existing = unwrapData(await c3.getNotification(a2.id));
|
|
9143
|
+
return c3.updateNotification(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
9202
9144
|
}
|
|
9203
9145
|
},
|
|
9204
9146
|
{
|
|
@@ -9235,7 +9177,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9235
9177
|
name: "add",
|
|
9236
9178
|
description: "Add a download client from JSON file or stdin",
|
|
9237
9179
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
9238
|
-
run: async (c3, a2) => c3.addDownloadClient(
|
|
9180
|
+
run: async (c3, a2) => c3.addDownloadClient(readJsonInput(a2.file))
|
|
9239
9181
|
},
|
|
9240
9182
|
{
|
|
9241
9183
|
name: "edit",
|
|
@@ -9245,8 +9187,8 @@ var init_sonarr3 = __esm(() => {
|
|
|
9245
9187
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
9246
9188
|
],
|
|
9247
9189
|
run: async (c3, a2) => {
|
|
9248
|
-
const existing =
|
|
9249
|
-
return c3.updateDownloadClient(a2.id, { ...existing, ...
|
|
9190
|
+
const existing = unwrapData(await c3.getDownloadClient(a2.id));
|
|
9191
|
+
return c3.updateDownloadClient(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
9250
9192
|
}
|
|
9251
9193
|
},
|
|
9252
9194
|
{
|
|
@@ -9320,7 +9262,7 @@ var init_sonarr3 = __esm(() => {
|
|
|
9320
9262
|
name: "add",
|
|
9321
9263
|
description: "Add an import list from JSON file or stdin",
|
|
9322
9264
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
9323
|
-
run: async (c3, a2) => c3.addImportList(
|
|
9265
|
+
run: async (c3, a2) => c3.addImportList(readJsonInput(a2.file))
|
|
9324
9266
|
},
|
|
9325
9267
|
{
|
|
9326
9268
|
name: "edit",
|
|
@@ -9330,8 +9272,8 @@ var init_sonarr3 = __esm(() => {
|
|
|
9330
9272
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
9331
9273
|
],
|
|
9332
9274
|
run: async (c3, a2) => {
|
|
9333
|
-
const existing =
|
|
9334
|
-
return c3.updateImportList(a2.id, { ...existing, ...
|
|
9275
|
+
const existing = unwrapData(await c3.getImportList(a2.id));
|
|
9276
|
+
return c3.updateImportList(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
9335
9277
|
}
|
|
9336
9278
|
},
|
|
9337
9279
|
{
|
|
@@ -11839,38 +11781,12 @@ var exports_lidarr3 = {};
|
|
|
11839
11781
|
__export(exports_lidarr3, {
|
|
11840
11782
|
lidarr: () => lidarr
|
|
11841
11783
|
});
|
|
11842
|
-
|
|
11843
|
-
function unwrapData3(result) {
|
|
11844
|
-
return result?.data ?? result;
|
|
11845
|
-
}
|
|
11846
|
-
function formatAlbumListItem(album) {
|
|
11847
|
-
return {
|
|
11848
|
-
...album,
|
|
11849
|
-
artistName: album?.artistName ?? album?.artist?.artistName ?? "—"
|
|
11850
|
-
};
|
|
11851
|
-
}
|
|
11852
|
-
function formatQueueListItem(item) {
|
|
11784
|
+
function withArtistName(item) {
|
|
11853
11785
|
return {
|
|
11854
11786
|
...item,
|
|
11855
11787
|
artistName: item?.artistName ?? item?.artist?.artistName ?? "—"
|
|
11856
11788
|
};
|
|
11857
11789
|
}
|
|
11858
|
-
function formatHistoryListItem(item) {
|
|
11859
|
-
return {
|
|
11860
|
-
...item,
|
|
11861
|
-
artistName: item?.artistName ?? item?.artist?.artistName ?? "—"
|
|
11862
|
-
};
|
|
11863
|
-
}
|
|
11864
|
-
function formatBlocklistItem(item) {
|
|
11865
|
-
return {
|
|
11866
|
-
...item,
|
|
11867
|
-
artistName: item?.artistName ?? item?.artist?.artistName ?? "—"
|
|
11868
|
-
};
|
|
11869
|
-
}
|
|
11870
|
-
function readJsonInput3(filePath) {
|
|
11871
|
-
const raw = filePath === "-" ? readFileSync4(0, "utf-8") : readFileSync4(filePath, "utf-8");
|
|
11872
|
-
return JSON.parse(raw);
|
|
11873
|
-
}
|
|
11874
11790
|
var resources3, lidarr;
|
|
11875
11791
|
var init_lidarr3 = __esm(() => {
|
|
11876
11792
|
init_lidarr2();
|
|
@@ -11906,7 +11822,7 @@ var init_lidarr3 = __esm(() => {
|
|
|
11906
11822
|
description: "Search and add an artist",
|
|
11907
11823
|
args: [{ name: "term", description: "Search term", required: true }],
|
|
11908
11824
|
run: async (c3, a2) => {
|
|
11909
|
-
const results =
|
|
11825
|
+
const results = unwrapData(await c3.searchArtists(a2.term));
|
|
11910
11826
|
if (!Array.isArray(results) || results.length === 0) {
|
|
11911
11827
|
throw new Error("No artists found.");
|
|
11912
11828
|
}
|
|
@@ -11918,12 +11834,12 @@ var init_lidarr3 = __esm(() => {
|
|
|
11918
11834
|
if (!artist) {
|
|
11919
11835
|
throw new Error("Selected artist was not found in the search results.");
|
|
11920
11836
|
}
|
|
11921
|
-
const profiles =
|
|
11837
|
+
const profiles = unwrapData(await c3.getQualityProfiles());
|
|
11922
11838
|
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
11923
11839
|
throw new Error("No quality profiles found. Configure one in Lidarr first.");
|
|
11924
11840
|
}
|
|
11925
11841
|
const profileId = await promptSelect("Select quality profile:", profiles.map((profile) => ({ label: profile.name, value: String(profile.id) })));
|
|
11926
|
-
const folders =
|
|
11842
|
+
const folders = unwrapData(await c3.getRootFolders());
|
|
11927
11843
|
if (!Array.isArray(folders) || folders.length === 0) {
|
|
11928
11844
|
throw new Error("No root folders found. Configure one in Lidarr first.");
|
|
11929
11845
|
}
|
|
@@ -11950,7 +11866,7 @@ var init_lidarr3 = __esm(() => {
|
|
|
11950
11866
|
{ name: "tags", description: "Comma-separated tag IDs" }
|
|
11951
11867
|
],
|
|
11952
11868
|
run: async (c3, a2) => {
|
|
11953
|
-
const artist =
|
|
11869
|
+
const artist = unwrapData(await c3.getArtist(a2.id));
|
|
11954
11870
|
const updates = { ...artist };
|
|
11955
11871
|
if (a2.monitored !== undefined)
|
|
11956
11872
|
updates.monitored = a2.monitored === "true";
|
|
@@ -11995,8 +11911,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
11995
11911
|
description: "List all albums",
|
|
11996
11912
|
columns: ["id", "artistName", "title", "monitored"],
|
|
11997
11913
|
run: async (c3) => {
|
|
11998
|
-
const albums =
|
|
11999
|
-
return albums.map(
|
|
11914
|
+
const albums = unwrapData(await c3.getAlbums());
|
|
11915
|
+
return albums.map(withArtistName);
|
|
12000
11916
|
}
|
|
12001
11917
|
},
|
|
12002
11918
|
{
|
|
@@ -12004,8 +11920,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12004
11920
|
description: "Get an album by ID",
|
|
12005
11921
|
args: [{ name: "id", description: "Album ID", required: true, type: "number" }],
|
|
12006
11922
|
run: async (c3, a2) => {
|
|
12007
|
-
const album =
|
|
12008
|
-
return
|
|
11923
|
+
const album = unwrapData(await c3.getAlbum(a2.id));
|
|
11924
|
+
return withArtistName(album);
|
|
12009
11925
|
}
|
|
12010
11926
|
},
|
|
12011
11927
|
{
|
|
@@ -12015,15 +11931,15 @@ var init_lidarr3 = __esm(() => {
|
|
|
12015
11931
|
columns: ["foreignAlbumId", "artistName", "title", "monitored"],
|
|
12016
11932
|
idField: "foreignAlbumId",
|
|
12017
11933
|
run: async (c3, a2) => {
|
|
12018
|
-
const albums =
|
|
12019
|
-
return albums.map(
|
|
11934
|
+
const albums = unwrapData(await c3.searchAlbums(a2.term));
|
|
11935
|
+
return albums.map(withArtistName);
|
|
12020
11936
|
}
|
|
12021
11937
|
},
|
|
12022
11938
|
{
|
|
12023
11939
|
name: "add",
|
|
12024
11940
|
description: "Add an album from JSON file or stdin",
|
|
12025
11941
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
12026
|
-
run: async (c3, a2) => c3.addAlbum(
|
|
11942
|
+
run: async (c3, a2) => c3.addAlbum(readJsonInput(a2.file))
|
|
12027
11943
|
},
|
|
12028
11944
|
{
|
|
12029
11945
|
name: "edit",
|
|
@@ -12033,8 +11949,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12033
11949
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
12034
11950
|
],
|
|
12035
11951
|
run: async (c3, a2) => {
|
|
12036
|
-
const existing =
|
|
12037
|
-
return c3.updateAlbum(a2.id, { ...existing, ...
|
|
11952
|
+
const existing = unwrapData(await c3.getAlbum(a2.id));
|
|
11953
|
+
return c3.updateAlbum(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
12038
11954
|
}
|
|
12039
11955
|
},
|
|
12040
11956
|
{
|
|
@@ -12109,7 +12025,7 @@ var init_lidarr3 = __esm(() => {
|
|
|
12109
12025
|
const tagResult = await c3.getTag(a2.id);
|
|
12110
12026
|
if (tagResult?.error)
|
|
12111
12027
|
return tagResult;
|
|
12112
|
-
const tag =
|
|
12028
|
+
const tag = unwrapData(tagResult);
|
|
12113
12029
|
const deleteResult = await c3.deleteTag(a2.id);
|
|
12114
12030
|
if (deleteResult?.error)
|
|
12115
12031
|
return deleteResult;
|
|
@@ -12133,8 +12049,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12133
12049
|
description: "List queue items",
|
|
12134
12050
|
columns: ["id", "artistName", "title", "status", "sizeleft", "timeleft"],
|
|
12135
12051
|
run: async (c3) => {
|
|
12136
|
-
const items =
|
|
12137
|
-
return items.map(
|
|
12052
|
+
const items = unwrapData(await c3.getQueue());
|
|
12053
|
+
return items.map(withArtistName);
|
|
12138
12054
|
}
|
|
12139
12055
|
},
|
|
12140
12056
|
{
|
|
@@ -12178,9 +12094,9 @@ var init_lidarr3 = __esm(() => {
|
|
|
12178
12094
|
],
|
|
12179
12095
|
columns: ["id", "artistName", "sourceTitle", "eventType", "date"],
|
|
12180
12096
|
run: async (c3, a2) => {
|
|
12181
|
-
const items = a2.since ?
|
|
12097
|
+
const items = a2.since ? unwrapData(await c3.getHistorySince(a2.since)) : unwrapData(await c3.getHistory());
|
|
12182
12098
|
const filtered = a2.until ? items.filter((item) => new Date(item.date) <= new Date(a2.until)) : items;
|
|
12183
|
-
return filtered.map(
|
|
12099
|
+
return filtered.map(withArtistName);
|
|
12184
12100
|
}
|
|
12185
12101
|
}
|
|
12186
12102
|
]
|
|
@@ -12199,8 +12115,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12199
12115
|
],
|
|
12200
12116
|
columns: ["id", "artistName", "title", "releaseDate"],
|
|
12201
12117
|
run: async (c3, a2) => {
|
|
12202
|
-
const albums =
|
|
12203
|
-
return albums.map(
|
|
12118
|
+
const albums = unwrapData(await c3.getCalendar(a2.start, a2.end, a2.unmonitored));
|
|
12119
|
+
return albums.map(withArtistName);
|
|
12204
12120
|
}
|
|
12205
12121
|
}
|
|
12206
12122
|
]
|
|
@@ -12225,7 +12141,7 @@ var init_lidarr3 = __esm(() => {
|
|
|
12225
12141
|
name: "add",
|
|
12226
12142
|
description: "Add a notification from JSON file or stdin",
|
|
12227
12143
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
12228
|
-
run: async (c3, a2) => c3.addNotification(
|
|
12144
|
+
run: async (c3, a2) => c3.addNotification(readJsonInput(a2.file))
|
|
12229
12145
|
},
|
|
12230
12146
|
{
|
|
12231
12147
|
name: "edit",
|
|
@@ -12235,8 +12151,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12235
12151
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
12236
12152
|
],
|
|
12237
12153
|
run: async (c3, a2) => {
|
|
12238
|
-
const existing =
|
|
12239
|
-
return c3.updateNotification(a2.id, { ...existing, ...
|
|
12154
|
+
const existing = unwrapData(await c3.getNotification(a2.id));
|
|
12155
|
+
return c3.updateNotification(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
12240
12156
|
}
|
|
12241
12157
|
},
|
|
12242
12158
|
{
|
|
@@ -12273,7 +12189,7 @@ var init_lidarr3 = __esm(() => {
|
|
|
12273
12189
|
name: "add",
|
|
12274
12190
|
description: "Add a download client from JSON file or stdin",
|
|
12275
12191
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
12276
|
-
run: async (c3, a2) => c3.addDownloadClient(
|
|
12192
|
+
run: async (c3, a2) => c3.addDownloadClient(readJsonInput(a2.file))
|
|
12277
12193
|
},
|
|
12278
12194
|
{
|
|
12279
12195
|
name: "edit",
|
|
@@ -12283,8 +12199,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12283
12199
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
12284
12200
|
],
|
|
12285
12201
|
run: async (c3, a2) => {
|
|
12286
|
-
const existing =
|
|
12287
|
-
return c3.updateDownloadClient(a2.id, { ...existing, ...
|
|
12202
|
+
const existing = unwrapData(await c3.getDownloadClient(a2.id));
|
|
12203
|
+
return c3.updateDownloadClient(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
12288
12204
|
}
|
|
12289
12205
|
},
|
|
12290
12206
|
{
|
|
@@ -12310,8 +12226,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12310
12226
|
description: "List blocked releases",
|
|
12311
12227
|
columns: ["id", "artistName", "sourceTitle", "date"],
|
|
12312
12228
|
run: async (c3) => {
|
|
12313
|
-
const items =
|
|
12314
|
-
return items.map(
|
|
12229
|
+
const items = unwrapData(await c3.getBlocklist());
|
|
12230
|
+
return items.map(withArtistName);
|
|
12315
12231
|
}
|
|
12316
12232
|
},
|
|
12317
12233
|
{
|
|
@@ -12332,8 +12248,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12332
12248
|
description: "List albums with missing tracks",
|
|
12333
12249
|
columns: ["id", "artistName", "title", "releaseDate"],
|
|
12334
12250
|
run: async (c3) => {
|
|
12335
|
-
const albums =
|
|
12336
|
-
return albums.map(
|
|
12251
|
+
const albums = unwrapData(await c3.getWantedMissing());
|
|
12252
|
+
return albums.map(withArtistName);
|
|
12337
12253
|
}
|
|
12338
12254
|
},
|
|
12339
12255
|
{
|
|
@@ -12341,8 +12257,8 @@ var init_lidarr3 = __esm(() => {
|
|
|
12341
12257
|
description: "List albums below quality cutoff",
|
|
12342
12258
|
columns: ["id", "artistName", "title", "releaseDate"],
|
|
12343
12259
|
run: async (c3) => {
|
|
12344
|
-
const albums =
|
|
12345
|
-
return albums.map(
|
|
12260
|
+
const albums = unwrapData(await c3.getWantedCutoff());
|
|
12261
|
+
return albums.map(withArtistName);
|
|
12346
12262
|
}
|
|
12347
12263
|
}
|
|
12348
12264
|
]
|
|
@@ -14874,38 +14790,12 @@ var exports_readarr3 = {};
|
|
|
14874
14790
|
__export(exports_readarr3, {
|
|
14875
14791
|
readarr: () => readarr
|
|
14876
14792
|
});
|
|
14877
|
-
|
|
14878
|
-
function unwrapData4(result) {
|
|
14879
|
-
return result?.data ?? result;
|
|
14880
|
-
}
|
|
14881
|
-
function formatBookListItem(book) {
|
|
14882
|
-
return {
|
|
14883
|
-
...book,
|
|
14884
|
-
authorName: book?.authorName ?? book?.authorTitle ?? book?.author?.authorName ?? "—"
|
|
14885
|
-
};
|
|
14886
|
-
}
|
|
14887
|
-
function formatQueueListItem2(item) {
|
|
14793
|
+
function withAuthorName(item) {
|
|
14888
14794
|
return {
|
|
14889
14795
|
...item,
|
|
14890
14796
|
authorName: item?.authorName ?? item?.authorTitle ?? item?.author?.authorName ?? "—"
|
|
14891
14797
|
};
|
|
14892
14798
|
}
|
|
14893
|
-
function formatHistoryListItem2(item) {
|
|
14894
|
-
return {
|
|
14895
|
-
...item,
|
|
14896
|
-
authorName: item?.authorName ?? item?.authorTitle ?? item?.author?.authorName ?? "—"
|
|
14897
|
-
};
|
|
14898
|
-
}
|
|
14899
|
-
function formatBlocklistItem2(item) {
|
|
14900
|
-
return {
|
|
14901
|
-
...item,
|
|
14902
|
-
authorName: item?.authorName ?? item?.authorTitle ?? item?.author?.authorName ?? "—"
|
|
14903
|
-
};
|
|
14904
|
-
}
|
|
14905
|
-
function readJsonInput4(filePath) {
|
|
14906
|
-
const raw = filePath === "-" ? readFileSync5(0, "utf-8") : readFileSync5(filePath, "utf-8");
|
|
14907
|
-
return JSON.parse(raw);
|
|
14908
|
-
}
|
|
14909
14799
|
var resources4, readarr;
|
|
14910
14800
|
var init_readarr3 = __esm(() => {
|
|
14911
14801
|
init_readarr2();
|
|
@@ -14941,7 +14831,7 @@ var init_readarr3 = __esm(() => {
|
|
|
14941
14831
|
description: "Search and add an author",
|
|
14942
14832
|
args: [{ name: "term", description: "Search term", required: true }],
|
|
14943
14833
|
run: async (c3, a2) => {
|
|
14944
|
-
const results =
|
|
14834
|
+
const results = unwrapData(await c3.searchAuthors(a2.term));
|
|
14945
14835
|
if (!Array.isArray(results) || results.length === 0) {
|
|
14946
14836
|
throw new Error("No authors found.");
|
|
14947
14837
|
}
|
|
@@ -14953,12 +14843,12 @@ var init_readarr3 = __esm(() => {
|
|
|
14953
14843
|
if (!author) {
|
|
14954
14844
|
throw new Error("Selected author was not found in the search results.");
|
|
14955
14845
|
}
|
|
14956
|
-
const profiles =
|
|
14846
|
+
const profiles = unwrapData(await c3.getQualityProfiles());
|
|
14957
14847
|
if (!Array.isArray(profiles) || profiles.length === 0) {
|
|
14958
14848
|
throw new Error("No quality profiles found. Configure one in Readarr first.");
|
|
14959
14849
|
}
|
|
14960
14850
|
const profileId = await promptSelect("Select quality profile:", profiles.map((profile) => ({ label: profile.name, value: String(profile.id) })));
|
|
14961
|
-
const folders =
|
|
14851
|
+
const folders = unwrapData(await c3.getRootFolders());
|
|
14962
14852
|
if (!Array.isArray(folders) || folders.length === 0) {
|
|
14963
14853
|
throw new Error("No root folders found. Configure one in Readarr first.");
|
|
14964
14854
|
}
|
|
@@ -14985,7 +14875,7 @@ var init_readarr3 = __esm(() => {
|
|
|
14985
14875
|
{ name: "tags", description: "Comma-separated tag IDs" }
|
|
14986
14876
|
],
|
|
14987
14877
|
run: async (c3, a2) => {
|
|
14988
|
-
const author =
|
|
14878
|
+
const author = unwrapData(await c3.getAuthor(a2.id));
|
|
14989
14879
|
const updates = { ...author };
|
|
14990
14880
|
if (a2.monitored !== undefined)
|
|
14991
14881
|
updates.monitored = a2.monitored === "true";
|
|
@@ -15030,8 +14920,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15030
14920
|
description: "List all books",
|
|
15031
14921
|
columns: ["id", "authorName", "title", "monitored"],
|
|
15032
14922
|
run: async (c3) => {
|
|
15033
|
-
const books =
|
|
15034
|
-
return books.map(
|
|
14923
|
+
const books = unwrapData(await c3.getBooks());
|
|
14924
|
+
return books.map(withAuthorName);
|
|
15035
14925
|
}
|
|
15036
14926
|
},
|
|
15037
14927
|
{
|
|
@@ -15039,8 +14929,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15039
14929
|
description: "Get a book by ID",
|
|
15040
14930
|
args: [{ name: "id", description: "Book ID", required: true, type: "number" }],
|
|
15041
14931
|
run: async (c3, a2) => {
|
|
15042
|
-
const book =
|
|
15043
|
-
return
|
|
14932
|
+
const book = unwrapData(await c3.getBook(a2.id));
|
|
14933
|
+
return withAuthorName(book);
|
|
15044
14934
|
}
|
|
15045
14935
|
},
|
|
15046
14936
|
{
|
|
@@ -15050,15 +14940,15 @@ var init_readarr3 = __esm(() => {
|
|
|
15050
14940
|
columns: ["foreignBookId", "authorName", "title", "monitored"],
|
|
15051
14941
|
idField: "foreignBookId",
|
|
15052
14942
|
run: async (c3, a2) => {
|
|
15053
|
-
const books =
|
|
15054
|
-
return books.map(
|
|
14943
|
+
const books = unwrapData(await c3.searchBooks(a2.term));
|
|
14944
|
+
return books.map(withAuthorName);
|
|
15055
14945
|
}
|
|
15056
14946
|
},
|
|
15057
14947
|
{
|
|
15058
14948
|
name: "add",
|
|
15059
14949
|
description: "Add a book from JSON file or stdin",
|
|
15060
14950
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
15061
|
-
run: async (c3, a2) => c3.addBook(
|
|
14951
|
+
run: async (c3, a2) => c3.addBook(readJsonInput(a2.file))
|
|
15062
14952
|
},
|
|
15063
14953
|
{
|
|
15064
14954
|
name: "edit",
|
|
@@ -15068,8 +14958,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15068
14958
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
15069
14959
|
],
|
|
15070
14960
|
run: async (c3, a2) => {
|
|
15071
|
-
const existing =
|
|
15072
|
-
return c3.updateBook(a2.id, { ...existing, ...
|
|
14961
|
+
const existing = unwrapData(await c3.getBook(a2.id));
|
|
14962
|
+
return c3.updateBook(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
15073
14963
|
}
|
|
15074
14964
|
},
|
|
15075
14965
|
{
|
|
@@ -15144,7 +15034,7 @@ var init_readarr3 = __esm(() => {
|
|
|
15144
15034
|
const tagResult = await c3.getTag(a2.id);
|
|
15145
15035
|
if (tagResult?.error)
|
|
15146
15036
|
return tagResult;
|
|
15147
|
-
const tag =
|
|
15037
|
+
const tag = unwrapData(tagResult);
|
|
15148
15038
|
const deleteResult = await c3.deleteTag(a2.id);
|
|
15149
15039
|
if (deleteResult?.error)
|
|
15150
15040
|
return deleteResult;
|
|
@@ -15168,8 +15058,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15168
15058
|
description: "List queue items",
|
|
15169
15059
|
columns: ["id", "authorName", "title", "status", "sizeleft", "timeleft"],
|
|
15170
15060
|
run: async (c3) => {
|
|
15171
|
-
const items =
|
|
15172
|
-
return items.map(
|
|
15061
|
+
const items = unwrapData(await c3.getQueue());
|
|
15062
|
+
return items.map(withAuthorName);
|
|
15173
15063
|
}
|
|
15174
15064
|
},
|
|
15175
15065
|
{
|
|
@@ -15213,9 +15103,9 @@ var init_readarr3 = __esm(() => {
|
|
|
15213
15103
|
],
|
|
15214
15104
|
columns: ["id", "authorName", "sourceTitle", "eventType", "date"],
|
|
15215
15105
|
run: async (c3, a2) => {
|
|
15216
|
-
const items = a2.since ?
|
|
15106
|
+
const items = a2.since ? unwrapData(await c3.getHistorySince(a2.since)) : unwrapData(await c3.getHistory());
|
|
15217
15107
|
const filtered = a2.until ? items.filter((item) => new Date(item.date) <= new Date(a2.until)) : items;
|
|
15218
|
-
return filtered.map(
|
|
15108
|
+
return filtered.map(withAuthorName);
|
|
15219
15109
|
}
|
|
15220
15110
|
}
|
|
15221
15111
|
]
|
|
@@ -15234,8 +15124,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15234
15124
|
],
|
|
15235
15125
|
columns: ["id", "authorName", "title", "releaseDate"],
|
|
15236
15126
|
run: async (c3, a2) => {
|
|
15237
|
-
const books =
|
|
15238
|
-
return books.map(
|
|
15127
|
+
const books = unwrapData(await c3.getCalendar(a2.start, a2.end, a2.unmonitored));
|
|
15128
|
+
return books.map(withAuthorName);
|
|
15239
15129
|
}
|
|
15240
15130
|
}
|
|
15241
15131
|
]
|
|
@@ -15260,7 +15150,7 @@ var init_readarr3 = __esm(() => {
|
|
|
15260
15150
|
name: "add",
|
|
15261
15151
|
description: "Add a notification from JSON file or stdin",
|
|
15262
15152
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
15263
|
-
run: async (c3, a2) => c3.addNotification(
|
|
15153
|
+
run: async (c3, a2) => c3.addNotification(readJsonInput(a2.file))
|
|
15264
15154
|
},
|
|
15265
15155
|
{
|
|
15266
15156
|
name: "edit",
|
|
@@ -15270,8 +15160,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15270
15160
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
15271
15161
|
],
|
|
15272
15162
|
run: async (c3, a2) => {
|
|
15273
|
-
const existing =
|
|
15274
|
-
return c3.updateNotification(a2.id, { ...existing, ...
|
|
15163
|
+
const existing = unwrapData(await c3.getNotification(a2.id));
|
|
15164
|
+
return c3.updateNotification(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
15275
15165
|
}
|
|
15276
15166
|
},
|
|
15277
15167
|
{
|
|
@@ -15308,7 +15198,7 @@ var init_readarr3 = __esm(() => {
|
|
|
15308
15198
|
name: "add",
|
|
15309
15199
|
description: "Add a download client from JSON file or stdin",
|
|
15310
15200
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
15311
|
-
run: async (c3, a2) => c3.addDownloadClient(
|
|
15201
|
+
run: async (c3, a2) => c3.addDownloadClient(readJsonInput(a2.file))
|
|
15312
15202
|
},
|
|
15313
15203
|
{
|
|
15314
15204
|
name: "edit",
|
|
@@ -15318,8 +15208,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15318
15208
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
15319
15209
|
],
|
|
15320
15210
|
run: async (c3, a2) => {
|
|
15321
|
-
const existing =
|
|
15322
|
-
return c3.updateDownloadClient(a2.id, { ...existing, ...
|
|
15211
|
+
const existing = unwrapData(await c3.getDownloadClient(a2.id));
|
|
15212
|
+
return c3.updateDownloadClient(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
15323
15213
|
}
|
|
15324
15214
|
},
|
|
15325
15215
|
{
|
|
@@ -15345,8 +15235,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15345
15235
|
description: "List blocked releases",
|
|
15346
15236
|
columns: ["id", "authorName", "sourceTitle", "date"],
|
|
15347
15237
|
run: async (c3) => {
|
|
15348
|
-
const items =
|
|
15349
|
-
return items.map(
|
|
15238
|
+
const items = unwrapData(await c3.getBlocklist());
|
|
15239
|
+
return items.map(withAuthorName);
|
|
15350
15240
|
}
|
|
15351
15241
|
},
|
|
15352
15242
|
{
|
|
@@ -15367,8 +15257,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15367
15257
|
description: "List books with missing files",
|
|
15368
15258
|
columns: ["id", "authorName", "title", "releaseDate"],
|
|
15369
15259
|
run: async (c3) => {
|
|
15370
|
-
const books =
|
|
15371
|
-
return books.map(
|
|
15260
|
+
const books = unwrapData(await c3.getWantedMissing());
|
|
15261
|
+
return books.map(withAuthorName);
|
|
15372
15262
|
}
|
|
15373
15263
|
},
|
|
15374
15264
|
{
|
|
@@ -15376,8 +15266,8 @@ var init_readarr3 = __esm(() => {
|
|
|
15376
15266
|
description: "List books below quality cutoff",
|
|
15377
15267
|
columns: ["id", "authorName", "title", "releaseDate"],
|
|
15378
15268
|
run: async (c3) => {
|
|
15379
|
-
const books =
|
|
15380
|
-
return books.map(
|
|
15269
|
+
const books = unwrapData(await c3.getWantedCutoff());
|
|
15270
|
+
return books.map(withAuthorName);
|
|
15381
15271
|
}
|
|
15382
15272
|
}
|
|
15383
15273
|
]
|
|
@@ -17073,14 +16963,6 @@ var exports_prowlarr3 = {};
|
|
|
17073
16963
|
__export(exports_prowlarr3, {
|
|
17074
16964
|
prowlarr: () => prowlarr
|
|
17075
16965
|
});
|
|
17076
|
-
import { readFileSync as readFileSync6 } from "node:fs";
|
|
17077
|
-
function unwrapData5(result) {
|
|
17078
|
-
return result?.data ?? result;
|
|
17079
|
-
}
|
|
17080
|
-
function readJsonInput5(filePath) {
|
|
17081
|
-
const raw = filePath === "-" ? readFileSync6(0, "utf-8") : readFileSync6(filePath, "utf-8");
|
|
17082
|
-
return JSON.parse(raw);
|
|
17083
|
-
}
|
|
17084
16966
|
async function runIndexerTest(client6, indexer) {
|
|
17085
16967
|
const result = await client6.testIndexer(indexer);
|
|
17086
16968
|
if (result?.error) {
|
|
@@ -17094,7 +16976,7 @@ async function runIndexerTest(client6, indexer) {
|
|
|
17094
16976
|
message: error?.title ?? error?.message ?? `API error (${status ?? "unknown"})`
|
|
17095
16977
|
};
|
|
17096
16978
|
}
|
|
17097
|
-
const data =
|
|
16979
|
+
const data = unwrapData(result);
|
|
17098
16980
|
return {
|
|
17099
16981
|
id: indexer?.id,
|
|
17100
16982
|
name: indexer?.name ?? "Unknown indexer",
|
|
@@ -17147,7 +17029,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17147
17029
|
description: "Add an indexer from JSON file or stdin",
|
|
17148
17030
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
17149
17031
|
run: async (c3, a2) => {
|
|
17150
|
-
const body =
|
|
17032
|
+
const body = readJsonInput(a2.file);
|
|
17151
17033
|
return c3.addIndexer(body);
|
|
17152
17034
|
}
|
|
17153
17035
|
},
|
|
@@ -17159,8 +17041,8 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17159
17041
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
17160
17042
|
],
|
|
17161
17043
|
run: async (c3, a2) => {
|
|
17162
|
-
const existing =
|
|
17163
|
-
const updates =
|
|
17044
|
+
const existing = unwrapData(await c3.getIndexer(a2.id));
|
|
17045
|
+
const updates = readJsonInput(a2.file);
|
|
17164
17046
|
return c3.updateIndexer(a2.id, { ...existing, ...updates });
|
|
17165
17047
|
}
|
|
17166
17048
|
},
|
|
@@ -17177,7 +17059,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17177
17059
|
args: [{ name: "id", description: "Indexer ID", type: "number" }],
|
|
17178
17060
|
columns: ["id", "name", "status", "message"],
|
|
17179
17061
|
run: async (c3, a2) => {
|
|
17180
|
-
const indexers = a2.id ? [
|
|
17062
|
+
const indexers = a2.id ? [unwrapData(await c3.getIndexer(a2.id))] : unwrapData(await c3.getIndexers());
|
|
17181
17063
|
const results = [];
|
|
17182
17064
|
for (const indexer of indexers) {
|
|
17183
17065
|
results.push(await runIndexerTest(c3, indexer));
|
|
@@ -17224,7 +17106,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17224
17106
|
description: "Add an application from JSON file or stdin",
|
|
17225
17107
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
17226
17108
|
run: async (c3, a2) => {
|
|
17227
|
-
const body =
|
|
17109
|
+
const body = readJsonInput(a2.file);
|
|
17228
17110
|
return c3.addApplication(body);
|
|
17229
17111
|
}
|
|
17230
17112
|
},
|
|
@@ -17236,8 +17118,8 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17236
17118
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
17237
17119
|
],
|
|
17238
17120
|
run: async (c3, a2) => {
|
|
17239
|
-
const existing =
|
|
17240
|
-
const updates =
|
|
17121
|
+
const existing = unwrapData(await c3.getApplication(a2.id));
|
|
17122
|
+
const updates = readJsonInput(a2.file);
|
|
17241
17123
|
return c3.updateApplication(a2.id, { ...existing, ...updates });
|
|
17242
17124
|
}
|
|
17243
17125
|
},
|
|
@@ -17305,7 +17187,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17305
17187
|
"averageResponseTime"
|
|
17306
17188
|
],
|
|
17307
17189
|
run: async (c3) => {
|
|
17308
|
-
const result =
|
|
17190
|
+
const result = unwrapData(await c3.getIndexerStats());
|
|
17309
17191
|
return result?.indexers ?? result;
|
|
17310
17192
|
}
|
|
17311
17193
|
}
|
|
@@ -17331,7 +17213,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17331
17213
|
name: "add",
|
|
17332
17214
|
description: "Add a notification from JSON file or stdin",
|
|
17333
17215
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
17334
|
-
run: async (c3, a2) => c3.addNotification(
|
|
17216
|
+
run: async (c3, a2) => c3.addNotification(readJsonInput(a2.file))
|
|
17335
17217
|
},
|
|
17336
17218
|
{
|
|
17337
17219
|
name: "edit",
|
|
@@ -17341,8 +17223,8 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17341
17223
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
17342
17224
|
],
|
|
17343
17225
|
run: async (c3, a2) => {
|
|
17344
|
-
const existing =
|
|
17345
|
-
return c3.updateNotification(a2.id, { ...existing, ...
|
|
17226
|
+
const existing = unwrapData(await c3.getNotification(a2.id));
|
|
17227
|
+
return c3.updateNotification(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
17346
17228
|
}
|
|
17347
17229
|
},
|
|
17348
17230
|
{
|
|
@@ -17379,7 +17261,7 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17379
17261
|
name: "add",
|
|
17380
17262
|
description: "Add a download client from JSON file or stdin",
|
|
17381
17263
|
args: [{ name: "file", description: "JSON file path (use - for stdin)", required: true }],
|
|
17382
|
-
run: async (c3, a2) => c3.addDownloadClient(
|
|
17264
|
+
run: async (c3, a2) => c3.addDownloadClient(readJsonInput(a2.file))
|
|
17383
17265
|
},
|
|
17384
17266
|
{
|
|
17385
17267
|
name: "edit",
|
|
@@ -17389,8 +17271,8 @@ var init_prowlarr3 = __esm(() => {
|
|
|
17389
17271
|
{ name: "file", description: "JSON file with fields to update", required: true }
|
|
17390
17272
|
],
|
|
17391
17273
|
run: async (c3, a2) => {
|
|
17392
|
-
const existing =
|
|
17393
|
-
return c3.updateDownloadClient(a2.id, { ...existing, ...
|
|
17274
|
+
const existing = unwrapData(await c3.getDownloadClient(a2.id));
|
|
17275
|
+
return c3.updateDownloadClient(a2.id, { ...existing, ...readJsonInput(a2.file) });
|
|
17394
17276
|
}
|
|
17395
17277
|
},
|
|
17396
17278
|
{
|
|
@@ -21331,23 +21213,14 @@ var init_doctor = __esm(() => {
|
|
|
21331
21213
|
}
|
|
21332
21214
|
hasAny = true;
|
|
21333
21215
|
try {
|
|
21334
|
-
const
|
|
21335
|
-
if (!factory) {
|
|
21336
|
-
results.push({
|
|
21337
|
-
service,
|
|
21338
|
-
configured: true,
|
|
21339
|
-
status: "fail",
|
|
21340
|
-
baseUrl: svcConfig.baseUrl,
|
|
21341
|
-
error: "No client factory available"
|
|
21342
|
-
});
|
|
21343
|
-
continue;
|
|
21344
|
-
}
|
|
21345
|
-
const client9 = factory(svcConfig);
|
|
21216
|
+
const client9 = clientFactories[service](svcConfig);
|
|
21346
21217
|
const status = await client9.getSystemStatus();
|
|
21347
21218
|
if (status?.error !== undefined) {
|
|
21348
21219
|
const err = status.error;
|
|
21349
|
-
const
|
|
21350
|
-
|
|
21220
|
+
const code = err?.cause?.code ?? err?.code;
|
|
21221
|
+
const cause = code ? { code } : undefined;
|
|
21222
|
+
const message = err?.cause?.message ?? err?.message ?? err?.code ?? "Unknown API error";
|
|
21223
|
+
throw Object.assign(new Error(message), cause ? { cause } : {});
|
|
21351
21224
|
}
|
|
21352
21225
|
const version = extractVersion(service, status) ?? "?";
|
|
21353
21226
|
if (version === "?") {
|
|
@@ -21791,7 +21664,7 @@ init_dist();
|
|
|
21791
21664
|
// package.json
|
|
21792
21665
|
var package_default = {
|
|
21793
21666
|
name: "tsarr",
|
|
21794
|
-
version: "2.7.
|
|
21667
|
+
version: "2.7.6",
|
|
21795
21668
|
author: "Robbe Verhelst",
|
|
21796
21669
|
repository: {
|
|
21797
21670
|
type: "git",
|