2023-01-14 00:12:56 +01:00
|
|
|
import { DetailedMeta } from "../metadata/getmeta";
|
2023-01-11 21:16:48 +01:00
|
|
|
import { MWMediaType } from "../metadata/types";
|
|
|
|
import { MWEmbed } from "./embed";
|
|
|
|
import { MWStream } from "./streams";
|
|
|
|
|
|
|
|
export type MWProviderScrapeResult = {
|
|
|
|
stream?: MWStream;
|
|
|
|
embeds: MWEmbed[];
|
|
|
|
};
|
|
|
|
|
2023-01-15 16:01:07 +01:00
|
|
|
type MWProviderBase = {
|
2023-01-11 21:16:48 +01:00
|
|
|
progress(percentage: number): void;
|
2023-01-14 00:12:56 +01:00
|
|
|
media: DetailedMeta;
|
2023-01-11 21:16:48 +01:00
|
|
|
};
|
2023-01-15 16:01:07 +01:00
|
|
|
type MWProviderTypeSpecific =
|
|
|
|
| {
|
|
|
|
type: MWMediaType.MOVIE | MWMediaType.ANIME;
|
|
|
|
episode?: undefined;
|
|
|
|
season?: undefined;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
type: MWMediaType.SERIES;
|
2023-01-22 19:26:08 +01:00
|
|
|
episode: string;
|
|
|
|
season: string;
|
2023-01-15 16:01:07 +01:00
|
|
|
};
|
|
|
|
export type MWProviderContext = MWProviderTypeSpecific & MWProviderBase;
|
2023-01-11 21:16:48 +01:00
|
|
|
|
|
|
|
export type MWProvider = {
|
|
|
|
id: string;
|
2023-01-15 16:01:07 +01:00
|
|
|
displayName: string;
|
2023-01-11 21:16:48 +01:00
|
|
|
rank: number;
|
|
|
|
disabled?: boolean;
|
|
|
|
type: MWMediaType[];
|
|
|
|
|
|
|
|
scrape(ctx: MWProviderContext): Promise<MWProviderScrapeResult>;
|
|
|
|
};
|