Skip to content

Commit 1bab491

Browse files
committed
feat(radarr-scanner): remove unmonitored movies from "requests"
1 parent 425f0c8 commit 1bab491

File tree

11 files changed

+72
-9
lines changed

11 files changed

+72
-9
lines changed

cypress/config/settings.cypress.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"mediaServerType": 1,
2424
"partialRequestsEnabled": true,
2525
"enableSpecialEpisodes": false,
26+
"removeUnmonitoredEnabled": false,
2627
"locale": "en"
2728
},
2829
"plex": {

overseerr-api.yml

+3
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

+3
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

+1
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

+16-1
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

+7-8
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

+4
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export interface MainSettings {
132132
mediaServerType: number;
133133
partialRequestsEnabled: boolean;
134134
enableSpecialEpisodes: boolean;
135+
removeUnmonitoredEnabled: boolean;
135136
locale: string;
136137
proxy: ProxySettings;
137138
}
@@ -156,6 +157,7 @@ interface FullPublicSettings extends PublicSettings {
156157
jellyfinServerName?: string;
157158
partialRequestsEnabled: boolean;
158159
enableSpecialEpisodes: boolean;
160+
removeUnmonitoredEnabled: boolean;
159161
cacheImages: boolean;
160162
vapidPublic: string;
161163
enablePushRegistration: boolean;
@@ -346,6 +348,7 @@ class Settings {
346348
mediaServerType: MediaServerType.NOT_CONFIGURED,
347349
partialRequestsEnabled: true,
348350
enableSpecialEpisodes: false,
351+
removeUnmonitoredEnabled: false,
349352
locale: 'en',
350353
proxy: {
351354
enabled: false,
@@ -591,6 +594,7 @@ class Settings {
591594
mediaServerType: this.main.mediaServerType,
592595
partialRequestsEnabled: this.data.main.partialRequestsEnabled,
593596
enableSpecialEpisodes: this.data.main.enableSpecialEpisodes,
597+
removeUnmonitoredEnabled: this.data.main.removeUnmonitoredEnabled,
594598
cacheImages: this.data.main.cacheImages,
595599
vapidPublic: this.vapidPublic,
596600
enablePushRegistration: this.data.notifications.agents.webpush.enabled,

src/components/Settings/SettingsMain/index.tsx

+34
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const messages = defineMessages('components.Settings.SettingsMain', {
5757
validationApplicationUrlTrailingSlash: 'URL must not end in a trailing slash',
5858
partialRequestsEnabled: 'Allow Partial Series Requests',
5959
enableSpecialEpisodes: 'Allow Special Episodes Requests',
60+
removeUnmonitoredEnabled: 'Remove Unmonitored Media',
61+
removeUnmonitoredExplanation:
62+
'Remove Movies/Seasons from Jellyseerr that are not available and have been un-monitored since',
6063
locale: 'Display Language',
6164
proxyEnabled: 'HTTP(S) Proxy',
6265
proxyHostname: 'Proxy Hostname',
@@ -160,6 +163,7 @@ const SettingsMain = () => {
160163
streamingRegion: data?.streamingRegion || 'US',
161164
partialRequestsEnabled: data?.partialRequestsEnabled,
162165
enableSpecialEpisodes: data?.enableSpecialEpisodes,
166+
removeUnmonitoredEnabled: data?.removeUnmonitoredEnabled,
163167
trustProxy: data?.trustProxy,
164168
cacheImages: data?.cacheImages,
165169
proxyEnabled: data?.proxy?.enabled,
@@ -191,6 +195,7 @@ const SettingsMain = () => {
191195
originalLanguage: values.originalLanguage,
192196
partialRequestsEnabled: values.partialRequestsEnabled,
193197
enableSpecialEpisodes: values.enableSpecialEpisodes,
198+
removeUnmonitoredEnabled: values.removeUnmonitoredEnabled,
194199
trustProxy: values.trustProxy,
195200
cacheImages: values.cacheImages,
196201
proxy: {
@@ -524,6 +529,35 @@ const SettingsMain = () => {
524529
/>
525530
</div>
526531
</div>
532+
<div className="form-row">
533+
<label
534+
htmlFor="removeUnmonitoredEnabled"
535+
className="checkbox-label"
536+
>
537+
<span className="mr-2">
538+
{intl.formatMessage(messages.removeUnmonitoredEnabled)}
539+
</span>
540+
<SettingsBadge badgeType="experimental" />
541+
<span className="label-tip">
542+
{intl.formatMessage(
543+
messages.removeUnmonitoredExplanation
544+
)}
545+
</span>
546+
</label>
547+
<div className="form-input-area">
548+
<Field
549+
type="checkbox"
550+
id="removeUnmonitoredEnabled"
551+
name="removeUnmonitoredEnabled"
552+
onChange={() => {
553+
setFieldValue(
554+
'removeUnmonitoredEnabled',
555+
!values.removeUnmonitoredEnabled
556+
);
557+
}}
558+
/>
559+
</div>
560+
</div>
527561
<div className="form-row">
528562
<label htmlFor="proxyEnabled" className="checkbox-label">
529563
<span className="mr-2">

src/context/SettingsContext.tsx

+1
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

+1
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,7 @@
939939
"components.Settings.SettingsMain.proxyUser": "Proxy Username",
940940
"components.Settings.SettingsMain.streamingRegion": "Streaming Region",
941941
"components.Settings.SettingsMain.streamingRegionTip": "Show streaming sites by regional availability",
942+
"components.Settings.SettingsMain.removeUnmonitoredFromRequestsEnabled": "Remove Request for Movies/Seasons that have been un-monitored since",
942943
"components.Settings.SettingsMain.toastApiKeyFailure": "Something went wrong while generating a new API key.",
943944
"components.Settings.SettingsMain.toastApiKeySuccess": "New API key generated successfully!",
944945
"components.Settings.SettingsMain.toastSettingsFailure": "Something went wrong while saving settings.",

src/pages/_app.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ CoreApp.getInitialProps = async (initialProps) => {
200200
mediaServerType: MediaServerType.NOT_CONFIGURED,
201201
partialRequestsEnabled: true,
202202
enableSpecialEpisodes: false,
203+
removeUnmonitoredEnabled: false,
203204
cacheImages: false,
204205
vapidPublic: '',
205206
enablePushRegistration: false,

0 commit comments

Comments
 (0)