diff --git a/src/controller/StreamController.ts b/src/controller/StreamController.ts index 4604685..904e173 100644 --- a/src/controller/StreamController.ts +++ b/src/controller/StreamController.ts @@ -1,7 +1,7 @@ import { Request, Response, Router } from 'express'; import winston from 'winston'; import { Source } from '../source'; -import { Config, Context } from '../types'; +import { Config, Context, CountryCode } from '../types'; import { envIsProd, getDefaultConfig, ImdbId, StreamResolver } from '../utils'; import { ContentType } from 'stremio-addon-sdk'; @@ -36,7 +36,7 @@ export class StreamController { this.logger.info(`Search stream for type "${type}" and id "${id}" for ip ${ctx.ip}`, ctx); - const sources = this.sources.filter(handler => handler.countryCodes.filter(countryCode => countryCode in ctx.config).length); + const sources = this.sources.filter(handler => handler.countryCodes.filter(countryCode => countryCode in ctx.config || countryCode === CountryCode.multi).length); const { streams, ttl } = await this.streamResolver.resolve(ctx, sources, type, ImdbId.fromString(id)); diff --git a/src/index.ts b/src/index.ts index fe57ee8..68dbc4b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,8 @@ const logger = winston.createLogger({ const fetcher = new Fetcher(logger); const sources: Source[] = [ + // multi + new VixSrc(fetcher), // EN new Soaper(fetcher), new VidSrc(fetcher), @@ -38,7 +40,6 @@ const sources: Source[] = [ // IT new Eurostreaming(fetcher), new MostraGuarda(fetcher), - new VixSrc(fetcher), ]; const addon = express(); diff --git a/src/source/VixSrc.ts b/src/source/VixSrc.ts index cab54e6..c709a64 100644 --- a/src/source/VixSrc.ts +++ b/src/source/VixSrc.ts @@ -10,7 +10,7 @@ export class VixSrc implements Source { public readonly contentTypes: ContentType[] = ['movie', 'series']; - public readonly countryCodes: CountryCode[] = [CountryCode.it]; + public readonly countryCodes: CountryCode[] = [CountryCode.multi]; private readonly baseUrl = 'https://vixsrc.to'; diff --git a/src/types.ts b/src/types.ts index 09a392f..90bf019 100644 --- a/src/types.ts +++ b/src/types.ts @@ -12,6 +12,7 @@ export type ManifestWithConfig = Manifest & { config: ManifestConfig[] }; export type Config = Partial>; export enum CountryCode { + multi = 'multi', de = 'de', en = 'en', es = 'es', diff --git a/src/utils/language.ts b/src/utils/language.ts index b46610c..54be2d4 100644 --- a/src/utils/language.ts +++ b/src/utils/language.ts @@ -1,6 +1,7 @@ import { CountryCode } from '../types'; -const countryCodeMap: Record = { +const countryCodeMap: Record = { + multi: { language: 'Multi', flag: '🌐', iso639: undefined }, de: { language: 'German', flag: 'πŸ‡©πŸ‡ͺ', iso639: 'ger' }, en: { language: 'English', flag: 'πŸ‡ΊπŸ‡Έ', iso639: 'eng' }, es: { language: 'Castilian Spanish', flag: 'πŸ‡ͺπŸ‡Έ', iso639: 'spa' }, diff --git a/src/utils/manifest.test.ts b/src/utils/manifest.test.ts index 6257e3b..9c4a708 100644 --- a/src/utils/manifest.test.ts +++ b/src/utils/manifest.test.ts @@ -1,5 +1,5 @@ import { buildManifest } from './manifest'; -import { StreamKiste, MeineCloud, VerHdLink } from '../source'; +import { StreamKiste, MeineCloud, VerHdLink, VixSrc } from '../source'; import { FetcherMock } from './FetcherMock'; const fetcher = new FetcherMock('/dev/null'); @@ -7,6 +7,7 @@ const fetcher = new FetcherMock('/dev/null'); describe('buildManifest', () => { test('has unchecked source without a config', () => { const sources = [ + new VixSrc(fetcher), new VerHdLink(fetcher), new StreamKiste(fetcher), new MeineCloud(fetcher), diff --git a/src/utils/manifest.ts b/src/utils/manifest.ts index 85f40c9..f5aec95 100644 --- a/src/utils/manifest.ts +++ b/src/utils/manifest.ts @@ -34,8 +34,12 @@ export const buildManifest = (sources: Source[], config: Config): ManifestWithCo }; const countryCodeSources: Partial> = {}; - sources.forEach((handler) => { - handler.countryCodes.forEach(countryCode => countryCodeSources[countryCode] = [...(countryCodeSources[countryCode] ?? []), handler]); + sources.forEach((source) => { + if (source.countryCodes.includes(CountryCode.multi)) { + return; + } + + source.countryCodes.forEach(countryCode => countryCodeSources[countryCode] = [...(countryCodeSources[countryCode] ?? []), source]); }); const sortedLanguageSources = typedEntries(countryCodeSources)