mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 12:33:26 +00:00
feat: event types and better loading log
This commit is contained in:
@@ -13,6 +13,34 @@ import {
|
||||
targets,
|
||||
} from "@movie-web/providers";
|
||||
|
||||
export interface InitEvent {
|
||||
sourceIds: string[];
|
||||
}
|
||||
|
||||
export interface UpdateEvent {
|
||||
id: string;
|
||||
percentage: number;
|
||||
status: UpdateEventStatus;
|
||||
error?: unknown;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export type UpdateEventStatus = "success" | "failure" | "notfound" | "pending";
|
||||
|
||||
export interface DiscoverEmbedsEvent {
|
||||
sourceId: string;
|
||||
embeds: {
|
||||
id: string;
|
||||
embedScraperId: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export type RunnerEvent =
|
||||
| string
|
||||
| InitEvent
|
||||
| UpdateEvent
|
||||
| DiscoverEmbedsEvent;
|
||||
|
||||
export async function getVideoStream({
|
||||
media,
|
||||
forceVTT,
|
||||
@@ -20,7 +48,7 @@ export async function getVideoStream({
|
||||
}: {
|
||||
media: ScrapeMedia;
|
||||
forceVTT?: boolean;
|
||||
onEvent?: (event: unknown) => void;
|
||||
onEvent?: (event: RunnerEvent) => void;
|
||||
}): Promise<Stream | null> {
|
||||
const providers = makeProviders({
|
||||
fetcher: makeStandardFetcher(fetch),
|
||||
|
Reference in New Issue
Block a user