diff --git a/src/handler/CineHDPlus.test.ts b/src/handler/CineHDPlus.test.ts index 9e2fcc1..581fd29 100644 --- a/src/handler/CineHDPlus.test.ts +++ b/src/handler/CineHDPlus.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('CineHDPlus', () => { test('does not handle non imdb series', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'series', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent series gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678:1:1'); + const streams = await handler.handle(ctx, 'series', 'tt12345678:1:1'); expect(streams).toHaveLength(0); }); test('handle imdb black mirror s2e3 (mx)', async () => { - const streams = (await handler.handle(ctx, 'tt2085059:2:3')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'series', 'tt2085059:2:3')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ @@ -49,7 +49,7 @@ describe('CineHDPlus', () => { }); test('handle imdb babylon 5 s2e3 (es)', async () => { - const streams = (await handler.handle(ctx, 'tt0105946:2:3')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'series', 'tt0105946:2:3')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/CineHDPlus.ts b/src/handler/CineHDPlus.ts index 62e56b9..ddea690 100644 --- a/src/handler/CineHDPlus.ts +++ b/src/handler/CineHDPlus.ts @@ -21,7 +21,7 @@ export class CineHDPlus implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/Eurostreaming.test.ts b/src/handler/Eurostreaming.test.ts index bd2ce77..8abe5ef 100644 --- a/src/handler/Eurostreaming.test.ts +++ b/src/handler/Eurostreaming.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('Eurostreaming', () => { test('does not handle non imdb series', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'series', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent series gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678:1:1'); + const streams = await handler.handle(ctx, 'series', 'tt12345678:1:1'); expect(streams).toHaveLength(0); }); test('handle imdb black mirror s2e4', async () => { - const streams = (await handler.handle(ctx, 'tt2085059:2:4')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'series', 'tt2085059:2:4')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/Eurostreaming.ts b/src/handler/Eurostreaming.ts index 63af2a7..b4d2d5d 100644 --- a/src/handler/Eurostreaming.ts +++ b/src/handler/Eurostreaming.ts @@ -21,7 +21,7 @@ export class Eurostreaming implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/FrenchCloud.test.ts b/src/handler/FrenchCloud.test.ts index e901ae2..e3708ca 100644 --- a/src/handler/FrenchCloud.test.ts +++ b/src/handler/FrenchCloud.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('FrenchCloud', () => { test('does not handle non imdb movies', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'movie', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent movies gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678'); + const streams = await handler.handle(ctx, 'movie', 'tt12345678'); expect(streams).toHaveLength(0); }); test('handle imdb the devil\'s bath', async () => { - const streams = (await handler.handle(ctx, 'tt29141112')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'movie', 'tt29141112')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/FrenchCloud.ts b/src/handler/FrenchCloud.ts index 47e1c53..a02ff74 100644 --- a/src/handler/FrenchCloud.ts +++ b/src/handler/FrenchCloud.ts @@ -21,7 +21,7 @@ export class FrenchCloud implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/KinoKiste.test.ts b/src/handler/KinoKiste.test.ts index 9323c7a..89aa5d5 100644 --- a/src/handler/KinoKiste.test.ts +++ b/src/handler/KinoKiste.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('KinoKiste', () => { test('does not handle non imdb series', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'series', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent series gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678:1:1'); + const streams = await handler.handle(ctx, 'series', 'tt12345678:1:1'); expect(streams).toHaveLength(0); }); test('handle imdb black mirror s2e4', async () => { - const streams = (await handler.handle(ctx, 'tt2085059:2:4')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'series', 'tt2085059:2:4')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/KinoKiste.ts b/src/handler/KinoKiste.ts index 83ac7f1..b47eb9f 100644 --- a/src/handler/KinoKiste.ts +++ b/src/handler/KinoKiste.ts @@ -21,7 +21,7 @@ export class KinoKiste implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/MeineCloud.test.ts b/src/handler/MeineCloud.test.ts index 1986b3d..61a398e 100644 --- a/src/handler/MeineCloud.test.ts +++ b/src/handler/MeineCloud.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('MeineCloud', () => { test('does not handle non imdb movies', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'movie', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent movies gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678'); + const streams = await handler.handle(ctx, 'movie', 'tt12345678'); expect(streams).toHaveLength(0); }); test('handle imdb the devil\'s bath', async () => { - const streams = (await handler.handle(ctx, 'tt29141112')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'movie', 'tt29141112')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/MeineCloud.ts b/src/handler/MeineCloud.ts index a1c5bd1..dbd854a 100644 --- a/src/handler/MeineCloud.ts +++ b/src/handler/MeineCloud.ts @@ -21,7 +21,7 @@ export class MeineCloud implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/MostraGuarda.test.ts b/src/handler/MostraGuarda.test.ts index 61a9d16..60cead7 100644 --- a/src/handler/MostraGuarda.test.ts +++ b/src/handler/MostraGuarda.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('MostraGuarda', () => { test('does not handle non imdb movies', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'movie', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent movies gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678'); + const streams = await handler.handle(ctx, 'movie', 'tt12345678'); expect(streams).toHaveLength(0); }); test('handle imdb the devil\'s bath', async () => { - const streams = (await handler.handle(ctx, 'tt29141112')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'movie', 'tt29141112')).filter(stream => stream !== undefined); expect(streams).toHaveLength(2); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/MostraGuarda.ts b/src/handler/MostraGuarda.ts index 1ce604a..561f3a3 100644 --- a/src/handler/MostraGuarda.ts +++ b/src/handler/MostraGuarda.ts @@ -21,7 +21,7 @@ export class MostraGuarda implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/VerHdLink.test.ts b/src/handler/VerHdLink.test.ts index 65250ab..7666a56 100644 --- a/src/handler/VerHdLink.test.ts +++ b/src/handler/VerHdLink.test.ts @@ -13,19 +13,19 @@ const ctx: Context = { ip: '127.0.0.1' }; describe('VerHdLink', () => { test('does not handle non imdb movies', async () => { - const streams = await handler.handle(ctx, 'kitsu:123'); + const streams = await handler.handle(ctx, 'movie', 'kitsu:123'); expect(streams).toHaveLength(0); }); test('handles non-existent movies gracefully', async () => { - const streams = await handler.handle(ctx, 'tt12345678'); + const streams = await handler.handle(ctx, 'movie', 'tt12345678'); expect(streams).toHaveLength(0); }); test('handle titanic', async () => { - const streams = (await handler.handle(ctx, 'tt0120338')).filter(stream => stream !== undefined); + const streams = (await handler.handle(ctx, 'movie', 'tt0120338')).filter(stream => stream !== undefined); expect(streams).toHaveLength(4); expect(streams[0]).toStrictEqual({ diff --git a/src/handler/VerHdLink.ts b/src/handler/VerHdLink.ts index f40e0a5..5b97aca 100644 --- a/src/handler/VerHdLink.ts +++ b/src/handler/VerHdLink.ts @@ -21,7 +21,7 @@ export class VerHdLink implements Handler { this.embedExtractors = embedExtractors; } - readonly handle = async (ctx: Context, id: string) => { + readonly handle = async (ctx: Context, _type: string, id: string) => { if (!id.startsWith('tt')) { return []; } diff --git a/src/handler/types.ts b/src/handler/types.ts index cf9bb42..b0b96a6 100644 --- a/src/handler/types.ts +++ b/src/handler/types.ts @@ -9,5 +9,5 @@ export interface Handler { readonly languages: string[]; - readonly handle: (ctx: Context, id: string) => Promise<(UrlResult | undefined)[]>; + readonly handle: (ctx: Context, type: string, id: string) => Promise<(UrlResult | undefined)[]>; } diff --git a/src/utils/StreamResolver.ts b/src/utils/StreamResolver.ts index 33021de..39a6177 100644 --- a/src/utils/StreamResolver.ts +++ b/src/utils/StreamResolver.ts @@ -30,7 +30,7 @@ export class StreamResolver { } try { - const handlerUrlResults = await handler.handle(ctx, id); + const handlerUrlResults = await handler.handle(ctx, type, id); this.logger.info(`${handler.id} returned ${handlerUrlResults.length} urls`); urlResults.push(...(handlerUrlResults.filter(handlerUrlResult => handlerUrlResult !== undefined)));