Skip to content

Commit

Permalink
feat(radarr-scanner): remove unmonitored movies from "requests"
Browse files Browse the repository at this point in the history
  • Loading branch information
bonswouar committed Jan 23, 2025
1 parent 002557d commit 60e5258
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 156 deletions.
1 change: 1 addition & 0 deletions cypress/config/settings.cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"enableSpecialEpisodes": false,
"forceIpv4First": false,
"dnsServers": "",
"removeUnmonitoredEnabled": false,
"locale": "en"
},
"plex": {
Expand Down
3 changes: 3 additions & 0 deletions overseerr-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ components:
partialRequestsEnabled:
type: boolean
example: false
removeUnmonitoredEnabled:
type: boolean
example: false
localLogin:
type: boolean
example: true
Expand Down
3 changes: 3 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#/bin/sh
COMMIT_TAG=`git rev-parse HEAD`
docker build --build-arg COMMIT_TAG=${COMMIT_TAG} -t bonswouar/jellyseerr -f Dockerfile . && docker push bonswouar/jellyseerr
1 change: 1 addition & 0 deletions server/interfaces/api/settingsInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface PublicSettingsResponse {
mediaServerType: number;
partialRequestsEnabled: boolean;
enableSpecialEpisodes: boolean;
removeUnmonitoredEnabled: boolean;
cacheImages: boolean;
vapidPublic: string;
enablePushRegistration: boolean;
Expand Down
17 changes: 16 additions & 1 deletion server/lib/scanners/baseScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class BaseScanner<T> {

/**
* processShow takes a TMDB ID and an array of ProcessableSeasons, which
* should include the total episodes a sesaon has + the total available
* should include the total episodes a season has + the total available
* episodes that each season currently has. Unlike processMovie, this method
* does not take an `is4k` option. We handle both the 4k _and_ non 4k status
* in one method.
Expand Down 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.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;
15 changes: 7 additions & 8 deletions server/lib/scanners/radarr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ 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,
}
);
const settings = getSettings();
if (
settings.main.removeUnmonitoredEnabled &&
!radarrMovie.monitored &&
!radarrMovie.hasFile
) {
this.processUnmonitoredMovie(radarrMovie.tmdbId);
return;
}

Expand Down
4 changes: 4 additions & 0 deletions server/lib/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface MainSettings {
enableSpecialEpisodes: boolean;
forceIpv4First: boolean;
dnsServers: string;
removeUnmonitoredEnabled: boolean;
locale: string;
proxy: ProxySettings;
}
Expand All @@ -158,6 +159,7 @@ interface FullPublicSettings extends PublicSettings {
jellyfinServerName?: string;
partialRequestsEnabled: boolean;
enableSpecialEpisodes: boolean;
removeUnmonitoredEnabled: boolean;
cacheImages: boolean;
vapidPublic: string;
enablePushRegistration: boolean;
Expand Down Expand Up @@ -350,6 +352,7 @@ class Settings {
enableSpecialEpisodes: false,
forceIpv4First: false,
dnsServers: '',
removeUnmonitoredEnabled: false,
locale: 'en',
proxy: {
enabled: false,
Expand Down Expand Up @@ -595,6 +598,7 @@ class Settings {
mediaServerType: this.main.mediaServerType,
partialRequestsEnabled: this.data.main.partialRequestsEnabled,
enableSpecialEpisodes: this.data.main.enableSpecialEpisodes,
removeUnmonitoredEnabled: this.data.main.removeUnmonitoredEnabled,
cacheImages: this.data.main.cacheImages,
vapidPublic: this.vapidPublic,
enablePushRegistration: this.data.notifications.agents.webpush.enabled,
Expand Down
Loading

0 comments on commit 60e5258

Please sign in to comment.