mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:43:25 +00:00
chore: cleanup
This commit is contained in:
@@ -116,106 +116,6 @@ export async function getVideoStreamFromEmbed({
|
||||
return embedResult;
|
||||
}
|
||||
|
||||
// export async function getVideoStream({
|
||||
// sourceId,
|
||||
// media,
|
||||
// forceVTT,
|
||||
// onEvent,
|
||||
// }: {
|
||||
// sourceId?: string;
|
||||
// media: ScrapeMedia;
|
||||
// forceVTT?: boolean;
|
||||
// onEvent?: (event: RunnerEvent) => void;
|
||||
// }): Promise<Stream | null> {
|
||||
// const providers = makeProviders({
|
||||
// fetcher: makeStandardFetcher(fetch),
|
||||
// target: targets.NATIVE,
|
||||
// consistentIpForRequests: true,
|
||||
// });
|
||||
|
||||
// const options: RunnerOptions = {
|
||||
// media,
|
||||
// events: {
|
||||
// init: onEvent,
|
||||
// update: onEvent,
|
||||
// discoverEmbeds: onEvent,
|
||||
// start: onEvent,
|
||||
// },
|
||||
// };
|
||||
|
||||
// let stream: Stream | null = null;
|
||||
|
||||
// if (sourceId) {
|
||||
// onEvent && onEvent({ sourceIds: [sourceId] });
|
||||
|
||||
// let embedOutput: EmbedOutput | undefined;
|
||||
|
||||
// const sourceResult = await providers
|
||||
// .runSourceScraper({
|
||||
// id: sourceId,
|
||||
// media,
|
||||
// events: {},
|
||||
// })
|
||||
// .catch((error: Error) => {
|
||||
// onEvent &&
|
||||
// onEvent({ id: sourceId, percentage: 0, status: "failure", error });
|
||||
// return undefined;
|
||||
// });
|
||||
|
||||
// if (sourceResult) {
|
||||
// onEvent && onEvent({ id: sourceId, percentage: 50, status: "pending" });
|
||||
|
||||
// for (const embed of sourceResult.embeds) {
|
||||
// const embedResult = await providers
|
||||
// .runEmbedScraper({
|
||||
// id: embed.embedId,
|
||||
// url: embed.url,
|
||||
// })
|
||||
// .catch(() => undefined);
|
||||
|
||||
// if (embedResult) {
|
||||
// embedOutput = embedResult;
|
||||
// onEvent &&
|
||||
// onEvent({ id: embed.embedId, percentage: 100, status: "success" });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (embedOutput) {
|
||||
// stream = embedOutput.stream[0] ?? null;
|
||||
// } else if (sourceResult) {
|
||||
// stream = sourceResult.stream?.[0] ?? null;
|
||||
// }
|
||||
|
||||
// if (stream) {
|
||||
// onEvent && onEvent({ id: sourceId, percentage: 100, status: "success" });
|
||||
// } else {
|
||||
// onEvent && onEvent({ id: sourceId, percentage: 100, status: "notfound" });
|
||||
// }
|
||||
// } else {
|
||||
// stream = await providers
|
||||
// .runAll(options)
|
||||
// .then((result) => result?.stream ?? null);
|
||||
// }
|
||||
|
||||
// if (!stream) return null;
|
||||
|
||||
// if (forceVTT) {
|
||||
// if (stream.captions && stream.captions.length > 0) {
|
||||
// for (const caption of stream.captions) {
|
||||
// if (caption.type === "srt") {
|
||||
// const response = await fetch(caption.url);
|
||||
// const srtSubtitle = await response.blob();
|
||||
// const vttSubtitleUrl = await toWebVTT(srtSubtitle);
|
||||
// caption.url = vttSubtitleUrl;
|
||||
// caption.type = "vtt";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return stream;
|
||||
// }
|
||||
|
||||
export function findHighestQuality(
|
||||
stream: FileBasedStream,
|
||||
): Qualities | undefined {
|
||||
|
Reference in New Issue
Block a user