mirror of
https://github.com/movie-web/movie-web.git
synced 2025-01-15 01:29:07 +01:00
Merge pull request #300 from thehairy/dev
fix: move meta id check to providers
This commit is contained in:
commit
0b8c6439d7
@ -29,8 +29,8 @@ interface JWDetailedMeta extends JWMediaResult {
|
|||||||
|
|
||||||
export interface DetailedMeta {
|
export interface DetailedMeta {
|
||||||
meta: MWMediaMeta;
|
meta: MWMediaMeta;
|
||||||
tmdbId: string;
|
imdbId?: string;
|
||||||
imdbId: string;
|
tmdbId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getMetaFromId(
|
export async function getMetaFromId(
|
||||||
@ -67,8 +67,6 @@ export async function getMetaFromId(
|
|||||||
if (!tmdbId)
|
if (!tmdbId)
|
||||||
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
|
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
|
||||||
|
|
||||||
if (!imdbId || !tmdbId) throw new Error("not enough info");
|
|
||||||
|
|
||||||
let seasonData: JWSeasonMetaResult | undefined;
|
let seasonData: JWSeasonMetaResult | undefined;
|
||||||
if (data.object_type === "show") {
|
if (data.object_type === "show") {
|
||||||
const seasonToScrape = seasonId ?? data.seasons?.[0].id.toString() ?? "";
|
const seasonToScrape = seasonId ?? data.seasons?.[0].id.toString() ?? "";
|
||||||
|
@ -41,6 +41,7 @@ registerProvider({
|
|||||||
type: [MWMediaType.MOVIE],
|
type: [MWMediaType.MOVIE],
|
||||||
|
|
||||||
async scrape({ progress, media: { imdbId } }) {
|
async scrape({ progress, media: { imdbId } }) {
|
||||||
|
if (!imdbId) throw new Error("not enough info");
|
||||||
progress(10);
|
progress(10);
|
||||||
const streamRes = await proxiedFetch<string>(
|
const streamRes = await proxiedFetch<string>(
|
||||||
"https://database.gdriveplayer.us/player.php",
|
"https://database.gdriveplayer.us/player.php",
|
||||||
|
@ -123,6 +123,7 @@ registerProvider({
|
|||||||
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
||||||
async scrape(options) {
|
async scrape(options) {
|
||||||
const { media, progress } = options;
|
const { media, progress } = options;
|
||||||
|
if (!media.imdbId) throw new Error("not enough info");
|
||||||
if (!this.type.includes(media.meta.type)) {
|
if (!this.type.includes(media.meta.type)) {
|
||||||
throw new Error("Unsupported type");
|
throw new Error("Unsupported type");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user