Skip to content

Commit

Permalink
Merge pull request #641 from jorenn92/Fix/collection-handler-crash-tm…
Browse files Browse the repository at this point in the history
…dbid-3

refactor(collection handler): Improved previous crash mitigation, att…
  • Loading branch information
jorenn92 authored Dec 5, 2023
2 parents 99329b2 + ac11929 commit 9a81f31
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions server/src/modules/collections/collection-worker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,15 @@ export class CollectionWorkerService implements OnApplicationBootstrap {
// find tmdbid
const tmdbid = media.tmdbId
? media.tmdbId
: await this.tmdbIdService.getTmdbIdFromPlexRatingKey(
media.plexId.toString(),
);
: (
await this.tmdbIdService.getTmdbIdFromPlexRatingKey(
media.plexId.toString(),
)
)?.id;

if (tmdbid) {
const radarrMedia = await this.servarrApi.RadarrApi.getMovieByTmdbId(
media.tmdbId,
);
const radarrMedia =
await this.servarrApi.RadarrApi.getMovieByTmdbId(tmdbid);
if (radarrMedia && radarrMedia.id) {
switch (collection.arrAction) {
case ServarrAction.DELETE:
Expand Down Expand Up @@ -184,12 +185,12 @@ export class CollectionWorkerService implements OnApplicationBootstrap {
}
} else {
this.infoLogger(
`Couldn't find movie with tmdbid ${tmdbid} in Radarr. No action taken for movie: ${media.plexData.title}`,
`Couldn't find movie with tmdbid ${tmdbid} in Radarr. No action taken for movie with Plex ID: ${media.plexId}`,
);
}
} else {
this.infoLogger(
`Couldn't find correct tmdbid. No action taken for movie: ${media.plexData.title}`,
`Couldn't find correct tmdbid. No action taken for movie with Plex ID: ${media.plexId}`,
);
}
}
Expand Down

0 comments on commit 9a81f31

Please sign in to comment.