File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,19 @@ mediaRoutes.delete(
237
237
}
238
238
239
239
if ( isMovie ) {
240
+ // check if the movie exists
241
+ try {
242
+ await ( service as RadarrAPI ) . getMovie ( {
243
+ id : parseInt (
244
+ is4k
245
+ ? ( media . externalServiceSlug4k as string )
246
+ : ( media . externalServiceSlug as string )
247
+ ) ,
248
+ } ) ;
249
+ } catch {
250
+ return res . status ( 204 ) . send ( ) ;
251
+ }
252
+ // remove the movie
240
253
await ( service as RadarrAPI ) . removeMovie (
241
254
parseInt (
242
255
is4k
@@ -251,6 +264,13 @@ mediaRoutes.delete(
251
264
if ( ! tvdbId ) {
252
265
throw new Error ( 'TVDB ID not found' ) ;
253
266
}
267
+ // check if the series exists
268
+ try {
269
+ await ( service as SonarrAPI ) . getSeriesByTvdbId ( tvdbId ) ;
270
+ } catch {
271
+ return res . status ( 204 ) . send ( ) ;
272
+ }
273
+ // remove the series
254
274
await ( service as SonarrAPI ) . removeSerie ( tvdbId ) ;
255
275
}
256
276
You can’t perform that action at this time.
0 commit comments