refactor: switch to ESM

This commit is contained in:
Viren070
2025-09-17 18:05:07 +01:00
parent 039081b9da
commit 72fbca02a6
187 changed files with 1101 additions and 862 deletions
+1
View File
@@ -2,6 +2,7 @@
"name": "aiostreams",
"version": "2.12.2",
"description": "AIOStreams consolidates multiple Stremio addons and debrid services into a single, easily configurable addon. It allows highly customisable filtering, sorting, and formatting of results and supports proxying all your streams through MediaFlow Proxy or StremThru for improved compatibility and IP restriction bypassing.",
"type": "module",
"main": "dist/index.js",
"scripts": {
"test": "pnpm run test --workspaces",
+1
View File
@@ -2,6 +2,7 @@
"name": "@aiostreams/core",
"version": "0.0.0",
"main": "dist/index.js",
"type": "module",
"scripts": {
"test": "vitest run --passWithNoTests",
"test:watch": "vitest watch",
+9 -9
View File
@@ -1,6 +1,6 @@
import { Manifest, Meta, Stream } from '../../db/schemas';
import { Manifest, Meta, Stream } from '../../db/schemas.js';
import { z, ZodError } from 'zod';
import { IdParser, IdType, ParsedId } from '../../utils/id-parser';
import { IdParser, IdType, ParsedId } from '../../utils/id-parser.js';
import {
AnimeDatabase,
constants,
@@ -8,8 +8,8 @@ import {
formatZodError,
getTimeTakenSincePoint,
SERVICE_DETAILS,
} from '../../utils';
import { TorrentClient } from '../../utils/torrent';
} from '../../utils/index.js';
import { TorrentClient } from '../../utils/torrent.js';
import {
BuiltinDebridServices,
PlaybackInfo,
@@ -20,11 +20,11 @@ import {
UnprocessedTorrent,
ServiceAuth,
DebridError,
} from '../../debrid';
import { processTorrents, processNZBs } from '../utils/debrid';
import { calculateAbsoluteEpisode } from '../utils/general';
import { TitleMetadata } from '../torbox-search/source-handlers';
import { MetadataService } from '../../metadata/service';
} from '../../debrid/index.js';
import { processTorrents, processNZBs } from '../utils/debrid.js';
import { calculateAbsoluteEpisode } from '../utils/general.js';
import { TitleMetadata } from '../torbox-search/source-handlers.js';
import { MetadataService } from '../../metadata/service.js';
import { Logger } from 'winston';
export interface SearchMetadata extends TitleMetadata {
+4 -4
View File
@@ -1,13 +1,13 @@
import { z } from 'zod';
import { ParsedId } from '../../../utils/id-parser';
import { getTimeTakenSincePoint } from '../../../utils';
import { ParsedId } from '../../../utils/id-parser.js';
import { getTimeTakenSincePoint } from '../../../utils/index.js';
import { Logger } from 'winston';
import {
BaseDebridAddon,
BaseDebridConfigSchema,
SearchMetadata,
} from '../debrid';
import { BaseNabApi, Capabilities, SearchResultItem } from './api';
} from '../debrid.js';
import { BaseNabApi, Capabilities, SearchResultItem } from './api.js';
export const NabAddonConfigSchema = BaseDebridConfigSchema.extend({
url: z.string(),
+1 -1
View File
@@ -7,7 +7,7 @@ import {
formatZodError,
getTimeTakenSincePoint,
createLogger,
} from '../../../utils';
} from '../../../utils/index.js';
import { Parser } from 'xml2js';
import { Logger } from 'winston';
+21 -10
View File
@@ -1,18 +1,29 @@
import { Manifest, Meta, MetaPreview, Stream, Subtitle } from '../../db';
import { AnimeDatabase, Env, ExtrasParser, createLogger } from '../../utils';
import {
Manifest,
Meta,
MetaPreview,
Stream,
Subtitle,
} from '../../db/index.js';
import {
AnimeDatabase,
Env,
ExtrasParser,
createLogger,
} from '../../utils/index.js';
import {
GDriveAPI,
GoogleOAuth,
GoogleOAuthError,
GoogleOAuthErrorCode,
} from './api';
import { GDriveFile, UserData } from './schemas';
import { IMDBMetadata } from '../../metadata/imdb';
import { TMDBMetadata } from '../../metadata/tmdb';
import { formatBytes, formatDuration } from '../../formatters';
import { IdParser, ParsedId } from '../../utils/id-parser';
import { IdType } from '../../utils/id-parser';
import { getTraktAliases } from '../../metadata/trakt';
} from './api.js';
import { GDriveFile, UserData } from './schemas.js';
import { IMDBMetadata } from '../../metadata/imdb.js';
import { TMDBMetadata } from '../../metadata/tmdb.js';
import { formatBytes, formatDuration } from '../../formatters/index.js';
import { IdParser, ParsedId } from '../../utils/id-parser.js';
import { IdType } from '../../utils/id-parser.js';
import { getTraktAliases } from '../../metadata/trakt.js';
const logger = createLogger('gdrive');
+2 -2
View File
@@ -1,11 +1,11 @@
import { Cache, createLogger, Env, makeRequest } from '../../utils';
import { Cache, createLogger, Env, makeRequest } from '../../utils/index.js';
import {
GDriveFile,
GDriveFileGetResponseSchema,
GDriveFileQueryResponseSchema,
RefreshTokenResponse,
RefreshTokenResponseSchema,
} from './schemas';
} from './schemas.js';
const accessTokenCache = Cache.getInstance<string, string>(
'gdrive-access-token'
+2 -2
View File
@@ -1,2 +1,2 @@
export * from './addon';
export * from './api';
export * from './addon.js';
export * from './api.js';
+5 -5
View File
@@ -1,5 +1,5 @@
export * from './gdrive';
export * from './torbox-search';
export * from './torznab';
export * from './newznab';
export * from './prowlarr';
export * from './gdrive/index.js';
export * from './torbox-search/index.js';
export * from './torznab/index.js';
export * from './newznab/index.js';
export * from './prowlarr/index.js';
+6 -6
View File
@@ -1,15 +1,15 @@
import { z } from 'zod';
import { ParsedId } from '../../utils/id-parser';
import { constants, createLogger } from '../../utils';
import { Torrent, NZB } from '../../debrid';
import { SearchMetadata } from '../base/debrid';
import { ParsedId } from '../../utils/id-parser.js';
import { constants, createLogger } from '../../utils/index.js';
import { Torrent, NZB } from '../../debrid/index.js';
import { SearchMetadata } from '../base/debrid.js';
import { createHash } from 'crypto';
import { BaseNabApi, SearchResultItem } from '../base/nab/api';
import { BaseNabApi, SearchResultItem } from '../base/nab/api.js';
import {
BaseNabAddon,
NabAddonConfigSchema,
NabAddonConfig,
} from '../base/nab/addon';
} from '../base/nab/addon.js';
const logger = createLogger('newznab');
+1 -1
View File
@@ -1 +1 @@
export * from './addon';
export * from './addon.js';
+11 -7
View File
@@ -1,18 +1,22 @@
import { BaseDebridAddon, BaseDebridConfigSchema } from '../base/debrid';
import { BaseDebridAddon, BaseDebridConfigSchema } from '../base/debrid.js';
import { z } from 'zod';
import { createLogger, Env, getTimeTakenSincePoint } from '../../utils';
import {
createLogger,
Env,
getTimeTakenSincePoint,
} from '../../utils/index.js';
import ProwlarrApi, {
ProwlarrApiIndexer,
ProwlarrApiSearchItem,
ProwlarrApiError,
} from './api';
import { ParsedId } from '../../utils/id-parser';
import { SearchMetadata } from '../base/debrid';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid';
} from './api.js';
import { ParsedId } from '../../utils/id-parser.js';
import { SearchMetadata } from '../base/debrid.js';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid/index.js';
import {
extractInfoHashFromMagnet,
extractTrackersFromMagnet,
} from '../utils/debrid';
} from '../utils/debrid.js';
export const ProwlarrAddonConfigSchema = BaseDebridConfigSchema.extend({
url: z.string(),
+1 -1
View File
@@ -5,7 +5,7 @@ import {
Env,
formatZodError,
makeRequest,
} from '../../utils';
} from '../../utils/index.js';
import z from 'zod';
interface ResponseMeta {
+1 -1
View File
@@ -1 +1 @@
export * from './addon';
export * from './addon.js';
@@ -1,18 +1,21 @@
import { z } from 'zod';
import { Manifest, Stream } from '../../db';
import { Manifest, Stream } from '../../db/index.js';
import {
AnimeDatabase,
createLogger,
formatZodError,
getTimeTakenSincePoint,
} from '../../utils';
import { TorBoxSearchAddonUserDataSchema } from './schemas';
} from '../../utils/index.js';
import { TorBoxSearchAddonUserDataSchema } from './schemas.js';
import { TorboxApi } from '@torbox/torbox-api';
import TorboxSearchApi from './search-api';
import { IdParser } from '../../utils/id-parser';
import { TorrentSourceHandler, UsenetSourceHandler } from './source-handlers';
import { TorBoxSearchAddonError } from './errors';
import { supportedIdTypes } from './search-api';
import TorboxSearchApi from './search-api.js';
import { IdParser } from '../../utils/id-parser.js';
import {
TorrentSourceHandler,
UsenetSourceHandler,
} from './source-handlers.js';
import { TorBoxSearchAddonError } from './errors.js';
import { supportedIdTypes } from './search-api.js';
const logger = createLogger('torbox-search');
@@ -1,2 +1,2 @@
export * from './addon';
export * from './errors';
export * from './addon.js';
export * from './errors.js';
@@ -1,5 +1,5 @@
import { z } from 'zod';
import { BuiltinDebridServices } from '../../debrid/utils';
import { BuiltinDebridServices } from '../../debrid/utils.js';
const TorBoxApiErrorResponseSchema = z.object({
success: z.literal(false),
@@ -1,14 +1,17 @@
import { fetch, RequestInit, Response } from 'undici';
import { z } from 'zod';
import { TorBoxApiResponseSchema, TorBoxSearchApiDataSchema } from './schemas';
import {
TorBoxApiResponseSchema,
TorBoxSearchApiDataSchema,
} from './schemas.js';
import {
createLogger,
DistributedLock,
Env,
formatZodError,
maskSensitiveInfo,
} from '../../utils';
import { IdType } from '../../utils/id-parser';
} from '../../utils/index.js';
import { IdType } from '../../utils/id-parser.js';
type TorboxSuccessResponse<T> = {
success: true;
@@ -1,5 +1,5 @@
import { number, z } from 'zod';
import { Stream } from '../../db';
import { Stream } from '../../db/index.js';
import {
AnimeDatabase,
Cache,
@@ -7,25 +7,25 @@ import {
SERVICE_DETAILS,
createLogger,
getTimeTakenSincePoint,
} from '../../utils';
} from '../../utils/index.js';
// import { DebridService, DebridFile } from './debrid-service';
import { ParsedId } from '../../utils/id-parser';
import { TorBoxSearchAddonUserDataSchema } from './schemas';
import { ParsedId } from '../../utils/id-parser.js';
import { TorBoxSearchAddonUserDataSchema } from './schemas.js';
import TorboxSearchApi, {
TorboxSearchApiError,
TorboxSearchApiIdType,
} from './search-api';
import { Torrent, convertDataToTorrents } from './torrent';
import { TMDBMetadata } from '../../metadata/tmdb';
import { calculateAbsoluteEpisode } from '../utils/general';
} from './search-api.js';
import { Torrent, convertDataToTorrents } from './torrent.js';
import { TMDBMetadata } from '../../metadata/tmdb.js';
import { calculateAbsoluteEpisode } from '../utils/general.js';
import { TorboxApi } from '@torbox/torbox-api';
import { processNZBs, processTorrents } from '../utils/debrid';
import { processNZBs, processTorrents } from '../utils/debrid.js';
import {
NZBWithSelectedFile,
TorrentWithSelectedFile,
} from '../../debrid/utils';
import { DebridFile, PlaybackInfo } from '../../debrid';
import { getTraktAliases } from '../../metadata/trakt';
} from '../../debrid/utils.js';
import { DebridFile, PlaybackInfo } from '../../debrid/index.js';
import { getTraktAliases } from '../../metadata/trakt.js';
const logger = createLogger('torbox-search');
@@ -1,9 +1,9 @@
import { z } from 'zod';
import { TorBoxSearchApiDataSchema } from './schemas';
import { TorBoxSearchApiDataSchema } from './schemas.js';
import {
extractInfoHashFromMagnet,
extractTrackersFromMagnet,
} from '../utils/debrid';
} from '../utils/debrid.js';
export interface Torrent {
hash: string;
+6 -6
View File
@@ -1,15 +1,15 @@
import { z } from 'zod';
import { ParsedId } from '../../utils/id-parser';
import { createLogger } from '../../utils';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid';
import { ParsedId } from '../../utils/id-parser.js';
import { createLogger } from '../../utils/index.js';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid/index.js';
import { SearchMetadata } from '../base/debrid';
import { extractTrackersFromMagnet } from '../utils/debrid';
import { BaseNabApi, Capabilities } from '../base/nab/api';
import { extractTrackersFromMagnet } from '../utils/debrid.js';
import { BaseNabApi, Capabilities } from '../base/nab/api.js';
import {
BaseNabAddon,
NabAddonConfigSchema,
NabAddonConfig,
} from '../base/nab/addon';
} from '../base/nab/addon.js';
const logger = createLogger('torznab');
+1 -1
View File
@@ -1 +1 @@
export * from './addon';
export * from './addon.js';
+3 -9
View File
@@ -1,16 +1,10 @@
// utility function for debrid-based builtins
import z from 'zod';
import {
BuiltinServiceId,
constants,
createLogger,
getTimeTakenSincePoint,
} from '../../utils';
} from '../../utils/index.js';
import {
BuiltinDebridServices,
DebridDownload,
DebridError,
DebridFile,
getDebridService,
selectFileInTorrentOrNZB,
@@ -20,8 +14,8 @@ import {
NZB,
isSeasonWrong,
isEpisodeWrong,
} from '../../debrid';
import { PTT } from '../../parser';
} from '../../debrid/index.js';
import { PTT } from '../../parser/index.js';
import { ParseResult } from 'go-ptt';
// we have a list of torrents which need to be
+5 -6
View File
@@ -1,15 +1,14 @@
import { TABLES } from './schemas';
import { createLogger } from '../utils';
import { parseConnectionURI, adaptQuery, ConnectionURI } from './utils';
const logger = createLogger('database');
import { Pool, Client, QueryResult } from 'pg';
import sqlite3 from 'sqlite3';
import { open, Database } from 'sqlite';
import { URL } from 'url';
import path from 'path';
import fs from 'fs';
import { TABLES } from './schemas.js';
import { createLogger } from '../utils/index.js';
import { parseConnectionURI, adaptQuery, ConnectionURI } from './utils.js';
const logger = createLogger('database');
type QueryResultRow = Record<string, any>;
+4 -4
View File
@@ -1,4 +1,4 @@
export * from './db';
export * from './users';
export * from './schemas';
export * from './queue';
export * from './db.js';
export * from './users.js';
export * from './schemas.js';
export * from './queue.js';
+2 -2
View File
@@ -1,5 +1,5 @@
import { createLogger } from '../utils';
import { DB } from './db';
import { createLogger } from '../utils/index.js';
import { DB } from './db.js';
const logger = createLogger('db');
const db = DB.getInstance();
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from 'zod';
import * as constants from '../utils/constants';
import * as constants from '../utils/constants.js';
const ServiceIds = z.enum(constants.SERVICES);
+4 -7
View File
@@ -1,22 +1,19 @@
// import { UserDataSchema, UserData, DB } from '../db';
import { UserDataSchema, UserData } from './schemas';
import { TransactionQueue } from './queue';
import { DB } from './db';
import { UserData } from './schemas.js';
import { TransactionQueue } from './queue.js';
import { DB } from './db.js';
import {
decryptString,
deriveKey,
encryptString,
generateUUID,
getTextHash,
maskSensitiveInfo,
createLogger,
constants,
Env,
verifyHash,
validateConfig,
formatZodError,
applyMigrations,
} from '../utils';
} from '../utils/index.js';
const APIError = constants.APIError;
const logger = createLogger('users');
+1 -1
View File
@@ -1,5 +1,5 @@
import { URL } from 'url';
import { createLogger } from '../utils/logger';
import { createLogger } from '../utils/logger.js';
import path from 'path';
type BaseConnectionURI = {
+1 -5
View File
@@ -1,9 +1,5 @@
import { z } from 'zod';
import { constants, ServiceId } from '../utils';
import { ErrorType, StremThruError } from 'stremthru';
// type ErrorCode = "BAD_GATEWAY" | "BAD_REQUEST" | "CONFLICT" | "FORBIDDEN" | "GONE" | "INTERNAL_SERVER_ERROR" | "METHOD_NOT_ALLOWED" | "NOT_FOUND" | "NOT_IMPLEMENTED" | "PAYMENT_REQUIRED" | "PROXY_AUTHENTICATION_REQUIRED" | "SERVICE_UNAVAILABLE" | "STORE_LIMIT_EXCEEDED" | "STORE_MAGNET_INVALID" | "TOO_MANY_REQUESTS" | "UNAUTHORIZED" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "UNKNOWN" | "UNPROCESSABLE_ENTITY" | "UNSUPPORTED_MEDIA_TYPE";
StremThruError;
import { constants, ServiceId } from '../utils/index.js';
type DebridErrorCode =
| 'BAD_GATEWAY'
+9 -9
View File
@@ -1,13 +1,13 @@
export * from './base';
export * from './utils';
export * from './stremthru';
export * from './torbox';
export * from './base.js';
export * from './utils.js';
export * from './stremthru.js';
export * from './torbox.js';
import { ServiceId } from '../utils';
import { DebridService, DebridServiceConfig } from './base';
import { StremThruInterface } from './stremthru';
import { TorboxDebridService } from './torbox';
import { StremThruPreset } from '../presets/stremthru';
import { ServiceId } from '../utils/index.js';
import { DebridService, DebridServiceConfig } from './base.js';
import { StremThruInterface } from './stremthru.js';
import { TorboxDebridService } from './torbox.js';
import { StremThruPreset } from '../presets/stremthru.js';
export function getDebridService(
serviceName: ServiceId,
+11 -6
View File
@@ -1,16 +1,21 @@
import { StremThru, StremThruError } from 'stremthru';
import { Env, ServiceId, createLogger, getSimpleTextHash } from '../utils';
import { selectFileInTorrentOrNZB, Torrent } from './utils';
import {
Env,
ServiceId,
createLogger,
getSimpleTextHash,
Cache,
} from '../utils/index.js';
import { selectFileInTorrentOrNZB, Torrent } from './utils.js';
import {
DebridService,
DebridServiceConfig,
DebridDownload,
PlaybackInfo,
DebridError,
} from './base';
import { Cache } from '../utils';
import { StremThruServiceId } from '../presets/stremthru';
import { PTT } from '../parser';
} from './base.js';
import { StremThruServiceId } from '../presets/stremthru.js';
import { PTT } from '../parser/index.js';
import { ParseResult } from 'go-ptt';
const logger = createLogger('debrid:stremthru');
+13 -8
View File
@@ -1,18 +1,23 @@
import { TorboxApi } from '@torbox/torbox-api';
import { Env, ServiceId, createLogger, getSimpleTextHash } from '../utils';
import { PTT } from '../parser';
import { selectFileInTorrentOrNZB } from './utils';
import { StremThruError } from 'stremthru';
import { ParseResult } from 'go-ptt';
import {
Env,
ServiceId,
createLogger,
getSimpleTextHash,
Cache,
} from '../utils/index.js';
import { PTT } from '../parser/index.js';
import { selectFileInTorrentOrNZB } from './utils.js';
import {
DebridService,
DebridServiceConfig,
DebridDownload,
PlaybackInfo,
DebridError,
} from './base';
import { Cache } from '../utils';
import { StremThruInterface } from './stremthru';
import { StremThruError } from 'stremthru';
import { ParseResult } from 'go-ptt';
} from './base.js';
import { StremThruInterface } from './stremthru.js';
const logger = createLogger('debrid:torbox');
+3 -6
View File
@@ -1,10 +1,7 @@
import { z } from 'zod';
import { constants, createLogger } from '../utils';
import { BuiltinServiceId } from '../utils';
import { DebridFile, DebridDownload } from './base';
import { PTT } from '../parser';
import { normaliseTitle, titleMatch } from '../parser/utils';
import { constants, createLogger, BuiltinServiceId } from '../utils/index.js';
import { DebridFile, DebridDownload } from './base.js';
import { normaliseTitle, titleMatch } from '../parser/utils.js';
const logger = createLogger('debrid');
+9 -10
View File
@@ -1,15 +1,14 @@
import { ParsedStream, UserData } from '../db';
// import { constants, Env, createLogger } from '../utils';
import * as constants from '../utils/constants';
import { createLogger } from '../utils/logger';
import { ParsedStream, UserData } from '../db/schemas.js';
import * as constants from '../utils/constants.js';
import { createLogger } from '../utils/logger.js';
import {
formatBytes,
formatDuration,
languageToCode,
languageToEmoji,
makeSmall,
} from './utils';
import { Env } from '../utils/env';
} from './utils.js';
import { Env } from '../utils/env.js';
const logger = createLogger('formatter');
@@ -112,10 +111,10 @@ const stringModifiers = {
'upper': (value: string) => value.toUpperCase(),
'lower': (value: string) => value.toLowerCase(),
'title': (value: string) => value
.split(' ')
.map((word) => word.toLowerCase())
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' '),
.split(' ')
.map((word) => word.toLowerCase())
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' '),
'length': (value: string) => value.length.toString(),
'reverse': (value: string) => value.split('').reverse().join(''),
'base64': (value: string) => btoa(value),
+2 -2
View File
@@ -1,5 +1,5 @@
import { UserData } from '../db';
import { BaseFormatter, FormatterConfig } from './base';
import { UserData } from '../db/schemas.js';
import { BaseFormatter, FormatterConfig } from './base.js';
export class CustomFormatter extends BaseFormatter {
constructor(
+8 -8
View File
@@ -1,18 +1,18 @@
export * from './base';
export * from './predefined';
export * from './custom';
export * from './utils';
export * from './base.js';
export * from './predefined.js';
export * from './custom.js';
export * from './utils.js';
import { BaseFormatter, FormatterConfig } from './base';
import { BaseFormatter, FormatterConfig } from './base.js';
import {
TorrentioFormatter,
TorboxFormatter,
GDriveFormatter,
LightGDriveFormatter,
MinimalisticGdriveFormatter,
} from './predefined';
import { CustomFormatter } from './custom';
import { UserData } from '../db';
} from './predefined.js';
import { CustomFormatter } from './custom.js';
import { UserData } from '../db/schemas.js';
export function createFormatter(userData: UserData): BaseFormatter {
switch (userData.formatter.id) {
+2 -2
View File
@@ -1,5 +1,5 @@
import { UserData } from '../db';
import { BaseFormatter } from './base';
import { UserData } from '../db/schemas.js';
import { BaseFormatter } from './base.js';
export class TorrentioFormatter extends BaseFormatter {
constructor(userData: UserData) {
+1 -1
View File
@@ -1,4 +1,4 @@
import { FULL_LANGUAGE_MAPPING } from '../utils';
import { FULL_LANGUAGE_MAPPING } from '../utils/languages.js';
export function formatBytes(bytes: number, k: 1024 | 1000): string {
if (bytes === 0) return '0 B';
+9 -9
View File
@@ -1,10 +1,10 @@
export * from './utils';
export * from './db';
export * from './main';
export * from './parser';
export * from './formatters';
export * from './transformers';
export * from './debrid';
export * from './utils/index.js';
export * from './db/index.js';
export * from './main.js';
export * from './parser/index.js';
export * from './formatters/index.js';
export * from './transformers/index.js';
export * from './debrid/index.js';
export {
TorBoxSearchAddon,
GDriveAddon,
@@ -14,5 +14,5 @@ export {
TorznabAddon,
NewznabAddon,
ProwlarrAddon,
} from './builtins';
export { PresetManager } from './presets';
} from './builtins/index.js';
export { PresetManager } from './presets/index.js';
+14 -14
View File
@@ -4,7 +4,7 @@ import {
Resource,
StrictManifestResource,
UserData,
} from './db';
} from './db/index.js';
import {
constants,
createLogger,
@@ -16,9 +16,9 @@ import {
ExtrasParser,
makeUrlLogSafe,
AnimeDatabase,
} from './utils';
import { Wrapper } from './wrapper';
import { PresetManager } from './presets';
} from './utils/index.js';
import { Wrapper } from './wrapper.js';
import { PresetManager } from './presets/index.js';
import {
AddonCatalog,
Meta,
@@ -27,12 +27,12 @@ import {
ParsedStream,
Preset,
Subtitle,
} from './db/schemas';
import { createProxy } from './proxy';
import { RPDB } from './utils/rpdb';
import { FeatureControl } from './utils/feature';
import Proxifier from './streams/proxifier';
import StreamLimiter from './streams/limiter';
} from './db/schemas.js';
import { createProxy } from './proxy/index.js';
import { RPDB } from './utils/rpdb.js';
import { FeatureControl } from './utils/feature.js';
import Proxifier from './streams/proxifier.js';
import StreamLimiter from './streams/limiter.js';
import {
StreamFetcher as Fetcher,
StreamFilterer as Filterer,
@@ -40,10 +40,10 @@ import {
StreamDeduplicator as Deduplicator,
StreamPrecomputer as Precomputer,
StreamUtils,
} from './streams';
import { getAddonName } from './utils/general';
import { TMDBMetadata } from './metadata/tmdb';
import { Metadata } from './metadata/utils';
} from './streams/index.js';
import { getAddonName } from './utils/general.js';
import { TMDBMetadata } from './metadata/tmdb.js';
import { Metadata } from './metadata/utils.js';
const logger = createLogger('core');
const shuffleCache = Cache.getInstance<string, MetaPreview[]>('shuffle');
+3 -4
View File
@@ -1,8 +1,7 @@
import { z } from 'zod';
import { Cache, makeRequest, Env, TYPES } from '../utils';
import { Wrapper } from '../wrapper';
import { Metadata } from './utils';
import { Meta, MetaSchema } from '../db';
import { Cache, makeRequest, Env, TYPES } from '../utils/index.js';
import { Metadata } from './utils.js';
import { Meta, MetaSchema } from '../db/schemas.js';
const IMDBSuggestionSchema = z.object({
d: z.array(
+9 -9
View File
@@ -1,12 +1,12 @@
import { DistributedLock } from '../utils/distributed-lock';
import { Metadata } from './utils';
import { TMDBMetadata } from './tmdb';
import { getTraktAliases } from './trakt';
import { IMDBMetadata } from './imdb';
import { createLogger, getTimeTakenSincePoint } from '../utils/logger';
import { TYPES } from '../utils/constants';
import { AnimeDatabase, ParsedId } from '../utils';
import { Meta } from '../db/schemas';
import { DistributedLock } from '../utils/distributed-lock.js';
import { Metadata } from './utils.js';
import { TMDBMetadata } from './tmdb.js';
import { getTraktAliases } from './trakt.js';
import { IMDBMetadata } from './imdb.js';
import { createLogger, getTimeTakenSincePoint } from '../utils/logger.js';
import { TYPES } from '../utils/constants.js';
import { AnimeDatabase, ParsedId } from '../utils/index.js';
import { Meta } from '../db/schemas.js';
const logger = createLogger('metadata-service');
+2 -2
View File
@@ -1,6 +1,6 @@
import { Headers } from 'undici';
import { Env, Cache, TYPES, makeRequest } from '../utils';
import { Metadata } from './utils';
import { Env, Cache, TYPES, makeRequest } from '../utils/index.js';
import { Metadata } from './utils.js';
import { z } from 'zod';
export type ExternalIdType = 'imdb' | 'tmdb' | 'tvdb';
+1 -1
View File
@@ -7,7 +7,7 @@ import {
ParsedId,
formatZodError,
Env,
} from '../utils';
} from '../utils/index.js';
const traktAliasCache = Cache.getInstance<string, string[]>('trakt-aliases');
const TRAKT_ALIAS_CACHE_TTL = 7 * 24 * 60 * 60; // 7 days
+3 -3
View File
@@ -1,6 +1,6 @@
import { PARSE_REGEX } from './regex';
import { ParsedFile } from '../db/schemas';
import ptt from './ptt';
import { PARSE_REGEX } from './regex.js';
import { ParsedFile } from '../db/schemas.js';
import ptt from './ptt.js';
function matchPattern(
filename: string,
+1 -1
View File
@@ -6,7 +6,7 @@ import {
Env,
getSimpleTextHash,
getTimeTakenSincePoint,
} from '../utils';
} from '../utils/index.js';
const logger = createLogger('parser');
+3 -3
View File
@@ -1,3 +1,3 @@
export { default as FileParser } from './file';
export { default as StreamParser } from './streams';
export { default as PTT } from './go-ptt';
export { default as FileParser } from './file.js';
export { default as StreamParser } from './streams.js';
export { default as PTT } from './go-ptt.js';
+30 -17
View File
@@ -1,9 +1,10 @@
import { AUDIO_TAGS, QUALITIES, RESOLUTIONS } from '../utils/constants';
import { VISUAL_TAGS } from '../utils/constants';
import { ENCODES } from '../utils/constants';
import { LANGUAGES } from '../utils/constants';
import { AUDIO_CHANNELS } from '../utils/constants';
import { FakeVisualTag } from '../utils/constants';
// import { AUDIO_TAGS, QUALITIES, RESOLUTIONS } from '../utils/constants';
// import { VISUAL_TAGS } from '../utils/constants';
// import { ENCODES } from '../utils/constants';
// import { LANGUAGES } from '../utils/constants';
// import { AUDIO_CHANNELS } from '../utils/constants';
// import { FakeVisualTag } from '../utils/constants';
import { constants } from '../utils/index.js';
const createRegex = (pattern: string): RegExp =>
new RegExp(`(?<![^\\s\\[(_\\-.,])(${pattern})(?=[\\s\\)\\]_.\\-,]|$)`, 'i');
@@ -11,19 +12,31 @@ const createLanguageRegex = (pattern: string): RegExp =>
createRegex(`${pattern}(?![ .\\-_]?sub(title)?s?)`);
type PARSE_REGEX = {
resolutions: Omit<Record<(typeof RESOLUTIONS)[number], RegExp>, 'Unknown'>;
qualities: Omit<Record<(typeof QUALITIES)[number], RegExp>, 'Unknown'>;
visualTags: Omit<
Record<(typeof VISUAL_TAGS)[number], RegExp>,
'Unknown' | FakeVisualTag
>;
audioTags: Omit<Record<(typeof AUDIO_TAGS)[number], RegExp>, 'Unknown'>;
audioChannels: Omit<
Record<(typeof AUDIO_CHANNELS)[number], RegExp>,
resolutions: Omit<
Record<(typeof constants.RESOLUTIONS)[number], RegExp>,
'Unknown'
>;
languages: Omit<Record<(typeof LANGUAGES)[number], RegExp>, 'Unknown'>;
encodes: Omit<Record<(typeof ENCODES)[number], RegExp>, 'Unknown'>;
qualities: Omit<
Record<(typeof constants.QUALITIES)[number], RegExp>,
'Unknown'
>;
visualTags: Omit<
Record<(typeof constants.VISUAL_TAGS)[number], RegExp>,
'Unknown' | constants.FakeVisualTag
>;
audioTags: Omit<
Record<(typeof constants.AUDIO_TAGS)[number], RegExp>,
'Unknown'
>;
audioChannels: Omit<
Record<(typeof constants.AUDIO_CHANNELS)[number], RegExp>,
'Unknown'
>;
languages: Omit<
Record<(typeof constants.LANGUAGES)[number], RegExp>,
'Unknown'
>;
encodes: Omit<Record<(typeof constants.ENCODES)[number], RegExp>, 'Unknown'>;
releaseGroup: RegExp;
};
+5 -1
View File
@@ -1,5 +1,9 @@
import { Parser } from 'expr-eval';
import { ParsedStream, ParsedStreams, ParsedStreamSchema } from '../db';
import {
ParsedStream,
ParsedStreams,
ParsedStreamSchema,
} from '../db/schemas.js';
import bytes from 'bytes';
export abstract class StreamExpressionEngine {
+8 -3
View File
@@ -1,6 +1,11 @@
import { Stream, ParsedStream, Addon, ParsedFile } from '../db';
import { constants, createLogger, Env, FULL_LANGUAGE_MAPPING } from '../utils';
import FileParser from './file';
import { Stream, ParsedStream, Addon, ParsedFile } from '../db/index.js';
import {
constants,
createLogger,
Env,
FULL_LANGUAGE_MAPPING,
} from '../utils/index.js';
import FileParser from './file.js';
const logger = createLogger('parser');
class StreamParser {
+1 -1
View File
@@ -1,5 +1,5 @@
import { extract, FuzzballExtractOptions } from 'fuzzball';
import { createLogger } from '../utils';
import { createLogger } from '../utils/index.js';
const logger = createLogger('parser');
+9 -4
View File
@@ -5,10 +5,15 @@ import {
ParsedFile,
Stream,
UserData,
} from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env, HTTP_STREAM_TYPE, LIVE_STREAM_TYPE } from '../utils';
import { FileParser, StreamParser } from '../parser';
} from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import {
constants,
Env,
HTTP_STREAM_TYPE,
LIVE_STREAM_TYPE,
} from '../utils/index.js';
import { FileParser, StreamParser } from '../parser/index.js';
class AStreamStreamParser extends StreamParser {
protected override getParsedFile(
+5 -3
View File
@@ -1,5 +1,5 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import {
Cache,
constants,
@@ -7,7 +7,7 @@ import {
formatZodError,
getSimpleTextHash,
makeRequest,
} from '../utils';
} from '../utils/index.js';
import { z } from 'zod';
import { FormData } from 'undici';
@@ -330,3 +330,5 @@ export class AICompanionPreset extends Preset {
}
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Cache, constants, Env, makeRequest } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Cache, constants, Env, makeRequest } from '../utils/index.js';
import { z } from 'zod';
const configCache = Cache.getInstance<string, string>('ai-search-config');
@@ -306,3 +306,5 @@ export class AISearchPreset extends Preset {
}
}
}
+7 -5
View File
@@ -5,11 +5,11 @@ import {
ParsedStream,
Stream,
AIOStream,
} from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env, formatZodError, RESOURCES } from '../utils';
import { StreamParser } from '../parser';
import { createLogger } from '../utils';
} from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env, formatZodError, RESOURCES } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
import { createLogger } from '../utils/index.js';
const logger = createLogger('parser');
@@ -172,3 +172,5 @@ export class AIOStreamsPreset extends Preset {
};
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class AIOSubtitlePreset extends Preset {
static override get METADATA() {
@@ -436,3 +436,5 @@ export class AIOSubtitlePreset extends Preset {
return `${host}/stremio/${configString}/manifest.json`;
}
}
+4 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class AnimeCatalogsPreset extends Preset {
private static malCatalogs = [
@@ -319,3 +319,4 @@ export class AnimeCatalogsPreset extends Preset {
return cacheKey;
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class AnimeKitsuPreset extends Preset {
static override get METADATA() {
@@ -76,3 +76,5 @@ export class AnimeKitsuPreset extends Preset {
};
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Option, UserData } from '../db';
import { Env, constants } from '../utils';
import { baseOptions } from './preset';
import { StremThruPreset } from './stremthru';
import { TorznabPreset } from './torznab';
import { Option, UserData } from '../db/index.js';
import { Env, constants } from '../utils/index.js';
import { baseOptions } from './preset.js';
import { StremThruPreset } from './stremthru.js';
import { TorznabPreset } from './torznab.js';
export class AnimeToshoPreset extends TorznabPreset {
static override get METADATA() {
@@ -68,3 +68,5 @@ export class AnimeToshoPreset extends TorznabPreset {
return `${Env.INTERNAL_URL}/builtins/torznab/${configString}/manifest.json`;
}
}
+6 -4
View File
@@ -5,10 +5,10 @@ import {
ParsedStream,
Stream,
UserData,
} from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env, LIVE_STREAM_TYPE } from '../utils';
import { FileParser, StreamParser } from '../parser';
} from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env, LIVE_STREAM_TYPE } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser/index.js';
class ArgentinaTvStreamParser extends StreamParser {
protected override getParsedFile(
@@ -121,3 +121,5 @@ export class ArgentinaTVPreset extends Preset {
};
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { ParsedStream, Stream, UserData } from '../db';
import { StreamParser } from '../parser';
import { ServiceId } from '../utils/constants';
import { Preset } from './preset';
import { stremthruSpecialCases } from './stremthru';
import { ParsedStream, Stream, UserData } from '../db/index.js';
import { StreamParser } from '../parser/index.js';
import { ServiceId } from '../utils/constants.js';
import { Preset } from './preset.js';
import { stremthruSpecialCases } from './stremthru.js';
export class BuiltinStreamParser extends StreamParser {
override getFolder(stream: Stream): string | undefined {
@@ -68,3 +68,5 @@ export class BuiltinAddonPreset extends Preset {
});
}
}
+8 -6
View File
@@ -1,9 +1,9 @@
import { Addon, Option, UserData, Resource } from '../db';
import { baseOptions, Preset } from './preset';
import { Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { StremThruPreset } from './stremthru';
import { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
import { StremThruPreset } from './stremthru.js';
class CometStreamParser extends StreamParser {
get errorRegexes(): { pattern: RegExp; message: string }[] | undefined {
@@ -224,3 +224,5 @@ export class CometPreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
+6 -4
View File
@@ -1,7 +1,7 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
class ContentDeepDiveStreamParser extends StreamParser {
protected getFilename(
@@ -112,3 +112,5 @@ export class ContentDeepDivePreset extends Preset {
return `${url}/manifest.json`;
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES } from '../utils/index.js';
export class CustomPreset extends Preset {
static override get METADATA() {
@@ -143,3 +143,5 @@ export class CustomPreset extends Preset {
};
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class DcUniversePreset extends Preset {
// dc-batman-animations%2C
@@ -157,3 +157,5 @@ export class DcUniversePreset extends Preset {
return cacheKey;
}
}
+3 -1
View File
@@ -1,4 +1,4 @@
import { Option } from '../db';
import { Option } from '../db/index.js';
export const debridioSocialOption: Option = {
id: 'socials',
@@ -17,3 +17,5 @@ export const debridioApiKeyOption: Option = {
};
export const debridioLogo = 'https://cdn.lb.debridio.com/site/logo.png';
+8 -6
View File
@@ -1,13 +1,13 @@
import { Addon, Option, UserData, Resource, Stream } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, SERVICE_DETAILS } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, UserData, Resource, Stream } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
import {
debridioSocialOption,
debridioLogo,
debridioApiKeyOption,
} from './debridio';
} from './debridio.js';
export class DebridioPreset extends Preset {
static override get METADATA() {
@@ -151,3 +151,5 @@ export class DebridioPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
+4 -4
View File
@@ -1,11 +1,11 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import {
debridioSocialOption,
debridioApiKeyOption,
debridioLogo,
} from './debridio';
} from './debridio.js';
export class DebridioTmdbPreset extends Preset {
static override get METADATA() {
+5 -5
View File
@@ -5,15 +5,15 @@ import {
ParsedStream,
Stream,
UserData,
} from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
} from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import {
debridioSocialOption,
debridioApiKeyOption,
debridioLogo,
} from './debridio';
import { FileParser, StreamParser } from '../parser';
} from './debridio.js';
import { FileParser, StreamParser } from '../parser/index.js';
class DebridioTvStreamParser extends StreamParser {
protected override getParsedFile(
+4 -4
View File
@@ -1,11 +1,11 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import {
debridioSocialOption,
debridioApiKeyOption,
debridioLogo,
} from './debridio';
} from './debridio.js';
export class DebridioTvdbPreset extends Preset {
static override get METADATA() {
@@ -1,12 +1,12 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { FileParser, StreamParser } from '../parser';
import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser/index.js';
import {
debridioSocialOption,
debridioApiKeyOption,
debridioLogo,
} from './debridio';
} from './debridio.js';
class DebridioWatchtowerStreamParser extends StreamParser {
override parse(stream: Stream): ParsedStream | { skip: true } {
+6 -4
View File
@@ -5,10 +5,10 @@ import {
ParsedStream,
Stream,
AIOStream,
} from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env, RESOURCES } from '../utils';
import { StreamParser } from '../parser';
} from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env, RESOURCES } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
class DMMCastStreamParser extends StreamParser {
protected override getFilename(
@@ -153,3 +153,5 @@ export class DMMCastPreset extends Preset {
};
}
}
@@ -1,9 +1,9 @@
// stremio://new-who.onrender.com/manifest.json
import { Addon, Option, ParsedStream, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
class DoctorWhoUniverseStreamParser extends StreamParser {
protected override getMessage(
@@ -92,3 +92,5 @@ export class DoctorWhoUniversePreset extends Preset {
};
}
}
+6 -4
View File
@@ -1,5 +1,5 @@
import { baseOptions, Preset } from './preset';
import { constants, Env } from '../utils';
import { baseOptions, Preset } from './preset.js';
import { constants, Env } from '../utils/index.js';
import {
PresetMetadata,
Option,
@@ -7,8 +7,8 @@ import {
UserData,
ParsedStream,
Stream,
} from '../db';
import { StreamParser } from '../parser';
} from '../db/index.js';
import { StreamParser } from '../parser/index.js';
export class EasynewsParser extends StreamParser {
protected override getStreamType(
@@ -115,3 +115,5 @@ export class EasynewsPreset extends Preset {
return `${url}/${this.generateConfig(easynewsCredentials, options)}/manifest.json`;
}
}
+4 -4
View File
@@ -1,7 +1,7 @@
import { PresetMetadata } from '../db';
import { EasynewsPreset } from './easynews';
import { constants, Env } from '../utils';
import { baseOptions } from './preset';
import { PresetMetadata } from '../db/index.js';
import { EasynewsPreset } from './easynews.js';
import { constants, Env } from '../utils/index.js';
import { baseOptions } from './preset.js';
export class EasynewsPlusPreset extends EasynewsPreset {
static override get METADATA(): PresetMetadata {
@@ -1,8 +1,8 @@
import { ParsedStream, PresetMetadata, Stream } from '../db';
import { EasynewsPreset, EasynewsParser } from './easynews';
import { constants, Env } from '../utils';
import { baseOptions } from './preset';
import { StreamParser } from '../parser';
import { ParsedStream, PresetMetadata, Stream } from '../db/index.js';
import { EasynewsPreset, EasynewsParser } from './easynews.js';
import { constants, Env } from '../utils/index.js';
import { baseOptions } from './preset.js';
import { StreamParser } from '../parser/index.js';
class EasynewsPlusPlusParser extends EasynewsParser {
protected override get ageRegex(): RegExp {
+4 -4
View File
@@ -1,9 +1,9 @@
// stremio://new-who.onrender.com/manifest.json
import { Addon, Option, ParsedStream, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { constants, Env, ServiceId } from '../utils';
import { StremThruPreset } from './stremthru';
import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { constants, Env, ServiceId } from '../utils/index.js';
import { StremThruPreset } from './stremthru.js';
export class FKStreamPreset extends StremThruPreset {
static override get METADATA() {
+6 -6
View File
@@ -1,5 +1,5 @@
import { baseOptions, Preset } from './preset';
import { constants, Env } from '../utils';
import { baseOptions, Preset } from './preset.js';
import { constants, Env } from '../utils/index.js';
import {
PresetMetadata,
Option,
@@ -7,10 +7,10 @@ import {
UserData,
ParsedStream,
Stream,
} from '../db';
import { StreamParser } from '../parser';
import { GDriveAPI } from '../builtins/gdrive';
import { GoogleOAuth } from '../builtins/gdrive/api';
} from '../db/index.js';
import { StreamParser } from '../parser/index.js';
import { GDriveAPI } from '../builtins/gdrive/index.js';
import { GoogleOAuth } from '../builtins/gdrive/api.js';
export class GDriveParser extends StreamParser {
protected override raiseErrorIfNecessary(
+4 -2
View File
@@ -1,2 +1,4 @@
export * from './preset';
export * from './presetManager';
export * from './preset.js';
export * from './presetManager.js';
+8 -6
View File
@@ -1,9 +1,9 @@
import { Addon, Option, UserData, Resource } from '../db';
import { baseOptions, Preset } from './preset';
import { Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { StremThruPreset } from './stremthru';
import { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
import { StremThruPreset } from './stremthru.js';
class JackettioStreamParser extends StreamParser {
override applyUrlModifications(url: string | undefined): string | undefined {
@@ -195,3 +195,5 @@ export class JackettioPreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class MarvelPreset extends Preset {
private static catalogs = [
@@ -133,3 +133,5 @@ export class MarvelPreset extends Preset {
return cacheKey;
}
}
+14 -5
View File
@@ -1,8 +1,15 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db';
import { baseOptions, Preset } from './preset';
import { createLogger, Env, getSimpleTextHash } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import {
Addon,
Option,
UserData,
Resource,
Stream,
ParsedStream,
} from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { createLogger, Env, getSimpleTextHash } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
const logger = createLogger('core');
@@ -517,3 +524,5 @@ export class MediaFusionPreset extends Preset {
return encodedUserData;
}
}
+6 -4
View File
@@ -1,13 +1,13 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import {
Cache,
constants,
Env,
getSimpleTextHash,
makeRequest,
} from '../utils';
import { StreamParser } from '../parser';
} from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
const moreLikeThisManifests = Cache.getInstance<string, string>(
'moreLikeThisManifests'
@@ -504,3 +504,5 @@ export class MoreLikeThisPreset extends Preset {
}
}
}
+6 -4
View File
@@ -1,7 +1,7 @@
import { Addon, Option, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES, ServiceId, constants } from '../utils';
import { BuiltinAddonPreset } from './builtin';
import { Addon, Option, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, ServiceId, constants } from '../utils/index.js';
import { BuiltinAddonPreset } from './builtin.js';
export class NewznabPreset extends BuiltinAddonPreset {
static override get METADATA() {
@@ -146,3 +146,5 @@ export class NewznabPreset extends BuiltinAddonPreset {
return `${this.METADATA.URL}/${configString}/manifest.json`;
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, SERVICE_DETAILS } from '../utils';
import { constants, ServiceId } from '../utils';
import { FileParser, StreamParser } from '../parser';
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser/index.js';
class NuvioStreamsStreamParser extends StreamParser {
parse(stream: Stream): ParsedStream {
@@ -273,3 +273,5 @@ export class NuvioStreamsPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class OpenSubtitlesV3PlusPreset extends Preset {
static override get METADATA() {
@@ -220,3 +220,5 @@ export class OpenSubtitlesV3PlusPreset extends Preset {
return `${host}/${config}/manifest.json`;
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class OpenSubtitlesPreset extends Preset {
static override get METADATA() {
@@ -58,3 +58,5 @@ export class OpenSubtitlesPreset extends Preset {
};
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, ParsedStream, Stream } from '../db';
import { baseOptions, Preset } from './preset';
import { Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, UserData, Resource, ParsedStream, Stream } from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
class OrionStreamParser extends StreamParser {
protected override raiseErrorIfNecessary(
@@ -188,3 +188,5 @@ export class OrionPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, Stream } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, SERVICE_DETAILS } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, UserData, Resource, Stream } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
export class PeerflixPreset extends Preset {
static override get METADATA() {
@@ -181,3 +181,5 @@ export class PeerflixPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
+5 -3
View File
@@ -6,9 +6,9 @@ import {
UserData,
PresetMetadata,
Addon,
} from '../db';
import { StreamParser } from '../parser';
import { Env, ServiceId, constants } from '../utils';
} from '../db/index.js';
import { StreamParser } from '../parser/index.js';
import { Env, ServiceId, constants } from '../utils/index.js';
/**
*
* What modifications are needed for each preset:
@@ -274,3 +274,5 @@ export abstract class Preset {
return apiKey;
}
}
+63 -61
View File
@@ -1,64 +1,64 @@
import { PresetMetadata, PresetMinimalMetadata } from '../db';
import { CometPreset } from './comet';
import { CustomPreset } from './custom';
import { MediaFusionPreset } from './mediafusion';
import { StremthruStorePreset } from './stremthruStore';
import { TorrentioPreset } from './torrentio';
import { TorboxAddonPreset } from './torbox';
import { EasynewsPreset } from './easynews';
import { EasynewsPlusPreset } from './easynewsPlus';
import { EasynewsPlusPlusPreset } from './easynewsPlusPlus';
import { StremthruTorzPreset } from './stremthruTorz';
import { DebridioPreset } from './debridioScraper';
import { AIOStreamsPreset } from './aiostreams';
import { OpenSubtitlesPreset } from './opensubtitles';
import { PeerflixPreset } from './peerflix';
import { DMMCastPreset } from './dmmCast';
import { MarvelPreset } from './marvel';
import { JackettioPreset } from './jackettio';
import { OrionPreset } from './orion';
import { StreamFusionPreset } from './streamfusion';
import { AnimeKitsuPreset } from './animeKitsu';
import { NuvioStreamsPreset } from './nuviostreams';
import { RpdbCatalogsPreset } from './rpdbCatalogs';
import { TmdbCollectionsPreset } from './tmdbCollections';
import { DebridioWatchtowerPreset } from './debridioWatchtower';
import { DebridioTmdbPreset } from './debridioTmdb';
import { StarWarsUniversePreset } from './starWarsUniverse';
import { DebridioTvdbPreset } from './debridioTvdb';
import { DcUniversePreset } from './dcUniverse';
import { DebridioTvPreset } from './debridioTv';
import { TorrentCatalogsPreset } from './torrentCatalogs';
import { StreamingCatalogsPreset } from './streamingCatalogs';
import { AnimeCatalogsPreset } from './animeCatalogs';
import { DoctorWhoUniversePreset } from './doctorWhoUniverse';
import { WebStreamrPreset } from './webstreamr';
import { TMDBAddonPreset } from './tmdb';
import { TorrentsDbPreset } from './torrentsDb';
import { USATVPreset } from './usaTv';
import { ArgentinaTVPreset } from './argentinaTv';
import { OpenSubtitlesV3PlusPreset } from './opensubtitles-v3-plus';
import { SubSourcePreset } from './subsource';
import { SubDLPreset } from './subdl';
import { AISearchPreset } from './aiSearch';
import { FKStreamPreset } from './fkstream';
import { AIOSubtitlePreset } from './aiosubtitle';
import { SubHeroPreset } from './subhero';
import { StreamAsiaPreset } from './streamasia';
import { MoreLikeThisPreset } from './moreLikeThis';
import { GDriveAPI } from '../builtins/gdrive';
import { GDrivePreset } from './gdrive';
import { ContentDeepDivePreset } from './contentDeepDive';
import { AICompanionPreset } from './aiCompanion';
import { GoogleOAuth } from '../builtins/gdrive/api';
import { TorBoxSearchPreset } from './torboxSearch';
import { TorznabPreset } from './torznab';
import { AStreamPreset } from './aStream';
import { Env } from '../utils/env';
import { ZileanPreset } from './zilean';
import { AnimeToshoPreset } from './animetosho';
import { NewznabPreset } from './newznab';
import { ProwlarrPreset } from './prowlarr';
import { PresetMetadata, PresetMinimalMetadata } from '../db/index.js';
import { CometPreset } from './comet.js';
import { CustomPreset } from './custom.js';
import { MediaFusionPreset } from './mediafusion.js';
import { StremthruStorePreset } from './stremthruStore.js';
import { TorrentioPreset } from './torrentio.js';
import { TorboxAddonPreset } from './torbox.js';
import { EasynewsPreset } from './easynews.js';
import { EasynewsPlusPreset } from './easynewsPlus.js';
import { EasynewsPlusPlusPreset } from './easynewsPlusPlus.js';
import { StremthruTorzPreset } from './stremthruTorz.js';
import { DebridioPreset } from './debridioScraper.js';
import { AIOStreamsPreset } from './aiostreams.js';
import { OpenSubtitlesPreset } from './opensubtitles.js';
import { PeerflixPreset } from './peerflix.js';
import { DMMCastPreset } from './dmmCast.js';
import { MarvelPreset } from './marvel.js';
import { JackettioPreset } from './jackettio.js';
import { OrionPreset } from './orion.js';
import { StreamFusionPreset } from './streamfusion.js';
import { AnimeKitsuPreset } from './animeKitsu.js';
import { NuvioStreamsPreset } from './nuviostreams.js';
import { RpdbCatalogsPreset } from './rpdbCatalogs.js';
import { TmdbCollectionsPreset } from './tmdbCollections.js';
import { DebridioWatchtowerPreset } from './debridioWatchtower.js';
import { DebridioTmdbPreset } from './debridioTmdb.js';
import { StarWarsUniversePreset } from './starWarsUniverse.js';
import { DebridioTvdbPreset } from './debridioTvdb.js';
import { DcUniversePreset } from './dcUniverse.js';
import { DebridioTvPreset } from './debridioTv.js';
import { TorrentCatalogsPreset } from './torrentCatalogs.js';
import { StreamingCatalogsPreset } from './streamingCatalogs.js';
import { AnimeCatalogsPreset } from './animeCatalogs.js';
import { DoctorWhoUniversePreset } from './doctorWhoUniverse.js';
import { WebStreamrPreset } from './webstreamr.js';
import { TMDBAddonPreset } from './tmdb.js';
import { TorrentsDbPreset } from './torrentsDb.js';
import { USATVPreset } from './usaTv.js';
import { ArgentinaTVPreset } from './argentinaTv.js';
import { OpenSubtitlesV3PlusPreset } from './opensubtitles-v3-plus.js';
import { SubSourcePreset } from './subsource.js';
import { SubDLPreset } from './subdl.js';
import { AISearchPreset } from './aiSearch.js';
import { FKStreamPreset } from './fkstream.js';
import { AIOSubtitlePreset } from './aiosubtitle.js';
import { SubHeroPreset } from './subhero.js';
import { StreamAsiaPreset } from './streamasia.js';
import { MoreLikeThisPreset } from './moreLikeThis.js';
import { GDriveAPI } from '../builtins/gdrive/index.js';
import { GDrivePreset } from './gdrive.js';
import { ContentDeepDivePreset } from './contentDeepDive.js';
import { AICompanionPreset } from './aiCompanion.js';
import { GoogleOAuth } from '../builtins/gdrive/api.js';
import { TorBoxSearchPreset } from './torboxSearch.js';
import { TorznabPreset } from './torznab.js';
import { AStreamPreset } from './aStream.js';
import { Env } from '../utils/env.js';
import { ZileanPreset } from './zilean.js';
import { AnimeToshoPreset } from './animetosho.js';
import { NewznabPreset } from './newznab.js';
import { ProwlarrPreset } from './prowlarr.js';
let PRESET_LIST: string[] = [
'custom',
@@ -261,3 +261,5 @@ export class PresetManager {
}
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, Stream, UserData } from '../db';
import { Preset, baseOptions } from './preset';
import { Env, RESOURCES, ServiceId, constants } from '../utils';
import { StremThruPreset } from './stremthru';
import { BuiltinAddonPreset } from './builtin';
import { Addon, Option, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, ServiceId, constants } from '../utils/index.js';
import { StremThruPreset } from './stremthru.js';
import { BuiltinAddonPreset } from './builtin.js';
export class ProwlarrPreset extends BuiltinAddonPreset {
static override get METADATA() {
@@ -133,3 +133,5 @@ export class ProwlarrPreset extends BuiltinAddonPreset {
return `${this.METADATA.URL}/${configString}/manifest.json`;
}
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class RpdbCatalogsPreset extends Preset {
private static catalogs = [
@@ -109,3 +109,5 @@ export class RpdbCatalogsPreset extends Preset {
return cacheKey;
}
}
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class StarWarsUniversePreset extends Preset {
private static catalogs = [
@@ -161,3 +161,5 @@ export class StarWarsUniversePreset extends Preset {
return cacheKey;
}
}
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db';
import { baseOptions, Preset } from './preset';
import { createLogger, Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { createLogger, Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
const logger = createLogger('core');
@@ -445,3 +445,5 @@ there is no need to provide these details here.
return encodedUserData;
}
}
+6 -4
View File
@@ -1,7 +1,7 @@
import { Addon, Option, UserData, Resource } from '../db';
import { baseOptions, Preset } from './preset';
import { Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
export class StreamFusionPreset extends Preset {
static override get METADATA() {
@@ -275,3 +275,5 @@ export class StreamFusionPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset';
import { constants, Env } from '../utils';
import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils/index.js';
export class StreamingCatalogsPreset extends Preset {
// amp,atp,hbm,sst,vil,cpd,nlz,blv,zee,hay,clv,gop,hst,cru,mgl,cts,hlu,pmp,pcp,dnp,nfk,nfx
@@ -220,3 +220,5 @@ export class StreamingCatalogsPreset extends Preset {
return cacheKey;
}
}
+6 -4
View File
@@ -1,7 +1,7 @@
import { Option, ParsedStream, Stream, UserData } from '../db';
import { StreamParser } from '../parser';
import { constants, ServiceId } from '../utils';
import { Preset } from './preset';
import { Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { StreamParser } from '../parser/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { Preset } from './preset.js';
export const stremthruSpecialCases: Partial<
Record<ServiceId, (credentials: any) => any>
@@ -76,3 +76,5 @@ export class StremThruPreset extends Preset {
export type StremThruServiceId =
(typeof StremThruPreset.supportedServices)[number];
+15 -6
View File
@@ -1,9 +1,16 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db';
import { baseOptions, Preset } from './preset';
import { Env } from '../utils';
import { constants, ServiceId } from '../utils';
import { StreamParser } from '../parser';
import { StremThruPreset, StremThruStreamParser } from './stremthru';
import {
Addon,
Option,
UserData,
Resource,
Stream,
ParsedStream,
} from '../db/index.js';
import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser/index.js';
import { StremThruPreset, StremThruStreamParser } from './stremthru.js';
class StremthruStoreStreamParser extends StremThruStreamParser {
protected override applyUrlModifications(
@@ -180,3 +187,5 @@ export class StremthruStorePreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`;
}
}

Some files were not shown because too many files have changed in this diff Show More