feat: extract jackett indexer in torznab implementation

This commit is contained in:
Viren070
2025-09-19 14:16:32 +01:00
parent 3b2302226f
commit ef10cf0bec
2 changed files with 13 additions and 0 deletions
@@ -87,6 +87,17 @@ const createTorznabItemSchema = () =>
.array(z.union([z.string(), z.object({ _: z.string() })]))
.transform((arr) => (typeof arr[0] === 'string' ? arr[0] : arr[0]._)),
pubDate: z.array(z.string()).transform((arr) => arr[0]),
jackettindexer: z
.array(
z.object({
_: z.string(),
$: z.object({ id: z.string() }),
})
)
.optional()
.transform((arr) =>
arr?.[0] ? { name: arr[0]._, id: arr[0].$.id } : undefined
),
size: z
.array(z.string())
.optional()
@@ -114,6 +125,7 @@ const createTorznabItemSchema = () =>
link: item.link,
guid: item.guid,
pubDate: item.pubDate,
jackettindexer: item.jackettindexer,
size: item.size,
enclosure: item.enclosure,
torznab: item['torznab:attr'],
@@ -67,6 +67,7 @@ export class TorznabAddon extends BaseNabAddon<NabAddonConfig, TorznabApi> {
![-1, 999].includes(result.torznab.seeders)
? result.torznab.seeders
: undefined,
indexer: result.jackettindexer?.name ?? undefined,
title: result.title,
size: result.size ?? 0,
type: 'torrent',