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 90a0a2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
16 changes: 16 additions & 0 deletions server/lib/scanners/baseScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,22 @@ 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);
// For some reason the status of missing movies isn't PENDING but PROCESSING
if (existing && existing.status === MediaStatus.PROCESSING) {
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 90a0a2a

Please sign in to comment.