Skip to content

Commit

Permalink
feat: set movie status to unknown if unmonitored from radarr during s…
Browse files Browse the repository at this point in the history
  • Loading branch information
bonswouar committed Jun 8, 2024
1 parent 4757f1c commit f40d9fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 15 additions & 0 deletions server/lib/scanners/baseScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,21 @@ class BaseScanner<T> {
get protectedBundleSize(): number {
return this.bundleSize;
}

protected async processUnmonitoredMovie(tmdbId: number): Promise<void> {
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;
8 changes: 1 addition & 7 deletions server/lib/scanners/radarr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,7 @@ class RadarrScanner

private async processRadarrMovie(radarrMovie: RadarrMovie): Promise<void> {
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;
}

Expand Down

0 comments on commit f40d9fe

Please sign in to comment.