Merge pull request #300 from thehairy/dev

fix: move meta id check to providers
This commit is contained in:
mrjvs 2023-05-22 19:18:58 +02:00 committed by GitHub
commit 0b8c6439d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -29,8 +29,8 @@ interface JWDetailedMeta extends JWMediaResult {
export interface DetailedMeta {
meta: MWMediaMeta;
tmdbId: string;
imdbId: string;
imdbId?: string;
tmdbId?: string;
}
export async function getMetaFromId(
@ -67,8 +67,6 @@ export async function getMetaFromId(
if (!tmdbId)
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
if (!imdbId || !tmdbId) throw new Error("not enough info");
let seasonData: JWSeasonMetaResult | undefined;
if (data.object_type === "show") {
const seasonToScrape = seasonId ?? data.seasons?.[0].id.toString() ?? "";

View File

@ -41,6 +41,7 @@ registerProvider({
type: [MWMediaType.MOVIE],
async scrape({ progress, media: { imdbId } }) {
if (!imdbId) throw new Error("not enough info");
progress(10);
const streamRes = await proxiedFetch<string>(
"https://database.gdriveplayer.us/player.php",

View File

@ -123,6 +123,7 @@ registerProvider({
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
async scrape(options) {
const { media, progress } = options;
if (!media.imdbId) throw new Error("not enough info");
if (!this.type.includes(media.meta.type)) {
throw new Error("Unsupported type");
}