feat: make VixSrc a default multi-language source

This commit is contained in:
WebStreamr 2025-06-25 19:16:40 +00:00
parent c0fc6ff7ea
commit 35e049f577
No known key found for this signature in database
7 changed files with 16 additions and 8 deletions

View file

@ -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));

View file

@ -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();

View file

@ -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';

View file

@ -12,6 +12,7 @@ export type ManifestWithConfig = Manifest & { config: ManifestConfig[] };
export type Config = Partial<Record<CountryCode | 'includeExternalUrls' | 'mediaFlowProxyUrl' | 'mediaFlowProxyPassword', string>>;
export enum CountryCode {
multi = 'multi',
de = 'de',
en = 'en',
es = 'es',

View file

@ -1,6 +1,7 @@
import { CountryCode } from '../types';
const countryCodeMap: Record<CountryCode, { language: string; flag: string; iso639: string }> = {
const countryCodeMap: Record<CountryCode, { language: string; flag: string; iso639: string | undefined }> = {
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' },

View file

@ -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),

View file

@ -34,8 +34,12 @@ export const buildManifest = (sources: Source[], config: Config): ManifestWithCo
};
const countryCodeSources: Partial<Record<CountryCode, Source[]>> = {};
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)