From e97228899a5936b2525c8060abfa14b5ce31658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1=20Mo=C5=BEeiko?= Date: Wed, 20 Jan 2021 20:27:24 -0800 Subject: [PATCH] fix: lookup movie by imdbid if tmdbid does not exits for plex movie agent (#711) --- server/job/plexsync/index.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/job/plexsync/index.ts b/server/job/plexsync/index.ts index 2c3330ca3..5d1025d95 100644 --- a/server/job/plexsync/index.ts +++ b/server/job/plexsync/index.ts @@ -89,6 +89,15 @@ class JobPlexSync { newMedia.tmdbId = Number(tmdbMatch); } }); + if (newMedia.imdbId && !newMedia.tmdbId) { + const tmdbMovie = await this.tmdb.getMovieByImdbId({ + imdbId: newMedia.imdbId, + }); + newMedia.tmdbId = tmdbMovie.id; + } + if (!newMedia.tmdbId) { + throw new Error('Unable to find TMDB ID'); + } const has4k = metadata.Media.some( (media) => media.videoResolution === '4k'