Skip to content

Commit c014ed8

Browse files
committed
feat(radarr-scanner): remove unmonitored movies from "requests"
1 parent 2b7974f commit c014ed8

File tree

11 files changed

+72
-9
lines changed

11 files changed

+72
-9
lines changed

cypress/config/settings.cypress.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"enableSpecialEpisodes": false,
2626
"forceIpv4First": false,
2727
"dnsServers": "",
28+
"removeUnmonitoredEnabled": false,
2829
"locale": "en"
2930
},
3031
"plex": {

overseerr-api.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ components:
176176
partialRequestsEnabled:
177177
type: boolean
178178
example: false
179+
removeUnmonitoredEnabled:
180+
type: boolean
181+
example: false
179182
localLogin:
180183
type: boolean
181184
example: true

publish.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#/bin/sh
2+
COMMIT_TAG=`git rev-parse HEAD`
3+
docker build --build-arg COMMIT_TAG=${COMMIT_TAG} -t bonswouar/jellyseerr -f Dockerfile . && docker push bonswouar/jellyseerr

server/interfaces/api/settingsInterfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface PublicSettingsResponse {
3838
mediaServerType: number;
3939
partialRequestsEnabled: boolean;
4040
enableSpecialEpisodes: boolean;
41+
removeUnmonitoredEnabled: boolean;
4142
cacheImages: boolean;
4243
vapidPublic: string;
4344
enablePushRegistration: boolean;

server/lib/scanners/baseScanner.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class BaseScanner<T> {
211211

212212
/**
213213
* processShow takes a TMDB ID and an array of ProcessableSeasons, which
214-
* should include the total episodes a sesaon has + the total available
214+
* should include the total episodes a season has + the total available
215215
* episodes that each season currently has. Unlike processMovie, this method
216216
* does not take an `is4k` option. We handle both the 4k _and_ non 4k status
217217
* in one method.
@@ -618,6 +618,21 @@ class BaseScanner<T> {
618618
get protectedBundleSize(): number {
619619
return this.bundleSize;
620620
}
621+
622+
protected async processUnmonitoredMovie(tmdbId: number): Promise<void> {
623+
const mediaRepository = getRepository(Media);
624+
await this.asyncLock.dispatch(tmdbId, async () => {
625+
const existing = await this.getExisting(tmdbId, MediaType.MOVIE);
626+
if (existing && existing.status === MediaStatus.PROCESSING) {
627+
existing.status = MediaStatus.UNKNOWN;
628+
await mediaRepository.save(existing);
629+
this.log(
630+
`Movie TMDB ID ${tmdbId} unmonitored from Radarr. Media status set to UNKNOWN.`,
631+
'info'
632+
);
633+
}
634+
});
635+
}
621636
}
622637

623638
export default BaseScanner;

server/lib/scanners/radarr/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,13 @@ class RadarrScanner
7979
}
8080

8181
private async processRadarrMovie(radarrMovie: RadarrMovie): Promise<void> {
82-
if (!radarrMovie.monitored && !radarrMovie.hasFile) {
83-
this.log(
84-
'Title is unmonitored and has not been downloaded. Skipping item.',
85-
'debug',
86-
{
87-
title: radarrMovie.title,
88-
}
89-
);
82+
const settings = getSettings();
83+
if (
84+
settings.main.removeUnmonitoredEnabled &&
85+
!radarrMovie.monitored &&
86+
!radarrMovie.hasFile
87+
) {
88+
this.processUnmonitoredMovie(radarrMovie.tmdbId);
9089
return;
9190
}
9291

server/lib/settings/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export interface MainSettings {
134134
enableSpecialEpisodes: boolean;
135135
forceIpv4First: boolean;
136136
dnsServers: string;
137+
removeUnmonitoredEnabled: boolean;
137138
locale: string;
138139
proxy: ProxySettings;
139140
}
@@ -158,6 +159,7 @@ interface FullPublicSettings extends PublicSettings {
158159
jellyfinServerName?: string;
159160
partialRequestsEnabled: boolean;
160161
enableSpecialEpisodes: boolean;
162+
removeUnmonitoredEnabled: boolean;
161163
cacheImages: boolean;
162164
vapidPublic: string;
163165
enablePushRegistration: boolean;
@@ -350,6 +352,7 @@ class Settings {
350352
enableSpecialEpisodes: false,
351353
forceIpv4First: false,
352354
dnsServers: '',
355+
removeUnmonitoredEnabled: false,
353356
locale: 'en',
354357
proxy: {
355358
enabled: false,
@@ -595,6 +598,7 @@ class Settings {
595598
mediaServerType: this.main.mediaServerType,
596599
partialRequestsEnabled: this.data.main.partialRequestsEnabled,
597600
enableSpecialEpisodes: this.data.main.enableSpecialEpisodes,
601+
removeUnmonitoredEnabled: this.data.main.removeUnmonitoredEnabled,
598602
cacheImages: this.data.main.cacheImages,
599603
vapidPublic: this.vapidPublic,
600604
enablePushRegistration: this.data.notifications.agents.webpush.enabled,

src/components/Settings/SettingsMain/index.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const messages = defineMessages('components.Settings.SettingsMain', {
6363
dnsServers: 'Custom DNS Servers',
6464
dnsServersTip:
6565
'Comma-separated list of custom DNS servers, e.g. "1.1.1.1,[2606:4700:4700::1111]"',
66+
removeUnmonitoredEnabled: 'Remove Unmonitored Media',
67+
removeUnmonitoredExplanation:
68+
'Remove Movies/Seasons from Jellyseerr that are not available and have been un-monitored since',
6669
locale: 'Display Language',
6770
proxyEnabled: 'HTTP(S) Proxy',
6871
proxyHostname: 'Proxy Hostname',
@@ -171,6 +174,7 @@ const SettingsMain = () => {
171174
trustProxy: data?.trustProxy,
172175
cacheImages: data?.cacheImages,
173176
proxyEnabled: data?.proxy?.enabled,
177+
removeUnmonitoredEnabled: data?.removeUnmonitoredEnabled,
174178
proxyHostname: data?.proxy?.hostname,
175179
proxyPort: data?.proxy?.port,
176180
proxySsl: data?.proxy?.useSsl,
@@ -201,6 +205,7 @@ const SettingsMain = () => {
201205
enableSpecialEpisodes: values.enableSpecialEpisodes,
202206
forceIpv4First: values.forceIpv4First,
203207
dnsServers: values.dnsServers,
208+
removeUnmonitoredEnabled: values.removeUnmonitoredEnabled,
204209
trustProxy: values.trustProxy,
205210
cacheImages: values.cacheImages,
206211
proxy: {
@@ -556,6 +561,35 @@ const SettingsMain = () => {
556561
/>
557562
</div>
558563
</div>
564+
<div className="form-row">
565+
<label
566+
htmlFor="removeUnmonitoredEnabled"
567+
className="checkbox-label"
568+
>
569+
<span className="mr-2">
570+
{intl.formatMessage(messages.removeUnmonitoredEnabled)}
571+
</span>
572+
<SettingsBadge badgeType="experimental" />
573+
<span className="label-tip">
574+
{intl.formatMessage(
575+
messages.removeUnmonitoredExplanation
576+
)}
577+
</span>
578+
</label>
579+
<div className="form-input-area">
580+
<Field
581+
type="checkbox"
582+
id="removeUnmonitoredEnabled"
583+
name="removeUnmonitoredEnabled"
584+
onChange={() => {
585+
setFieldValue(
586+
'removeUnmonitoredEnabled',
587+
!values.removeUnmonitoredEnabled
588+
);
589+
}}
590+
/>
591+
</div>
592+
</div>
559593
<div className="form-row">
560594
<label htmlFor="dnsServers" className="checkbox-label">
561595
<span className="mr-2">

src/context/SettingsContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const defaultSettings = {
2222
mediaServerType: MediaServerType.NOT_CONFIGURED,
2323
partialRequestsEnabled: true,
2424
enableSpecialEpisodes: false,
25+
removeUnmonitoredEnabled: false,
2526
cacheImages: false,
2627
vapidPublic: '',
2728
enablePushRegistration: false,

src/i18n/locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@
944944
"components.Settings.SettingsMain.proxyUser": "Proxy Username",
945945
"components.Settings.SettingsMain.streamingRegion": "Streaming Region",
946946
"components.Settings.SettingsMain.streamingRegionTip": "Show streaming sites by regional availability",
947+
"components.Settings.SettingsMain.removeUnmonitoredFromRequestsEnabled": "Remove Request for Movies/Seasons that have been un-monitored since",
947948
"components.Settings.SettingsMain.toastApiKeyFailure": "Something went wrong while generating a new API key.",
948949
"components.Settings.SettingsMain.toastApiKeySuccess": "New API key generated successfully!",
949950
"components.Settings.SettingsMain.toastSettingsFailure": "Something went wrong while saving settings.",

0 commit comments

Comments
 (0)