mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 03:15:07 +01:00
enum value added
This commit is contained in:
parent
051c1ba709
commit
f02256f9e0
@ -22,12 +22,12 @@ interface FLIXMediaBase {
|
|||||||
|
|
||||||
interface FLIXTVSerie extends FLIXMediaBase {
|
interface FLIXTVSerie extends FLIXMediaBase {
|
||||||
type: "TV Series";
|
type: "TV Series";
|
||||||
seasons: number;
|
seasons: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FLIXMovie extends FLIXMediaBase {
|
interface FLIXMovie extends FLIXMediaBase {
|
||||||
type: "Movie";
|
type: "Movie";
|
||||||
releaseDate: number;
|
releaseDate: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function castSubtitles({ url, lang }: { url: string; lang: string }) {
|
function castSubtitles({ url, lang }: { url: string; lang: string }) {
|
||||||
@ -42,6 +42,7 @@ function castSubtitles({ url, lang }: { url: string; lang: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const qualityMap: Record<string, MWStreamQuality> = {
|
const qualityMap: Record<string, MWStreamQuality> = {
|
||||||
|
auto: MWStreamQuality.QAUTO,
|
||||||
"360": MWStreamQuality.Q360P,
|
"360": MWStreamQuality.Q360P,
|
||||||
"540": MWStreamQuality.Q540P,
|
"540": MWStreamQuality.Q540P,
|
||||||
"480": MWStreamQuality.Q480P,
|
"480": MWStreamQuality.Q480P,
|
||||||
@ -71,14 +72,14 @@ registerProvider({
|
|||||||
const movie = v as FLIXMovie;
|
const movie = v as FLIXMovie;
|
||||||
return (
|
return (
|
||||||
compareTitle(movie.title, media.meta.title) &&
|
compareTitle(movie.title, media.meta.title) &&
|
||||||
movie.releaseDate === Number(media.meta.year)
|
movie.releaseDate === media.meta.year
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const serie = v as FLIXTVSerie;
|
const serie = v as FLIXTVSerie;
|
||||||
if (media.meta.seasons) {
|
if (serie.seasons && media.meta.seasons) {
|
||||||
return (
|
return (
|
||||||
compareTitle(serie.title, media.meta.title) &&
|
compareTitle(serie.title, media.meta.title) &&
|
||||||
serie.seasons === Number(media.meta.seasons.length)
|
serie.seasons === media.meta.seasons.length
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return compareTitle(serie.title, media.meta.title);
|
return compareTitle(serie.title, media.meta.title);
|
||||||
@ -94,7 +95,7 @@ registerProvider({
|
|||||||
id: flixId,
|
id: flixId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (!mediaInfo.episodes) throw new Error("No watchable item found");
|
||||||
// get stream info from media
|
// get stream info from media
|
||||||
progress(75);
|
progress(75);
|
||||||
const watchInfo = await proxiedFetch<any>("/watch", {
|
const watchInfo = await proxiedFetch<any>("/watch", {
|
||||||
@ -105,9 +106,8 @@ registerProvider({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!watchInfo.sources) {
|
if (!watchInfo.sources) throw new Error("No watchable item found");
|
||||||
throw new Error("No watchable item found");
|
|
||||||
}
|
|
||||||
// get best quality source
|
// get best quality source
|
||||||
// comes sorted by quality in descending order
|
// comes sorted by quality in descending order
|
||||||
const source = watchInfo.sources[0];
|
const source = watchInfo.sources[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user