From f40d9fe1926f56330d7e4b8ca57e38ffe5b1c7ce Mon Sep 17 00:00:00 2001 From: bonswouar Date: Sat, 8 Jun 2024 18:02:31 +0200 Subject: [PATCH] feat: set movie status to unknown if unmonitored from radarr during scan #695 --- server/lib/scanners/baseScanner.ts | 15 +++++++++++++++ server/lib/scanners/radarr/index.ts | 8 +------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/server/lib/scanners/baseScanner.ts b/server/lib/scanners/baseScanner.ts index f0f3db7e6..8b204cfe9 100644 --- a/server/lib/scanners/baseScanner.ts +++ b/server/lib/scanners/baseScanner.ts @@ -618,6 +618,21 @@ class BaseScanner { get protectedBundleSize(): number { return this.bundleSize; } + + protected async processUnmonitoredMovie(tmdbId: number): Promise { + const mediaRepository = getRepository(Media); + await this.asyncLock.dispatch(tmdbId, async () => { + const existing = await this.getExisting(tmdbId, MediaType.MOVIE); + if (existing && existing.status !== MediaStatus.UNKNOWN) { + existing.status = MediaStatus.UNKNOWN; + await mediaRepository.save(existing); + this.log( + `Movie TMDB ID ${tmdbId} unmonitored from Radarr. Media status set to UNKNOWN.`, + 'info' + ); + } + }); + } } export default BaseScanner; diff --git a/server/lib/scanners/radarr/index.ts b/server/lib/scanners/radarr/index.ts index bc299d7b1..8d529ebef 100644 --- a/server/lib/scanners/radarr/index.ts +++ b/server/lib/scanners/radarr/index.ts @@ -80,13 +80,7 @@ class RadarrScanner private async processRadarrMovie(radarrMovie: RadarrMovie): Promise { if (!radarrMovie.monitored && !radarrMovie.hasFile) { - this.log( - 'Title is unmonitored and has not been downloaded. Skipping item.', - 'debug', - { - title: radarrMovie.title, - } - ); + this.processUnmonitoredMovie(radarrMovie.tmdbId); return; }