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", "name": "aiostreams",
"version": "2.12.2", "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.", "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", "main": "dist/index.js",
"scripts": { "scripts": {
"test": "pnpm run test --workspaces", "test": "pnpm run test --workspaces",
+1
View File
@@ -2,6 +2,7 @@
"name": "@aiostreams/core", "name": "@aiostreams/core",
"version": "0.0.0", "version": "0.0.0",
"main": "dist/index.js", "main": "dist/index.js",
"type": "module",
"scripts": { "scripts": {
"test": "vitest run --passWithNoTests", "test": "vitest run --passWithNoTests",
"test:watch": "vitest watch", "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 { z, ZodError } from 'zod';
import { IdParser, IdType, ParsedId } from '../../utils/id-parser'; import { IdParser, IdType, ParsedId } from '../../utils/id-parser.js';
import { import {
AnimeDatabase, AnimeDatabase,
constants, constants,
@@ -8,8 +8,8 @@ import {
formatZodError, formatZodError,
getTimeTakenSincePoint, getTimeTakenSincePoint,
SERVICE_DETAILS, SERVICE_DETAILS,
} from '../../utils'; } from '../../utils/index.js';
import { TorrentClient } from '../../utils/torrent'; import { TorrentClient } from '../../utils/torrent.js';
import { import {
BuiltinDebridServices, BuiltinDebridServices,
PlaybackInfo, PlaybackInfo,
@@ -20,11 +20,11 @@ import {
UnprocessedTorrent, UnprocessedTorrent,
ServiceAuth, ServiceAuth,
DebridError, DebridError,
} from '../../debrid'; } from '../../debrid/index.js';
import { processTorrents, processNZBs } from '../utils/debrid'; import { processTorrents, processNZBs } from '../utils/debrid.js';
import { calculateAbsoluteEpisode } from '../utils/general'; import { calculateAbsoluteEpisode } from '../utils/general.js';
import { TitleMetadata } from '../torbox-search/source-handlers'; import { TitleMetadata } from '../torbox-search/source-handlers.js';
import { MetadataService } from '../../metadata/service'; import { MetadataService } from '../../metadata/service.js';
import { Logger } from 'winston'; import { Logger } from 'winston';
export interface SearchMetadata extends TitleMetadata { export interface SearchMetadata extends TitleMetadata {
+4 -4
View File
@@ -1,13 +1,13 @@
import { z } from 'zod'; import { z } from 'zod';
import { ParsedId } from '../../../utils/id-parser'; import { ParsedId } from '../../../utils/id-parser.js';
import { getTimeTakenSincePoint } from '../../../utils'; import { getTimeTakenSincePoint } from '../../../utils/index.js';
import { Logger } from 'winston'; import { Logger } from 'winston';
import { import {
BaseDebridAddon, BaseDebridAddon,
BaseDebridConfigSchema, BaseDebridConfigSchema,
SearchMetadata, SearchMetadata,
} from '../debrid'; } from '../debrid.js';
import { BaseNabApi, Capabilities, SearchResultItem } from './api'; import { BaseNabApi, Capabilities, SearchResultItem } from './api.js';
export const NabAddonConfigSchema = BaseDebridConfigSchema.extend({ export const NabAddonConfigSchema = BaseDebridConfigSchema.extend({
url: z.string(), url: z.string(),
+1 -1
View File
@@ -7,7 +7,7 @@ import {
formatZodError, formatZodError,
getTimeTakenSincePoint, getTimeTakenSincePoint,
createLogger, createLogger,
} from '../../../utils'; } from '../../../utils/index.js';
import { Parser } from 'xml2js'; import { Parser } from 'xml2js';
import { Logger } from 'winston'; import { Logger } from 'winston';
+21 -10
View File
@@ -1,18 +1,29 @@
import { Manifest, Meta, MetaPreview, Stream, Subtitle } from '../../db'; import {
import { AnimeDatabase, Env, ExtrasParser, createLogger } from '../../utils'; Manifest,
Meta,
MetaPreview,
Stream,
Subtitle,
} from '../../db/index.js';
import {
AnimeDatabase,
Env,
ExtrasParser,
createLogger,
} from '../../utils/index.js';
import { import {
GDriveAPI, GDriveAPI,
GoogleOAuth, GoogleOAuth,
GoogleOAuthError, GoogleOAuthError,
GoogleOAuthErrorCode, GoogleOAuthErrorCode,
} from './api'; } from './api.js';
import { GDriveFile, UserData } from './schemas'; import { GDriveFile, UserData } from './schemas.js';
import { IMDBMetadata } from '../../metadata/imdb'; import { IMDBMetadata } from '../../metadata/imdb.js';
import { TMDBMetadata } from '../../metadata/tmdb'; import { TMDBMetadata } from '../../metadata/tmdb.js';
import { formatBytes, formatDuration } from '../../formatters'; import { formatBytes, formatDuration } from '../../formatters/index.js';
import { IdParser, ParsedId } from '../../utils/id-parser'; import { IdParser, ParsedId } from '../../utils/id-parser.js';
import { IdType } from '../../utils/id-parser'; import { IdType } from '../../utils/id-parser.js';
import { getTraktAliases } from '../../metadata/trakt'; import { getTraktAliases } from '../../metadata/trakt.js';
const logger = createLogger('gdrive'); 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 { import {
GDriveFile, GDriveFile,
GDriveFileGetResponseSchema, GDriveFileGetResponseSchema,
GDriveFileQueryResponseSchema, GDriveFileQueryResponseSchema,
RefreshTokenResponse, RefreshTokenResponse,
RefreshTokenResponseSchema, RefreshTokenResponseSchema,
} from './schemas'; } from './schemas.js';
const accessTokenCache = Cache.getInstance<string, string>( const accessTokenCache = Cache.getInstance<string, string>(
'gdrive-access-token' 'gdrive-access-token'
+2 -2
View File
@@ -1,2 +1,2 @@
export * from './addon'; export * from './addon.js';
export * from './api'; export * from './api.js';
+5 -5
View File
@@ -1,5 +1,5 @@
export * from './gdrive'; export * from './gdrive/index.js';
export * from './torbox-search'; export * from './torbox-search/index.js';
export * from './torznab'; export * from './torznab/index.js';
export * from './newznab'; export * from './newznab/index.js';
export * from './prowlarr'; export * from './prowlarr/index.js';
+6 -6
View File
@@ -1,15 +1,15 @@
import { z } from 'zod'; import { z } from 'zod';
import { ParsedId } from '../../utils/id-parser'; import { ParsedId } from '../../utils/id-parser.js';
import { constants, createLogger } from '../../utils'; import { constants, createLogger } from '../../utils/index.js';
import { Torrent, NZB } from '../../debrid'; import { Torrent, NZB } from '../../debrid/index.js';
import { SearchMetadata } from '../base/debrid'; import { SearchMetadata } from '../base/debrid.js';
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import { BaseNabApi, SearchResultItem } from '../base/nab/api'; import { BaseNabApi, SearchResultItem } from '../base/nab/api.js';
import { import {
BaseNabAddon, BaseNabAddon,
NabAddonConfigSchema, NabAddonConfigSchema,
NabAddonConfig, NabAddonConfig,
} from '../base/nab/addon'; } from '../base/nab/addon.js';
const logger = createLogger('newznab'); 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 { z } from 'zod';
import { createLogger, Env, getTimeTakenSincePoint } from '../../utils'; import {
createLogger,
Env,
getTimeTakenSincePoint,
} from '../../utils/index.js';
import ProwlarrApi, { import ProwlarrApi, {
ProwlarrApiIndexer, ProwlarrApiIndexer,
ProwlarrApiSearchItem, ProwlarrApiSearchItem,
ProwlarrApiError, ProwlarrApiError,
} from './api'; } from './api.js';
import { ParsedId } from '../../utils/id-parser'; import { ParsedId } from '../../utils/id-parser.js';
import { SearchMetadata } from '../base/debrid'; import { SearchMetadata } from '../base/debrid.js';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid'; import { Torrent, NZB, UnprocessedTorrent } from '../../debrid/index.js';
import { import {
extractInfoHashFromMagnet, extractInfoHashFromMagnet,
extractTrackersFromMagnet, extractTrackersFromMagnet,
} from '../utils/debrid'; } from '../utils/debrid.js';
export const ProwlarrAddonConfigSchema = BaseDebridConfigSchema.extend({ export const ProwlarrAddonConfigSchema = BaseDebridConfigSchema.extend({
url: z.string(), url: z.string(),
+1 -1
View File
@@ -5,7 +5,7 @@ import {
Env, Env,
formatZodError, formatZodError,
makeRequest, makeRequest,
} from '../../utils'; } from '../../utils/index.js';
import z from 'zod'; import z from 'zod';
interface ResponseMeta { interface ResponseMeta {
+1 -1
View File
@@ -1 +1 @@
export * from './addon'; export * from './addon.js';
@@ -1,18 +1,21 @@
import { z } from 'zod'; import { z } from 'zod';
import { Manifest, Stream } from '../../db'; import { Manifest, Stream } from '../../db/index.js';
import { import {
AnimeDatabase, AnimeDatabase,
createLogger, createLogger,
formatZodError, formatZodError,
getTimeTakenSincePoint, getTimeTakenSincePoint,
} from '../../utils'; } from '../../utils/index.js';
import { TorBoxSearchAddonUserDataSchema } from './schemas'; import { TorBoxSearchAddonUserDataSchema } from './schemas.js';
import { TorboxApi } from '@torbox/torbox-api'; import { TorboxApi } from '@torbox/torbox-api';
import TorboxSearchApi from './search-api'; import TorboxSearchApi from './search-api.js';
import { IdParser } from '../../utils/id-parser'; import { IdParser } from '../../utils/id-parser.js';
import { TorrentSourceHandler, UsenetSourceHandler } from './source-handlers'; import {
import { TorBoxSearchAddonError } from './errors'; TorrentSourceHandler,
import { supportedIdTypes } from './search-api'; UsenetSourceHandler,
} from './source-handlers.js';
import { TorBoxSearchAddonError } from './errors.js';
import { supportedIdTypes } from './search-api.js';
const logger = createLogger('torbox-search'); const logger = createLogger('torbox-search');
@@ -1,2 +1,2 @@
export * from './addon'; export * from './addon.js';
export * from './errors'; export * from './errors.js';
@@ -1,5 +1,5 @@
import { z } from 'zod'; import { z } from 'zod';
import { BuiltinDebridServices } from '../../debrid/utils'; import { BuiltinDebridServices } from '../../debrid/utils.js';
const TorBoxApiErrorResponseSchema = z.object({ const TorBoxApiErrorResponseSchema = z.object({
success: z.literal(false), success: z.literal(false),
@@ -1,14 +1,17 @@
import { fetch, RequestInit, Response } from 'undici'; import { fetch, RequestInit, Response } from 'undici';
import { z } from 'zod'; import { z } from 'zod';
import { TorBoxApiResponseSchema, TorBoxSearchApiDataSchema } from './schemas'; import {
TorBoxApiResponseSchema,
TorBoxSearchApiDataSchema,
} from './schemas.js';
import { import {
createLogger, createLogger,
DistributedLock, DistributedLock,
Env, Env,
formatZodError, formatZodError,
maskSensitiveInfo, maskSensitiveInfo,
} from '../../utils'; } from '../../utils/index.js';
import { IdType } from '../../utils/id-parser'; import { IdType } from '../../utils/id-parser.js';
type TorboxSuccessResponse<T> = { type TorboxSuccessResponse<T> = {
success: true; success: true;
@@ -1,5 +1,5 @@
import { number, z } from 'zod'; import { number, z } from 'zod';
import { Stream } from '../../db'; import { Stream } from '../../db/index.js';
import { import {
AnimeDatabase, AnimeDatabase,
Cache, Cache,
@@ -7,25 +7,25 @@ import {
SERVICE_DETAILS, SERVICE_DETAILS,
createLogger, createLogger,
getTimeTakenSincePoint, getTimeTakenSincePoint,
} from '../../utils'; } from '../../utils/index.js';
// import { DebridService, DebridFile } from './debrid-service'; // import { DebridService, DebridFile } from './debrid-service';
import { ParsedId } from '../../utils/id-parser'; import { ParsedId } from '../../utils/id-parser.js';
import { TorBoxSearchAddonUserDataSchema } from './schemas'; import { TorBoxSearchAddonUserDataSchema } from './schemas.js';
import TorboxSearchApi, { import TorboxSearchApi, {
TorboxSearchApiError, TorboxSearchApiError,
TorboxSearchApiIdType, TorboxSearchApiIdType,
} from './search-api'; } from './search-api.js';
import { Torrent, convertDataToTorrents } from './torrent'; import { Torrent, convertDataToTorrents } from './torrent.js';
import { TMDBMetadata } from '../../metadata/tmdb'; import { TMDBMetadata } from '../../metadata/tmdb.js';
import { calculateAbsoluteEpisode } from '../utils/general'; import { calculateAbsoluteEpisode } from '../utils/general.js';
import { TorboxApi } from '@torbox/torbox-api'; import { TorboxApi } from '@torbox/torbox-api';
import { processNZBs, processTorrents } from '../utils/debrid'; import { processNZBs, processTorrents } from '../utils/debrid.js';
import { import {
NZBWithSelectedFile, NZBWithSelectedFile,
TorrentWithSelectedFile, TorrentWithSelectedFile,
} from '../../debrid/utils'; } from '../../debrid/utils.js';
import { DebridFile, PlaybackInfo } from '../../debrid'; import { DebridFile, PlaybackInfo } from '../../debrid/index.js';
import { getTraktAliases } from '../../metadata/trakt'; import { getTraktAliases } from '../../metadata/trakt.js';
const logger = createLogger('torbox-search'); const logger = createLogger('torbox-search');
@@ -1,9 +1,9 @@
import { z } from 'zod'; import { z } from 'zod';
import { TorBoxSearchApiDataSchema } from './schemas'; import { TorBoxSearchApiDataSchema } from './schemas.js';
import { import {
extractInfoHashFromMagnet, extractInfoHashFromMagnet,
extractTrackersFromMagnet, extractTrackersFromMagnet,
} from '../utils/debrid'; } from '../utils/debrid.js';
export interface Torrent { export interface Torrent {
hash: string; hash: string;
+6 -6
View File
@@ -1,15 +1,15 @@
import { z } from 'zod'; import { z } from 'zod';
import { ParsedId } from '../../utils/id-parser'; import { ParsedId } from '../../utils/id-parser.js';
import { createLogger } from '../../utils'; import { createLogger } from '../../utils/index.js';
import { Torrent, NZB, UnprocessedTorrent } from '../../debrid'; import { Torrent, NZB, UnprocessedTorrent } from '../../debrid/index.js';
import { SearchMetadata } from '../base/debrid'; import { SearchMetadata } from '../base/debrid';
import { extractTrackersFromMagnet } from '../utils/debrid'; import { extractTrackersFromMagnet } from '../utils/debrid.js';
import { BaseNabApi, Capabilities } from '../base/nab/api'; import { BaseNabApi, Capabilities } from '../base/nab/api.js';
import { import {
BaseNabAddon, BaseNabAddon,
NabAddonConfigSchema, NabAddonConfigSchema,
NabAddonConfig, NabAddonConfig,
} from '../base/nab/addon'; } from '../base/nab/addon.js';
const logger = createLogger('torznab'); 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 { import {
BuiltinServiceId, BuiltinServiceId,
constants,
createLogger, createLogger,
getTimeTakenSincePoint, getTimeTakenSincePoint,
} from '../../utils'; } from '../../utils/index.js';
import { import {
BuiltinDebridServices, BuiltinDebridServices,
DebridDownload,
DebridError,
DebridFile, DebridFile,
getDebridService, getDebridService,
selectFileInTorrentOrNZB, selectFileInTorrentOrNZB,
@@ -20,8 +14,8 @@ import {
NZB, NZB,
isSeasonWrong, isSeasonWrong,
isEpisodeWrong, isEpisodeWrong,
} from '../../debrid'; } from '../../debrid/index.js';
import { PTT } from '../../parser'; import { PTT } from '../../parser/index.js';
import { ParseResult } from 'go-ptt'; import { ParseResult } from 'go-ptt';
// we have a list of torrents which need to be // 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 { Pool, Client, QueryResult } from 'pg';
import sqlite3 from 'sqlite3'; import sqlite3 from 'sqlite3';
import { open, Database } from 'sqlite'; import { open, Database } from 'sqlite';
import { URL } from 'url'; import { URL } from 'url';
import path from 'path'; import path from 'path';
import fs from 'fs'; 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>; type QueryResultRow = Record<string, any>;
+4 -4
View File
@@ -1,4 +1,4 @@
export * from './db'; export * from './db.js';
export * from './users'; export * from './users.js';
export * from './schemas'; export * from './schemas.js';
export * from './queue'; export * from './queue.js';
+2 -2
View File
@@ -1,5 +1,5 @@
import { createLogger } from '../utils'; import { createLogger } from '../utils/index.js';
import { DB } from './db'; import { DB } from './db.js';
const logger = createLogger('db'); const logger = createLogger('db');
const db = DB.getInstance(); const db = DB.getInstance();
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from 'zod'; import { z } from 'zod';
import * as constants from '../utils/constants'; import * as constants from '../utils/constants.js';
const ServiceIds = z.enum(constants.SERVICES); const ServiceIds = z.enum(constants.SERVICES);
+4 -7
View File
@@ -1,22 +1,19 @@
// import { UserDataSchema, UserData, DB } from '../db'; import { UserData } from './schemas.js';
import { UserDataSchema, UserData } from './schemas'; import { TransactionQueue } from './queue.js';
import { TransactionQueue } from './queue'; import { DB } from './db.js';
import { DB } from './db';
import { import {
decryptString, decryptString,
deriveKey, deriveKey,
encryptString, encryptString,
generateUUID, generateUUID,
getTextHash, getTextHash,
maskSensitiveInfo,
createLogger, createLogger,
constants, constants,
Env, Env,
verifyHash, verifyHash,
validateConfig, validateConfig,
formatZodError,
applyMigrations, applyMigrations,
} from '../utils'; } from '../utils/index.js';
const APIError = constants.APIError; const APIError = constants.APIError;
const logger = createLogger('users'); const logger = createLogger('users');
+1 -1
View File
@@ -1,5 +1,5 @@
import { URL } from 'url'; import { URL } from 'url';
import { createLogger } from '../utils/logger'; import { createLogger } from '../utils/logger.js';
import path from 'path'; import path from 'path';
type BaseConnectionURI = { type BaseConnectionURI = {
+1 -5
View File
@@ -1,9 +1,5 @@
import { z } from 'zod'; import { z } from 'zod';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
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;
type DebridErrorCode = type DebridErrorCode =
| 'BAD_GATEWAY' | 'BAD_GATEWAY'
+9 -9
View File
@@ -1,13 +1,13 @@
export * from './base'; export * from './base.js';
export * from './utils'; export * from './utils.js';
export * from './stremthru'; export * from './stremthru.js';
export * from './torbox'; export * from './torbox.js';
import { ServiceId } from '../utils'; import { ServiceId } from '../utils/index.js';
import { DebridService, DebridServiceConfig } from './base'; import { DebridService, DebridServiceConfig } from './base.js';
import { StremThruInterface } from './stremthru'; import { StremThruInterface } from './stremthru.js';
import { TorboxDebridService } from './torbox'; import { TorboxDebridService } from './torbox.js';
import { StremThruPreset } from '../presets/stremthru'; import { StremThruPreset } from '../presets/stremthru.js';
export function getDebridService( export function getDebridService(
serviceName: ServiceId, serviceName: ServiceId,
+11 -6
View File
@@ -1,16 +1,21 @@
import { StremThru, StremThruError } from 'stremthru'; import { StremThru, StremThruError } from 'stremthru';
import { Env, ServiceId, createLogger, getSimpleTextHash } from '../utils'; import {
import { selectFileInTorrentOrNZB, Torrent } from './utils'; Env,
ServiceId,
createLogger,
getSimpleTextHash,
Cache,
} from '../utils/index.js';
import { selectFileInTorrentOrNZB, Torrent } from './utils.js';
import { import {
DebridService, DebridService,
DebridServiceConfig, DebridServiceConfig,
DebridDownload, DebridDownload,
PlaybackInfo, PlaybackInfo,
DebridError, DebridError,
} from './base'; } from './base.js';
import { Cache } from '../utils'; import { StremThruServiceId } from '../presets/stremthru.js';
import { StremThruServiceId } from '../presets/stremthru'; import { PTT } from '../parser/index.js';
import { PTT } from '../parser';
import { ParseResult } from 'go-ptt'; import { ParseResult } from 'go-ptt';
const logger = createLogger('debrid:stremthru'); const logger = createLogger('debrid:stremthru');
+13 -8
View File
@@ -1,18 +1,23 @@
import { TorboxApi } from '@torbox/torbox-api'; import { TorboxApi } from '@torbox/torbox-api';
import { Env, ServiceId, createLogger, getSimpleTextHash } from '../utils'; import { StremThruError } from 'stremthru';
import { PTT } from '../parser'; import { ParseResult } from 'go-ptt';
import { selectFileInTorrentOrNZB } from './utils'; import {
Env,
ServiceId,
createLogger,
getSimpleTextHash,
Cache,
} from '../utils/index.js';
import { PTT } from '../parser/index.js';
import { selectFileInTorrentOrNZB } from './utils.js';
import { import {
DebridService, DebridService,
DebridServiceConfig, DebridServiceConfig,
DebridDownload, DebridDownload,
PlaybackInfo, PlaybackInfo,
DebridError, DebridError,
} from './base'; } from './base.js';
import { Cache } from '../utils'; import { StremThruInterface } from './stremthru.js';
import { StremThruInterface } from './stremthru';
import { StremThruError } from 'stremthru';
import { ParseResult } from 'go-ptt';
const logger = createLogger('debrid:torbox'); const logger = createLogger('debrid:torbox');
+3 -6
View File
@@ -1,10 +1,7 @@
import { z } from 'zod'; import { z } from 'zod';
import { constants, createLogger } from '../utils'; import { constants, createLogger, BuiltinServiceId } from '../utils/index.js';
import { DebridFile, DebridDownload } from './base.js';
import { BuiltinServiceId } from '../utils'; import { normaliseTitle, titleMatch } from '../parser/utils.js';
import { DebridFile, DebridDownload } from './base';
import { PTT } from '../parser';
import { normaliseTitle, titleMatch } from '../parser/utils';
const logger = createLogger('debrid'); const logger = createLogger('debrid');
+18 -19
View File
@@ -1,15 +1,14 @@
import { ParsedStream, UserData } from '../db'; import { ParsedStream, UserData } from '../db/schemas.js';
// import { constants, Env, createLogger } from '../utils'; import * as constants from '../utils/constants.js';
import * as constants from '../utils/constants'; import { createLogger } from '../utils/logger.js';
import { createLogger } from '../utils/logger';
import { import {
formatBytes, formatBytes,
formatDuration, formatDuration,
languageToCode, languageToCode,
languageToEmoji, languageToEmoji,
makeSmall, makeSmall,
} from './utils'; } from './utils.js';
import { Env } from '../utils/env'; import { Env } from '../utils/env.js';
const logger = createLogger('formatter'); const logger = createLogger('formatter');
@@ -112,10 +111,10 @@ const stringModifiers = {
'upper': (value: string) => value.toUpperCase(), 'upper': (value: string) => value.toUpperCase(),
'lower': (value: string) => value.toLowerCase(), 'lower': (value: string) => value.toLowerCase(),
'title': (value: string) => value 'title': (value: string) => value
.split(' ') .split(' ')
.map((word) => word.toLowerCase()) .map((word) => word.toLowerCase())
.map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' '), .join(' '),
'length': (value: string) => value.length.toString(), 'length': (value: string) => value.length.toString(),
'reverse': (value: string) => value.split('').reverse().join(''), 'reverse': (value: string) => value.split('').reverse().join(''),
'base64': (value: string) => btoa(value), 'base64': (value: string) => btoa(value),
@@ -414,7 +413,7 @@ export abstract class BaseFormatter {
const variable = `(?<variableName>${validVariables.join('|')})\\.(?<propertyName>${validProperties.join('|')})`; const variable = `(?<variableName>${validVariables.join('|')})\\.(?<propertyName>${validProperties.join('|')})`;
const singleValidModifier = this.buildModifierRegexPattern(); const singleValidModifier = this.buildModifierRegexPattern();
// Build the conditional check pattern separately // Build the conditional check pattern separately
// Use [^"]* to capture anything except quotes, making it non-greedy // Use [^"]* to capture anything except quotes, making it non-greedy
const checkTrue = `"(?<mod_check_true>[^"]*)"`; const checkTrue = `"(?<mod_check_true>[^"]*)"`;
@@ -425,7 +424,7 @@ export abstract class BaseFormatter {
const modTZLocale = `::(?<mod_tzlocale>[A-Za-z]{2,3}(?:-[A-Z]{2})?|[A-Za-z]+?/[A-Za-z_]+?)`; const modTZLocale = `::(?<mod_tzlocale>[A-Za-z]{2,3}(?:-[A-Z]{2})?|[A-Za-z]+?/[A-Za-z_]+?)`;
const regexPattern = `\\{${variable}(?<modifiers>(${singleValidModifier})+)?(${modTZLocale})?(${checkTF})?\\}`; const regexPattern = `\\{${variable}(?<modifiers>(${singleValidModifier})+)?(${modTZLocale})?(${checkTF})?\\}`;
return new RegExp(regexPattern, 'gi') return new RegExp(regexPattern, 'gi')
} }
@@ -517,7 +516,7 @@ export abstract class BaseFormatter {
): string | undefined { ): string | undefined {
const singleModTerminator = '((::)|($))'; // :: if there's multiple modifiers or $ for the end of the string const singleModTerminator = '((::)|($))'; // :: if there's multiple modifiers or $ for the end of the string
const singleValidModRe = new RegExp(this.buildModifierRegexPattern() + singleModTerminator, 'gi'); const singleValidModRe = new RegExp(this.buildModifierRegexPattern() + singleModTerminator, 'gi');
let result = input as any; let result = input as any;
// iterate over modifiers in order of appearance // iterate over modifiers in order of appearance
for (const modMatch of [...groups.modifiers.matchAll(singleValidModRe)].sort((a, b) => (a.index ?? 0) - (b.index ?? 0))) { for (const modMatch of [...groups.modifiers.matchAll(singleValidModRe)].sort((a, b) => (a.index ?? 0) - (b.index ?? 0))) {
@@ -537,7 +536,7 @@ export abstract class BaseFormatter {
let check_false = groups.mod_check_false ?? ""; let check_false = groups.mod_check_false ?? "";
if (typeof check_true !== 'string' || typeof check_false !== 'string') if (typeof check_true !== 'string' || typeof check_false !== 'string')
return `{unknown_conditional_modifier_check_true_or_false}`; return `{unknown_conditional_modifier_check_true_or_false}`;
if (parseValue) { if (parseValue) {
check_true = this.parseString(check_true, parseValue) || check_true; check_true = this.parseString(check_true, parseValue) || check_true;
check_false = this.parseString(check_false, parseValue) || check_false; check_false = this.parseString(check_false, parseValue) || check_false;
@@ -568,29 +567,29 @@ export abstract class BaseFormatter {
if (!conditionalModifiers.exact.exists(input)) { if (!conditionalModifiers.exact.exists(input)) {
conditional = false; conditional = false;
} }
// EXACT // EXACT
else if (isExact) { else if (isExact) {
const modAsKey = mod as keyof typeof conditionalModifiers.exact; const modAsKey = mod as keyof typeof conditionalModifiers.exact;
conditional = conditionalModifiers.exact[modAsKey](input); conditional = conditionalModifiers.exact[modAsKey](input);
} }
// PREFIX // PREFIX
else if (isPrefix) { else if (isPrefix) {
// get the longest prefix match // get the longest prefix match
const modPrefix = Object.keys(conditionalModifiers.prefix).sort((a, b) => b.length - a.length).find(key => mod.startsWith(key))!!; const modPrefix = Object.keys(conditionalModifiers.prefix).sort((a, b) => b.length - a.length).find(key => mod.startsWith(key))!!;
// Pre-process string value and check to allow for intuitive comparisons // Pre-process string value and check to allow for intuitive comparisons
const stringValue = input.toString().toLowerCase(); const stringValue = input.toString().toLowerCase();
let stringCheck = mod.substring(modPrefix.length).toLowerCase(); let stringCheck = mod.substring(modPrefix.length).toLowerCase();
// remove whitespace from stringCheck if it isn't in stringValue // remove whitespace from stringCheck if it isn't in stringValue
stringCheck = !/\s/.test(stringValue) ? stringCheck.replace(/\s/g, '') : stringCheck; stringCheck = !/\s/.test(stringValue) ? stringCheck.replace(/\s/g, '') : stringCheck;
// parse value/check as if they're numbers (123,456 -> 123456) // parse value/check as if they're numbers (123,456 -> 123456)
const [parsedNumericValue, parsedNumericCheck] = [Number(stringValue.replace(/,\s/g, '')), Number(stringCheck.replace(/,\s/g, ''))]; const [parsedNumericValue, parsedNumericCheck] = [Number(stringValue.replace(/,\s/g, '')), Number(stringCheck.replace(/,\s/g, ''))];
const isNumericComparison = ["<", "<=", ">", ">=", "="].includes(modPrefix) && const isNumericComparison = ["<", "<=", ">", ">=", "="].includes(modPrefix) &&
!isNaN(parsedNumericValue) && !isNaN(parsedNumericCheck); !isNaN(parsedNumericValue) && !isNaN(parsedNumericCheck);
conditional = conditionalModifiers.prefix[modPrefix as keyof typeof conditionalModifiers.prefix]( conditional = conditionalModifiers.prefix[modPrefix as keyof typeof conditionalModifiers.prefix](
isNumericComparison ? parsedNumericValue as any : stringValue, isNumericComparison ? parsedNumericValue as any : stringValue,
isNumericComparison ? parsedNumericCheck as any : stringCheck, isNumericComparison ? parsedNumericCheck as any : stringCheck,
+2 -2
View File
@@ -1,5 +1,5 @@
import { UserData } from '../db'; import { UserData } from '../db/schemas.js';
import { BaseFormatter, FormatterConfig } from './base'; import { BaseFormatter, FormatterConfig } from './base.js';
export class CustomFormatter extends BaseFormatter { export class CustomFormatter extends BaseFormatter {
constructor( constructor(
+8 -8
View File
@@ -1,18 +1,18 @@
export * from './base'; export * from './base.js';
export * from './predefined'; export * from './predefined.js';
export * from './custom'; export * from './custom.js';
export * from './utils'; export * from './utils.js';
import { BaseFormatter, FormatterConfig } from './base'; import { BaseFormatter, FormatterConfig } from './base.js';
import { import {
TorrentioFormatter, TorrentioFormatter,
TorboxFormatter, TorboxFormatter,
GDriveFormatter, GDriveFormatter,
LightGDriveFormatter, LightGDriveFormatter,
MinimalisticGdriveFormatter, MinimalisticGdriveFormatter,
} from './predefined'; } from './predefined.js';
import { CustomFormatter } from './custom'; import { CustomFormatter } from './custom.js';
import { UserData } from '../db'; import { UserData } from '../db/schemas.js';
export function createFormatter(userData: UserData): BaseFormatter { export function createFormatter(userData: UserData): BaseFormatter {
switch (userData.formatter.id) { switch (userData.formatter.id) {
+3 -3
View File
@@ -1,5 +1,5 @@
import { UserData } from '../db'; import { UserData } from '../db/schemas.js';
import { BaseFormatter } from './base'; import { BaseFormatter } from './base.js';
export class TorrentioFormatter extends BaseFormatter { export class TorrentioFormatter extends BaseFormatter {
constructor(userData: UserData) { constructor(userData: UserData) {
@@ -95,4 +95,4 @@ export class MinimalisticGdriveFormatter extends BaseFormatter {
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 { export function formatBytes(bytes: number, k: 1024 | 1000): string {
if (bytes === 0) return '0 B'; if (bytes === 0) return '0 B';
+9 -9
View File
@@ -1,10 +1,10 @@
export * from './utils'; export * from './utils/index.js';
export * from './db'; export * from './db/index.js';
export * from './main'; export * from './main.js';
export * from './parser'; export * from './parser/index.js';
export * from './formatters'; export * from './formatters/index.js';
export * from './transformers'; export * from './transformers/index.js';
export * from './debrid'; export * from './debrid/index.js';
export { export {
TorBoxSearchAddon, TorBoxSearchAddon,
GDriveAddon, GDriveAddon,
@@ -14,5 +14,5 @@ export {
TorznabAddon, TorznabAddon,
NewznabAddon, NewznabAddon,
ProwlarrAddon, ProwlarrAddon,
} from './builtins'; } from './builtins/index.js';
export { PresetManager } from './presets'; export { PresetManager } from './presets/index.js';
+14 -14
View File
@@ -4,7 +4,7 @@ import {
Resource, Resource,
StrictManifestResource, StrictManifestResource,
UserData, UserData,
} from './db'; } from './db/index.js';
import { import {
constants, constants,
createLogger, createLogger,
@@ -16,9 +16,9 @@ import {
ExtrasParser, ExtrasParser,
makeUrlLogSafe, makeUrlLogSafe,
AnimeDatabase, AnimeDatabase,
} from './utils'; } from './utils/index.js';
import { Wrapper } from './wrapper'; import { Wrapper } from './wrapper.js';
import { PresetManager } from './presets'; import { PresetManager } from './presets/index.js';
import { import {
AddonCatalog, AddonCatalog,
Meta, Meta,
@@ -27,12 +27,12 @@ import {
ParsedStream, ParsedStream,
Preset, Preset,
Subtitle, Subtitle,
} from './db/schemas'; } from './db/schemas.js';
import { createProxy } from './proxy'; import { createProxy } from './proxy/index.js';
import { RPDB } from './utils/rpdb'; import { RPDB } from './utils/rpdb.js';
import { FeatureControl } from './utils/feature'; import { FeatureControl } from './utils/feature.js';
import Proxifier from './streams/proxifier'; import Proxifier from './streams/proxifier.js';
import StreamLimiter from './streams/limiter'; import StreamLimiter from './streams/limiter.js';
import { import {
StreamFetcher as Fetcher, StreamFetcher as Fetcher,
StreamFilterer as Filterer, StreamFilterer as Filterer,
@@ -40,10 +40,10 @@ import {
StreamDeduplicator as Deduplicator, StreamDeduplicator as Deduplicator,
StreamPrecomputer as Precomputer, StreamPrecomputer as Precomputer,
StreamUtils, StreamUtils,
} from './streams'; } from './streams/index.js';
import { getAddonName } from './utils/general'; import { getAddonName } from './utils/general.js';
import { TMDBMetadata } from './metadata/tmdb'; import { TMDBMetadata } from './metadata/tmdb.js';
import { Metadata } from './metadata/utils'; import { Metadata } from './metadata/utils.js';
const logger = createLogger('core'); const logger = createLogger('core');
const shuffleCache = Cache.getInstance<string, MetaPreview[]>('shuffle'); const shuffleCache = Cache.getInstance<string, MetaPreview[]>('shuffle');
+3 -4
View File
@@ -1,8 +1,7 @@
import { z } from 'zod'; import { z } from 'zod';
import { Cache, makeRequest, Env, TYPES } from '../utils'; import { Cache, makeRequest, Env, TYPES } from '../utils/index.js';
import { Wrapper } from '../wrapper'; import { Metadata } from './utils.js';
import { Metadata } from './utils'; import { Meta, MetaSchema } from '../db/schemas.js';
import { Meta, MetaSchema } from '../db';
const IMDBSuggestionSchema = z.object({ const IMDBSuggestionSchema = z.object({
d: z.array( d: z.array(
+9 -9
View File
@@ -1,12 +1,12 @@
import { DistributedLock } from '../utils/distributed-lock'; import { DistributedLock } from '../utils/distributed-lock.js';
import { Metadata } from './utils'; import { Metadata } from './utils.js';
import { TMDBMetadata } from './tmdb'; import { TMDBMetadata } from './tmdb.js';
import { getTraktAliases } from './trakt'; import { getTraktAliases } from './trakt.js';
import { IMDBMetadata } from './imdb'; import { IMDBMetadata } from './imdb.js';
import { createLogger, getTimeTakenSincePoint } from '../utils/logger'; import { createLogger, getTimeTakenSincePoint } from '../utils/logger.js';
import { TYPES } from '../utils/constants'; import { TYPES } from '../utils/constants.js';
import { AnimeDatabase, ParsedId } from '../utils'; import { AnimeDatabase, ParsedId } from '../utils/index.js';
import { Meta } from '../db/schemas'; import { Meta } from '../db/schemas.js';
const logger = createLogger('metadata-service'); const logger = createLogger('metadata-service');
+2 -2
View File
@@ -1,6 +1,6 @@
import { Headers } from 'undici'; import { Headers } from 'undici';
import { Env, Cache, TYPES, makeRequest } from '../utils'; import { Env, Cache, TYPES, makeRequest } from '../utils/index.js';
import { Metadata } from './utils'; import { Metadata } from './utils.js';
import { z } from 'zod'; import { z } from 'zod';
export type ExternalIdType = 'imdb' | 'tmdb' | 'tvdb'; export type ExternalIdType = 'imdb' | 'tmdb' | 'tvdb';
+1 -1
View File
@@ -7,7 +7,7 @@ import {
ParsedId, ParsedId,
formatZodError, formatZodError,
Env, Env,
} from '../utils'; } from '../utils/index.js';
const traktAliasCache = Cache.getInstance<string, string[]>('trakt-aliases'); const traktAliasCache = Cache.getInstance<string, string[]>('trakt-aliases');
const TRAKT_ALIAS_CACHE_TTL = 7 * 24 * 60 * 60; // 7 days 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 { PARSE_REGEX } from './regex.js';
import { ParsedFile } from '../db/schemas'; import { ParsedFile } from '../db/schemas.js';
import ptt from './ptt'; import ptt from './ptt.js';
function matchPattern( function matchPattern(
filename: string, filename: string,
+1 -1
View File
@@ -6,7 +6,7 @@ import {
Env, Env,
getSimpleTextHash, getSimpleTextHash,
getTimeTakenSincePoint, getTimeTakenSincePoint,
} from '../utils'; } from '../utils/index.js';
const logger = createLogger('parser'); const logger = createLogger('parser');
+3 -3
View File
@@ -1,3 +1,3 @@
export { default as FileParser } from './file'; export { default as FileParser } from './file.js';
export { default as StreamParser } from './streams'; export { default as StreamParser } from './streams.js';
export { default as PTT } from './go-ptt'; 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 { AUDIO_TAGS, QUALITIES, RESOLUTIONS } from '../utils/constants';
import { VISUAL_TAGS } from '../utils/constants'; // import { VISUAL_TAGS } from '../utils/constants';
import { ENCODES } from '../utils/constants'; // import { ENCODES } from '../utils/constants';
import { LANGUAGES } from '../utils/constants'; // import { LANGUAGES } from '../utils/constants';
import { AUDIO_CHANNELS } from '../utils/constants'; // import { AUDIO_CHANNELS } from '../utils/constants';
import { FakeVisualTag } from '../utils/constants'; // import { FakeVisualTag } from '../utils/constants';
import { constants } from '../utils/index.js';
const createRegex = (pattern: string): RegExp => const createRegex = (pattern: string): RegExp =>
new RegExp(`(?<![^\\s\\[(_\\-.,])(${pattern})(?=[\\s\\)\\]_.\\-,]|$)`, 'i'); new RegExp(`(?<![^\\s\\[(_\\-.,])(${pattern})(?=[\\s\\)\\]_.\\-,]|$)`, 'i');
@@ -11,19 +12,31 @@ const createLanguageRegex = (pattern: string): RegExp =>
createRegex(`${pattern}(?![ .\\-_]?sub(title)?s?)`); createRegex(`${pattern}(?![ .\\-_]?sub(title)?s?)`);
type PARSE_REGEX = { type PARSE_REGEX = {
resolutions: Omit<Record<(typeof RESOLUTIONS)[number], RegExp>, 'Unknown'>; resolutions: Omit<
qualities: Omit<Record<(typeof QUALITIES)[number], RegExp>, 'Unknown'>; Record<(typeof constants.RESOLUTIONS)[number], RegExp>,
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>,
'Unknown' 'Unknown'
>; >;
languages: Omit<Record<(typeof LANGUAGES)[number], RegExp>, 'Unknown'>; qualities: Omit<
encodes: Omit<Record<(typeof ENCODES)[number], RegExp>, 'Unknown'>; 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; releaseGroup: RegExp;
}; };
+5 -1
View File
@@ -1,5 +1,9 @@
import { Parser } from 'expr-eval'; import { Parser } from 'expr-eval';
import { ParsedStream, ParsedStreams, ParsedStreamSchema } from '../db'; import {
ParsedStream,
ParsedStreams,
ParsedStreamSchema,
} from '../db/schemas.js';
import bytes from 'bytes'; import bytes from 'bytes';
export abstract class StreamExpressionEngine { export abstract class StreamExpressionEngine {
+8 -3
View File
@@ -1,6 +1,11 @@
import { Stream, ParsedStream, Addon, ParsedFile } from '../db'; import { Stream, ParsedStream, Addon, ParsedFile } from '../db/index.js';
import { constants, createLogger, Env, FULL_LANGUAGE_MAPPING } from '../utils'; import {
import FileParser from './file'; constants,
createLogger,
Env,
FULL_LANGUAGE_MAPPING,
} from '../utils/index.js';
import FileParser from './file.js';
const logger = createLogger('parser'); const logger = createLogger('parser');
class StreamParser { class StreamParser {
+1 -1
View File
@@ -1,5 +1,5 @@
import { extract, FuzzballExtractOptions } from 'fuzzball'; import { extract, FuzzballExtractOptions } from 'fuzzball';
import { createLogger } from '../utils'; import { createLogger } from '../utils/index.js';
const logger = createLogger('parser'); const logger = createLogger('parser');
+9 -4
View File
@@ -5,10 +5,15 @@ import {
ParsedFile, ParsedFile,
Stream, Stream,
UserData, UserData,
} from '../db'; } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env, HTTP_STREAM_TYPE, LIVE_STREAM_TYPE } from '../utils'; import {
import { FileParser, StreamParser } from '../parser'; constants,
Env,
HTTP_STREAM_TYPE,
LIVE_STREAM_TYPE,
} from '../utils/index.js';
import { FileParser, StreamParser } from '../parser/index.js';
class AStreamStreamParser extends StreamParser { class AStreamStreamParser extends StreamParser {
protected override getParsedFile( protected override getParsedFile(
+5 -3
View File
@@ -1,5 +1,5 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { import {
Cache, Cache,
constants, constants,
@@ -7,7 +7,7 @@ import {
formatZodError, formatZodError,
getSimpleTextHash, getSimpleTextHash,
makeRequest, makeRequest,
} from '../utils'; } from '../utils/index.js';
import { z } from 'zod'; import { z } from 'zod';
import { FormData } from 'undici'; 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 { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Cache, constants, Env, makeRequest } from '../utils'; import { Cache, constants, Env, makeRequest } from '../utils/index.js';
import { z } from 'zod'; import { z } from 'zod';
const configCache = Cache.getInstance<string, string>('ai-search-config'); 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, ParsedStream,
Stream, Stream,
AIOStream, AIOStream,
} from '../db'; } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env, formatZodError, RESOURCES } from '../utils'; import { constants, Env, formatZodError, RESOURCES } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { createLogger } from '../utils'; import { createLogger } from '../utils/index.js';
const logger = createLogger('parser'); 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 { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils'; import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class AIOSubtitlePreset extends Preset { export class AIOSubtitlePreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -436,3 +436,5 @@ export class AIOSubtitlePreset extends Preset {
return `${host}/stremio/${configString}/manifest.json`; return `${host}/stremio/${configString}/manifest.json`;
} }
} }
+4 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class AnimeCatalogsPreset extends Preset { export class AnimeCatalogsPreset extends Preset {
private static malCatalogs = [ private static malCatalogs = [
@@ -319,3 +319,4 @@ export class AnimeCatalogsPreset extends Preset {
return cacheKey; return cacheKey;
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class AnimeKitsuPreset extends Preset { export class AnimeKitsuPreset extends Preset {
static override get METADATA() { 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 { Option, UserData } from '../db/index.js';
import { Env, constants } from '../utils'; import { Env, constants } from '../utils/index.js';
import { baseOptions } from './preset'; import { baseOptions } from './preset.js';
import { StremThruPreset } from './stremthru'; import { StremThruPreset } from './stremthru.js';
import { TorznabPreset } from './torznab'; import { TorznabPreset } from './torznab.js';
export class AnimeToshoPreset extends TorznabPreset { export class AnimeToshoPreset extends TorznabPreset {
static override get METADATA() { static override get METADATA() {
@@ -68,3 +68,5 @@ export class AnimeToshoPreset extends TorznabPreset {
return `${Env.INTERNAL_URL}/builtins/torznab/${configString}/manifest.json`; return `${Env.INTERNAL_URL}/builtins/torznab/${configString}/manifest.json`;
} }
} }
+6 -4
View File
@@ -5,10 +5,10 @@ import {
ParsedStream, ParsedStream,
Stream, Stream,
UserData, UserData,
} from '../db'; } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env, LIVE_STREAM_TYPE } from '../utils'; import { constants, Env, LIVE_STREAM_TYPE } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser'; import { FileParser, StreamParser } from '../parser/index.js';
class ArgentinaTvStreamParser extends StreamParser { class ArgentinaTvStreamParser extends StreamParser {
protected override getParsedFile( 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 { ParsedStream, Stream, UserData } from '../db/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { ServiceId } from '../utils/constants'; import { ServiceId } from '../utils/constants.js';
import { Preset } from './preset'; import { Preset } from './preset.js';
import { stremthruSpecialCases } from './stremthru'; import { stremthruSpecialCases } from './stremthru.js';
export class BuiltinStreamParser extends StreamParser { export class BuiltinStreamParser extends StreamParser {
override getFolder(stream: Stream): string | undefined { 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 { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils'; import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { StremThruPreset } from './stremthru'; import { StremThruPreset } from './stremthru.js';
class CometStreamParser extends StreamParser { class CometStreamParser extends StreamParser {
get errorRegexes(): { pattern: RegExp; message: string }[] | undefined { get errorRegexes(): { pattern: RegExp; message: string }[] | undefined {
@@ -224,3 +224,5 @@ export class CometPreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
+6 -4
View File
@@ -1,7 +1,7 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db'; import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
class ContentDeepDiveStreamParser extends StreamParser { class ContentDeepDiveStreamParser extends StreamParser {
protected getFilename( protected getFilename(
@@ -112,3 +112,5 @@ export class ContentDeepDivePreset extends Preset {
return `${url}/manifest.json`; return `${url}/manifest.json`;
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES } from '../utils'; import { Env, RESOURCES } from '../utils/index.js';
export class CustomPreset extends Preset { export class CustomPreset extends Preset {
static override get METADATA() { 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 { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class DcUniversePreset extends Preset { export class DcUniversePreset extends Preset {
// dc-batman-animations%2C // dc-batman-animations%2C
@@ -157,3 +157,5 @@ export class DcUniversePreset extends Preset {
return cacheKey; return cacheKey;
} }
} }
+3 -1
View File
@@ -1,4 +1,4 @@
import { Option } from '../db'; import { Option } from '../db/index.js';
export const debridioSocialOption: Option = { export const debridioSocialOption: Option = {
id: 'socials', id: 'socials',
@@ -17,3 +17,5 @@ export const debridioApiKeyOption: Option = {
}; };
export const debridioLogo = 'https://cdn.lb.debridio.com/site/logo.png'; 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 { Addon, Option, UserData, Resource, Stream } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils'; import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { import {
debridioSocialOption, debridioSocialOption,
debridioLogo, debridioLogo,
debridioApiKeyOption, debridioApiKeyOption,
} from './debridio'; } from './debridio.js';
export class DebridioPreset extends Preset { export class DebridioPreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -151,3 +151,5 @@ export class DebridioPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
+4 -4
View File
@@ -1,11 +1,11 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { import {
debridioSocialOption, debridioSocialOption,
debridioApiKeyOption, debridioApiKeyOption,
debridioLogo, debridioLogo,
} from './debridio'; } from './debridio.js';
export class DebridioTmdbPreset extends Preset { export class DebridioTmdbPreset extends Preset {
static override get METADATA() { static override get METADATA() {
+5 -5
View File
@@ -5,15 +5,15 @@ import {
ParsedStream, ParsedStream,
Stream, Stream,
UserData, UserData,
} from '../db'; } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { import {
debridioSocialOption, debridioSocialOption,
debridioApiKeyOption, debridioApiKeyOption,
debridioLogo, debridioLogo,
} from './debridio'; } from './debridio.js';
import { FileParser, StreamParser } from '../parser'; import { FileParser, StreamParser } from '../parser/index.js';
class DebridioTvStreamParser extends StreamParser { class DebridioTvStreamParser extends StreamParser {
protected override getParsedFile( protected override getParsedFile(
+4 -4
View File
@@ -1,11 +1,11 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { import {
debridioSocialOption, debridioSocialOption,
debridioApiKeyOption, debridioApiKeyOption,
debridioLogo, debridioLogo,
} from './debridio'; } from './debridio.js';
export class DebridioTvdbPreset extends Preset { export class DebridioTvdbPreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -1,12 +1,12 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db'; import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser'; import { FileParser, StreamParser } from '../parser/index.js';
import { import {
debridioSocialOption, debridioSocialOption,
debridioApiKeyOption, debridioApiKeyOption,
debridioLogo, debridioLogo,
} from './debridio'; } from './debridio.js';
class DebridioWatchtowerStreamParser extends StreamParser { class DebridioWatchtowerStreamParser extends StreamParser {
override parse(stream: Stream): ParsedStream | { skip: true } { override parse(stream: Stream): ParsedStream | { skip: true } {
+6 -4
View File
@@ -5,10 +5,10 @@ import {
ParsedStream, ParsedStream,
Stream, Stream,
AIOStream, AIOStream,
} from '../db'; } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env, RESOURCES } from '../utils'; import { constants, Env, RESOURCES } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
class DMMCastStreamParser extends StreamParser { class DMMCastStreamParser extends StreamParser {
protected override getFilename( protected override getFilename(
@@ -153,3 +153,5 @@ export class DMMCastPreset extends Preset {
}; };
} }
} }
@@ -1,9 +1,9 @@
// stremio://new-who.onrender.com/manifest.json // stremio://new-who.onrender.com/manifest.json
import { Addon, Option, ParsedStream, Stream, UserData } from '../db'; import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
class DoctorWhoUniverseStreamParser extends StreamParser { class DoctorWhoUniverseStreamParser extends StreamParser {
protected override getMessage( 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 { baseOptions, Preset } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { import {
PresetMetadata, PresetMetadata,
Option, Option,
@@ -7,8 +7,8 @@ import {
UserData, UserData,
ParsedStream, ParsedStream,
Stream, Stream,
} from '../db'; } from '../db/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
export class EasynewsParser extends StreamParser { export class EasynewsParser extends StreamParser {
protected override getStreamType( protected override getStreamType(
@@ -115,3 +115,5 @@ export class EasynewsPreset extends Preset {
return `${url}/${this.generateConfig(easynewsCredentials, options)}/manifest.json`; return `${url}/${this.generateConfig(easynewsCredentials, options)}/manifest.json`;
} }
} }
+4 -4
View File
@@ -1,7 +1,7 @@
import { PresetMetadata } from '../db'; import { PresetMetadata } from '../db/index.js';
import { EasynewsPreset } from './easynews'; import { EasynewsPreset } from './easynews.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { baseOptions } from './preset'; import { baseOptions } from './preset.js';
export class EasynewsPlusPreset extends EasynewsPreset { export class EasynewsPlusPreset extends EasynewsPreset {
static override get METADATA(): PresetMetadata { static override get METADATA(): PresetMetadata {
@@ -1,8 +1,8 @@
import { ParsedStream, PresetMetadata, Stream } from '../db'; import { ParsedStream, PresetMetadata, Stream } from '../db/index.js';
import { EasynewsPreset, EasynewsParser } from './easynews'; import { EasynewsPreset, EasynewsParser } from './easynews.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { baseOptions } from './preset'; import { baseOptions } from './preset.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
class EasynewsPlusPlusParser extends EasynewsParser { class EasynewsPlusPlusParser extends EasynewsParser {
protected override get ageRegex(): RegExp { protected override get ageRegex(): RegExp {
+4 -4
View File
@@ -1,9 +1,9 @@
// stremio://new-who.onrender.com/manifest.json // stremio://new-who.onrender.com/manifest.json
import { Addon, Option, ParsedStream, Stream, UserData } from '../db'; import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { constants, Env, ServiceId } from '../utils'; import { constants, Env, ServiceId } from '../utils/index.js';
import { StremThruPreset } from './stremthru'; import { StremThruPreset } from './stremthru.js';
export class FKStreamPreset extends StremThruPreset { export class FKStreamPreset extends StremThruPreset {
static override get METADATA() { static override get METADATA() {
+6 -6
View File
@@ -1,5 +1,5 @@
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
import { import {
PresetMetadata, PresetMetadata,
Option, Option,
@@ -7,10 +7,10 @@ import {
UserData, UserData,
ParsedStream, ParsedStream,
Stream, Stream,
} from '../db'; } from '../db/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { GDriveAPI } from '../builtins/gdrive'; import { GDriveAPI } from '../builtins/gdrive/index.js';
import { GoogleOAuth } from '../builtins/gdrive/api'; import { GoogleOAuth } from '../builtins/gdrive/api.js';
export class GDriveParser extends StreamParser { export class GDriveParser extends StreamParser {
protected override raiseErrorIfNecessary( protected override raiseErrorIfNecessary(
+4 -2
View File
@@ -1,2 +1,4 @@
export * from './preset'; export * from './preset.js';
export * from './presetManager'; export * from './presetManager.js';
+8 -6
View File
@@ -1,9 +1,9 @@
import { Addon, Option, UserData, Resource } from '../db'; import { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils'; import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { StremThruPreset } from './stremthru'; import { StremThruPreset } from './stremthru.js';
class JackettioStreamParser extends StreamParser { class JackettioStreamParser extends StreamParser {
override applyUrlModifications(url: string | undefined): string | undefined { override applyUrlModifications(url: string | undefined): string | undefined {
@@ -195,3 +195,5 @@ export class JackettioPreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class MarvelPreset extends Preset { export class MarvelPreset extends Preset {
private static catalogs = [ private static catalogs = [
@@ -133,3 +133,5 @@ export class MarvelPreset extends Preset {
return cacheKey; return cacheKey;
} }
} }
+14 -5
View File
@@ -1,8 +1,15 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db'; import {
import { baseOptions, Preset } from './preset'; Addon,
import { createLogger, Env, getSimpleTextHash } from '../utils'; Option,
import { constants, ServiceId } from '../utils'; UserData,
import { StreamParser } from '../parser'; 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'); const logger = createLogger('core');
@@ -517,3 +524,5 @@ export class MediaFusionPreset extends Preset {
return encodedUserData; return encodedUserData;
} }
} }
+6 -4
View File
@@ -1,13 +1,13 @@
import { Addon, Option, ParsedStream, Stream, UserData } from '../db'; import { Addon, Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { import {
Cache, Cache,
constants, constants,
Env, Env,
getSimpleTextHash, getSimpleTextHash,
makeRequest, makeRequest,
} from '../utils'; } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
const moreLikeThisManifests = Cache.getInstance<string, string>( const moreLikeThisManifests = Cache.getInstance<string, string>(
'moreLikeThisManifests' '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 { Addon, Option, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, ServiceId, constants } from '../utils'; import { Env, RESOURCES, ServiceId, constants } from '../utils/index.js';
import { BuiltinAddonPreset } from './builtin'; import { BuiltinAddonPreset } from './builtin.js';
export class NewznabPreset extends BuiltinAddonPreset { export class NewznabPreset extends BuiltinAddonPreset {
static override get METADATA() { static override get METADATA() {
@@ -146,3 +146,5 @@ export class NewznabPreset extends BuiltinAddonPreset {
return `${this.METADATA.URL}/${configString}/manifest.json`; 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 { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils'; import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { FileParser, StreamParser } from '../parser'; import { FileParser, StreamParser } from '../parser/index.js';
class NuvioStreamsStreamParser extends StreamParser { class NuvioStreamsStreamParser extends StreamParser {
parse(stream: Stream): ParsedStream { parse(stream: Stream): ParsedStream {
@@ -273,3 +273,5 @@ export class NuvioStreamsPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils'; import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class OpenSubtitlesV3PlusPreset extends Preset { export class OpenSubtitlesV3PlusPreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -220,3 +220,5 @@ export class OpenSubtitlesV3PlusPreset extends Preset {
return `${host}/${config}/manifest.json`; return `${host}/${config}/manifest.json`;
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils'; import { Env, RESOURCES, SUBTITLES_RESOURCE } from '../utils/index.js';
export class OpenSubtitlesPreset extends Preset { export class OpenSubtitlesPreset extends Preset {
static override get METADATA() { 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 { Addon, Option, UserData, Resource, ParsedStream, Stream } from '../db/index.js';
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils'; import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
class OrionStreamParser extends StreamParser { class OrionStreamParser extends StreamParser {
protected override raiseErrorIfNecessary( protected override raiseErrorIfNecessary(
@@ -188,3 +188,5 @@ export class OrionPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, Stream } from '../db'; import { Addon, Option, UserData, Resource, Stream } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, SERVICE_DETAILS } from '../utils'; import { Env, SERVICE_DETAILS } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
export class PeerflixPreset extends Preset { export class PeerflixPreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -181,3 +181,5 @@ export class PeerflixPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
+5 -3
View File
@@ -6,9 +6,9 @@ import {
UserData, UserData,
PresetMetadata, PresetMetadata,
Addon, Addon,
} from '../db'; } from '../db/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { Env, ServiceId, constants } from '../utils'; import { Env, ServiceId, constants } from '../utils/index.js';
/** /**
* *
* What modifications are needed for each preset: * What modifications are needed for each preset:
@@ -274,3 +274,5 @@ export abstract class Preset {
return apiKey; return apiKey;
} }
} }
+63 -61
View File
@@ -1,64 +1,64 @@
import { PresetMetadata, PresetMinimalMetadata } from '../db'; import { PresetMetadata, PresetMinimalMetadata } from '../db/index.js';
import { CometPreset } from './comet'; import { CometPreset } from './comet.js';
import { CustomPreset } from './custom'; import { CustomPreset } from './custom.js';
import { MediaFusionPreset } from './mediafusion'; import { MediaFusionPreset } from './mediafusion.js';
import { StremthruStorePreset } from './stremthruStore'; import { StremthruStorePreset } from './stremthruStore.js';
import { TorrentioPreset } from './torrentio'; import { TorrentioPreset } from './torrentio.js';
import { TorboxAddonPreset } from './torbox'; import { TorboxAddonPreset } from './torbox.js';
import { EasynewsPreset } from './easynews'; import { EasynewsPreset } from './easynews.js';
import { EasynewsPlusPreset } from './easynewsPlus'; import { EasynewsPlusPreset } from './easynewsPlus.js';
import { EasynewsPlusPlusPreset } from './easynewsPlusPlus'; import { EasynewsPlusPlusPreset } from './easynewsPlusPlus.js';
import { StremthruTorzPreset } from './stremthruTorz'; import { StremthruTorzPreset } from './stremthruTorz.js';
import { DebridioPreset } from './debridioScraper'; import { DebridioPreset } from './debridioScraper.js';
import { AIOStreamsPreset } from './aiostreams'; import { AIOStreamsPreset } from './aiostreams.js';
import { OpenSubtitlesPreset } from './opensubtitles'; import { OpenSubtitlesPreset } from './opensubtitles.js';
import { PeerflixPreset } from './peerflix'; import { PeerflixPreset } from './peerflix.js';
import { DMMCastPreset } from './dmmCast'; import { DMMCastPreset } from './dmmCast.js';
import { MarvelPreset } from './marvel'; import { MarvelPreset } from './marvel.js';
import { JackettioPreset } from './jackettio'; import { JackettioPreset } from './jackettio.js';
import { OrionPreset } from './orion'; import { OrionPreset } from './orion.js';
import { StreamFusionPreset } from './streamfusion'; import { StreamFusionPreset } from './streamfusion.js';
import { AnimeKitsuPreset } from './animeKitsu'; import { AnimeKitsuPreset } from './animeKitsu.js';
import { NuvioStreamsPreset } from './nuviostreams'; import { NuvioStreamsPreset } from './nuviostreams.js';
import { RpdbCatalogsPreset } from './rpdbCatalogs'; import { RpdbCatalogsPreset } from './rpdbCatalogs.js';
import { TmdbCollectionsPreset } from './tmdbCollections'; import { TmdbCollectionsPreset } from './tmdbCollections.js';
import { DebridioWatchtowerPreset } from './debridioWatchtower'; import { DebridioWatchtowerPreset } from './debridioWatchtower.js';
import { DebridioTmdbPreset } from './debridioTmdb'; import { DebridioTmdbPreset } from './debridioTmdb.js';
import { StarWarsUniversePreset } from './starWarsUniverse'; import { StarWarsUniversePreset } from './starWarsUniverse.js';
import { DebridioTvdbPreset } from './debridioTvdb'; import { DebridioTvdbPreset } from './debridioTvdb.js';
import { DcUniversePreset } from './dcUniverse'; import { DcUniversePreset } from './dcUniverse.js';
import { DebridioTvPreset } from './debridioTv'; import { DebridioTvPreset } from './debridioTv.js';
import { TorrentCatalogsPreset } from './torrentCatalogs'; import { TorrentCatalogsPreset } from './torrentCatalogs.js';
import { StreamingCatalogsPreset } from './streamingCatalogs'; import { StreamingCatalogsPreset } from './streamingCatalogs.js';
import { AnimeCatalogsPreset } from './animeCatalogs'; import { AnimeCatalogsPreset } from './animeCatalogs.js';
import { DoctorWhoUniversePreset } from './doctorWhoUniverse'; import { DoctorWhoUniversePreset } from './doctorWhoUniverse.js';
import { WebStreamrPreset } from './webstreamr'; import { WebStreamrPreset } from './webstreamr.js';
import { TMDBAddonPreset } from './tmdb'; import { TMDBAddonPreset } from './tmdb.js';
import { TorrentsDbPreset } from './torrentsDb'; import { TorrentsDbPreset } from './torrentsDb.js';
import { USATVPreset } from './usaTv'; import { USATVPreset } from './usaTv.js';
import { ArgentinaTVPreset } from './argentinaTv'; import { ArgentinaTVPreset } from './argentinaTv.js';
import { OpenSubtitlesV3PlusPreset } from './opensubtitles-v3-plus'; import { OpenSubtitlesV3PlusPreset } from './opensubtitles-v3-plus.js';
import { SubSourcePreset } from './subsource'; import { SubSourcePreset } from './subsource.js';
import { SubDLPreset } from './subdl'; import { SubDLPreset } from './subdl.js';
import { AISearchPreset } from './aiSearch'; import { AISearchPreset } from './aiSearch.js';
import { FKStreamPreset } from './fkstream'; import { FKStreamPreset } from './fkstream.js';
import { AIOSubtitlePreset } from './aiosubtitle'; import { AIOSubtitlePreset } from './aiosubtitle.js';
import { SubHeroPreset } from './subhero'; import { SubHeroPreset } from './subhero.js';
import { StreamAsiaPreset } from './streamasia'; import { StreamAsiaPreset } from './streamasia.js';
import { MoreLikeThisPreset } from './moreLikeThis'; import { MoreLikeThisPreset } from './moreLikeThis.js';
import { GDriveAPI } from '../builtins/gdrive'; import { GDriveAPI } from '../builtins/gdrive/index.js';
import { GDrivePreset } from './gdrive'; import { GDrivePreset } from './gdrive.js';
import { ContentDeepDivePreset } from './contentDeepDive'; import { ContentDeepDivePreset } from './contentDeepDive.js';
import { AICompanionPreset } from './aiCompanion'; import { AICompanionPreset } from './aiCompanion.js';
import { GoogleOAuth } from '../builtins/gdrive/api'; import { GoogleOAuth } from '../builtins/gdrive/api.js';
import { TorBoxSearchPreset } from './torboxSearch'; import { TorBoxSearchPreset } from './torboxSearch.js';
import { TorznabPreset } from './torznab'; import { TorznabPreset } from './torznab.js';
import { AStreamPreset } from './aStream'; import { AStreamPreset } from './aStream.js';
import { Env } from '../utils/env'; import { Env } from '../utils/env.js';
import { ZileanPreset } from './zilean'; import { ZileanPreset } from './zilean.js';
import { AnimeToshoPreset } from './animetosho'; import { AnimeToshoPreset } from './animetosho.js';
import { NewznabPreset } from './newznab'; import { NewznabPreset } from './newznab.js';
import { ProwlarrPreset } from './prowlarr'; import { ProwlarrPreset } from './prowlarr.js';
let PRESET_LIST: string[] = [ let PRESET_LIST: string[] = [
'custom', 'custom',
@@ -261,3 +261,5 @@ export class PresetManager {
} }
} }
} }
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, Stream, UserData } from '../db'; import { Addon, Option, Stream, UserData } from '../db/index.js';
import { Preset, baseOptions } from './preset'; import { Preset, baseOptions } from './preset.js';
import { Env, RESOURCES, ServiceId, constants } from '../utils'; import { Env, RESOURCES, ServiceId, constants } from '../utils/index.js';
import { StremThruPreset } from './stremthru'; import { StremThruPreset } from './stremthru.js';
import { BuiltinAddonPreset } from './builtin'; import { BuiltinAddonPreset } from './builtin.js';
export class ProwlarrPreset extends BuiltinAddonPreset { export class ProwlarrPreset extends BuiltinAddonPreset {
static override get METADATA() { static override get METADATA() {
@@ -133,3 +133,5 @@ export class ProwlarrPreset extends BuiltinAddonPreset {
return `${this.METADATA.URL}/${configString}/manifest.json`; return `${this.METADATA.URL}/${configString}/manifest.json`;
} }
} }
+5 -3
View File
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class RpdbCatalogsPreset extends Preset { export class RpdbCatalogsPreset extends Preset {
private static catalogs = [ private static catalogs = [
@@ -109,3 +109,5 @@ export class RpdbCatalogsPreset extends Preset {
return cacheKey; return cacheKey;
} }
} }
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class StarWarsUniversePreset extends Preset { export class StarWarsUniversePreset extends Preset {
private static catalogs = [ private static catalogs = [
@@ -161,3 +161,5 @@ export class StarWarsUniversePreset extends Preset {
return cacheKey; return cacheKey;
} }
} }
+7 -5
View File
@@ -1,8 +1,8 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db'; import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db/index.js';
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { createLogger, Env } from '../utils'; import { createLogger, Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
const logger = createLogger('core'); const logger = createLogger('core');
@@ -445,3 +445,5 @@ there is no need to provide these details here.
return encodedUserData; return encodedUserData;
} }
} }
+6 -4
View File
@@ -1,7 +1,7 @@
import { Addon, Option, UserData, Resource } from '../db'; import { Addon, Option, UserData, Resource } from '../db/index.js';
import { baseOptions, Preset } from './preset'; import { baseOptions, Preset } from './preset.js';
import { Env } from '../utils'; import { Env } from '../utils/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
export class StreamFusionPreset extends Preset { export class StreamFusionPreset extends Preset {
static override get METADATA() { static override get METADATA() {
@@ -275,3 +275,5 @@ export class StreamFusionPreset extends Preset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }
@@ -1,6 +1,6 @@
import { Addon, Option, UserData } from '../db'; import { Addon, Option, UserData } from '../db/index.js';
import { CacheKeyRequestOptions, Preset, baseOptions } from './preset'; import { CacheKeyRequestOptions, Preset, baseOptions } from './preset.js';
import { constants, Env } from '../utils'; import { constants, Env } from '../utils/index.js';
export class StreamingCatalogsPreset extends Preset { 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 // 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; return cacheKey;
} }
} }
+6 -4
View File
@@ -1,7 +1,7 @@
import { Option, ParsedStream, Stream, UserData } from '../db'; import { Option, ParsedStream, Stream, UserData } from '../db/index.js';
import { StreamParser } from '../parser'; import { StreamParser } from '../parser/index.js';
import { constants, ServiceId } from '../utils'; import { constants, ServiceId } from '../utils/index.js';
import { Preset } from './preset'; import { Preset } from './preset.js';
export const stremthruSpecialCases: Partial< export const stremthruSpecialCases: Partial<
Record<ServiceId, (credentials: any) => any> Record<ServiceId, (credentials: any) => any>
@@ -76,3 +76,5 @@ export class StremThruPreset extends Preset {
export type StremThruServiceId = export type StremThruServiceId =
(typeof StremThruPreset.supportedServices)[number]; (typeof StremThruPreset.supportedServices)[number];
+15 -6
View File
@@ -1,9 +1,16 @@
import { Addon, Option, UserData, Resource, Stream, ParsedStream } from '../db'; import {
import { baseOptions, Preset } from './preset'; Addon,
import { Env } from '../utils'; Option,
import { constants, ServiceId } from '../utils'; UserData,
import { StreamParser } from '../parser'; Resource,
import { StremThruPreset, StremThruStreamParser } from './stremthru'; 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 { class StremthruStoreStreamParser extends StremThruStreamParser {
protected override applyUrlModifications( protected override applyUrlModifications(
@@ -180,3 +187,5 @@ export class StremthruStorePreset extends StremThruPreset {
return `${url}${configString ? '/' + configString : ''}/manifest.json`; return `${url}${configString ? '/' + configString : ''}/manifest.json`;
} }
} }

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