haijeploeg / excludarr

Excludarr manages your libraries in Radarr/Sonarr. It keeps track of your library and checks if your movies and series are also available on a configured streaming provider. It can exclude the movies and series that are available on a configured streaming provider. But it can also re-add movies and series if they are not streaming anymore.
MIT License
197 stars 12 forks source link

Odd issue #3

Closed Tharic99 closed 3 years ago

Tharic99 commented 3 years ago

So I'm running this with the following values

RADARR_REMOVE_IF_NOT_FOUND = os.getenv("RADARR_REMOVE_IF_NOT_FOUND", True) RADARR_DELETE_FILES = os.getenv("RADARR_DELETE_FILES", False) RADARR_ADD_IMPORT_EXCLUSION = os.getenv("RADARR_ADD_IMPORT_EXCLUSION", True) RADARR_EXCLUDE_PROVIDERS = os.getenv("RADARR_EXCLUDE_PROVIDERS", "netflix").split(",")

I had a few hundred movies show up in my list before I cancelled it out (for fear of it removing hundreds of things! haha) Here's what it looked like though.

Will remove: 170 - I Am Legend Will remove: 171 - I Feel Pretty Will remove: 177 - Insurgent Will remove: 178 - Interstellar

I'm confused though because by the config, it's saying that I Am Legend is on Netflix, but it's not. It's streaming on Sling. https://www.themoviedb.org/movie/6479-i-am-legend?language=en-US

I feel Pretty is streaming on Fubo, but still showed in the list. https://www.themoviedb.org/movie/460668-i-feel-pretty?language=en-US

Insurgent is on FreeForm. https://www.themoviedb.org/movie/262500-insurgent?language=en-US

Interstellar is also Fubo https://www.themoviedb.org/movie/157336-interstellar?language=en-US

Am I missing something here or is something wrong?

haijeploeg commented 3 years ago

Hi Tharic,

What TMDB_LOCALE are you using? This defaults to NL. Those movies are available on Netflix in the Netherlands. I suspect you will have to adjust the TMDB_LOCALE to your own 2 letter country.

Tharic99 commented 3 years ago

Doh. Yep, that's it. I'm US so I wasn't sure if the NL was really my country or the default was there for some reason.

Okay so running this now with the US in, this is what I'm getting.

python3 exclude_streaming_from_radarr.py

Will remove: 4 - A Bad Moms Christmas Will remove: 23 - American Assassin Will remove: 25 - Angels & Demons Will remove: 53 - Beyond Skyline Will remove: 76 - Chappaquiddick Will remove: 79 - Chicken Little Will remove: 94 - Death Race: Beyond Anarchy Will remove: 107 - Dolphin Tale 2 Will remove: 151 - Hangman Will remove: 169 - How to Train Your Dragon 2 Will remove: 217 - Monty Python and the Holy Grail Will remove: 220 - Mowgli: Legend of the Jungle Will remove: 225 - Jupiter Ascending Will remove: 246 - Mystic Pizza Will remove: 332 - Step Sisters Will remove: 333 - Steve Jobs Will remove: 338 - Superbad Will remove: 356 - The Da Vinci Code Will remove: 373 - The Help Will remove: 403 - The Polar Express Will remove: 406 - The Princess and the Frog Will remove: 408 - The Princess Switch Will remove: 463 - Life of Brian Will remove: 629 - Platoon Will remove: 843 - Mad Max Will remove: 1090 - The Silence Will remove: 1102 - Backdraft 2 Will remove: 1236 - The Secret Life of Pets 2 Will remove: 1238 - A Haunted House Will remove: 1241 - Angel Has Fallen Will remove: 1245 - Mean Girls 2 Will remove: 1251 - Kevin Hart: Irresponsible Will remove: 1255 - Kevin Hart: I'm a Grown Little Man Will remove: 1312 - Arctic Dogs Will remove: 1469 - GoodFellas Will remove: 1476 - Stranger Than Fiction Will remove: 1481 - Total Recall Will remove: 1503 - Suffragette Will remove: 1517 - Taxi Driver Will remove: 1532 - Catch Me If You Can Will remove: 1543 - The American President Will remove: 1668 - The Trial of the Chicago 7 Will remove: 1669 - Ava Will remove: 1670 - Over the Moon Will remove: 1696 - Sherlock Holmes Will remove: 1724 - Quantum of Solace Will remove: 1764 - Casino Royale Will remove: 1938 - The Boy Will remove: 1984 - Madagascar: Escape 2 Africa Will remove: 2110 - Jimmy Neutron: Boy Genius Will remove: 2157 - Cloudy with a Chance of Meatballs 2 Will remove: 2182 - Bee Movie Will remove: 2185 - Cloudy with a Chance of Meatballs Will remove: 2189 - The Lorax Will remove: 2219 - Ghost Rider Will remove: 2228 - The Croods Will remove: 2233 - Joseph: King of Dreams Will remove: 2401 - A Cinderella Story: Christmas Wish Will remove: 2411 - Olympus Has Fallen Will remove: 2438 - Neon Genesis Evangelion: The End of Evangelion Will remove: 2484 - The Muppets Will remove: 2485 - Muppets Most Wanted Traceback (most recent call last): File "exclude_streaming_from_radarr.py", line 60, in radarr.movie.delete_movies( File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/v3/movie.py", line 69, in delete_movies return self.client.http_delete(self.movie_editor_path, json=json) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 70, in http_delete return self.http_request('delete', path, json=json, params=params) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 58, in http_request return self._filter_api_error(result) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 40, in _filter_api_error raise RadarrMovieNotFound("Movie not found") pyradarr.exceptions.RadarrMovieNotFound: Movie not found

haijeploeg commented 3 years ago

Hi Tharic,

That is a strange issue. It should not report this error when you supply ids which are not existing in Radarr. I tried to reproduce this issue, but I cannot reproduce this error.

It seems that you are getting a 404 error. In Radarr V3 this means that the movie could not be found, but this should not be raised when deleting a movie. So it seems it cannot find the endpoint.

Which version of Radarr are you using? Are you using the latest version of the script?

Tharic99 commented 3 years ago

Radarr - 3.0.2.4390

I just pulled down the current version of the script and re-ran and got the exact same error.

root# python3 exclude_streaming_from_radarr.py Will remove: 4 - A Bad Moms Christmas Will remove: 23 - American Assassin Will remove: 25 - Angels & Demons Will remove: 53 - Beyond Skyline Will remove: 76 - Chappaquiddick Will remove: 79 - Chicken Little Will remove: 94 - Death Race: Beyond Anarchy Will remove: 107 - Dolphin Tale 2 Will remove: 151 - Hangman Will remove: 169 - How to Train Your Dragon 2 Will remove: 217 - Monty Python and the Holy Grail Will remove: 220 - Mowgli: Legend of the Jungle Will remove: 225 - Jupiter Ascending Will remove: 246 - Mystic Pizza Will remove: 332 - Step Sisters Will remove: 333 - Steve Jobs Will remove: 338 - Superbad Will remove: 356 - The Da Vinci Code Will remove: 373 - The Help Will remove: 403 - The Polar Express Will remove: 406 - The Princess and the Frog Will remove: 408 - The Princess Switch Will remove: 463 - Life of Brian Will remove: 629 - Platoon Will remove: 843 - Mad Max Will remove: 1090 - The Silence Will remove: 1102 - Backdraft 2 Will remove: 1236 - The Secret Life of Pets 2 Will remove: 1238 - A Haunted House Will remove: 1241 - Angel Has Fallen Will remove: 1245 - Mean Girls 2 Will remove: 1251 - Kevin Hart: Irresponsible Will remove: 1255 - Kevin Hart: I'm a Grown Little Man Will remove: 1312 - Arctic Dogs Will remove: 1469 - GoodFellas Will remove: 1476 - Stranger Than Fiction Will remove: 1481 - Total Recall Will remove: 1503 - Suffragette Will remove: 1517 - Taxi Driver Will remove: 1532 - Catch Me If You Can Will remove: 1543 - The American President Will remove: 1668 - The Trial of the Chicago 7 Will remove: 1669 - Ava Will remove: 1670 - Over the Moon Will remove: 1696 - Sherlock Holmes Will remove: 1724 - Quantum of Solace Will remove: 1764 - Casino Royale Will remove: 1938 - The Boy Will remove: 1984 - Madagascar: Escape 2 Africa Will remove: 2110 - Jimmy Neutron: Boy Genius Will remove: 2157 - Cloudy with a Chance of Meatballs 2 Will remove: 2182 - Bee Movie Will remove: 2185 - Cloudy with a Chance of Meatballs Will remove: 2189 - The Lorax Will remove: 2219 - Ghost Rider Will remove: 2228 - The Croods Will remove: 2233 - Joseph: King of Dreams Will remove: 2401 - A Cinderella Story: Christmas Wish Will remove: 2411 - Olympus Has Fallen Will remove: 2438 - Neon Genesis Evangelion: The End of Evangelion Will remove: 2484 - The Muppets Will remove: 2485 - Muppets Most Wanted Traceback (most recent call last): File "exclude_streaming_from_radarr.py", line 60, in radarr.movie.delete_movies( File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/v3/movie.py", line 69, in delete_movies return self.client.http_delete(self.movie_editor_path, json=json) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 70, in http_delete return self.http_request('delete', path, json=json, params=params) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 58, in http_request return self._filter_api_error(result) File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/init.py", line 40, in _filter_api_error raise RadarrMovieNotFound("Movie not found") pyradarr.exceptions.RadarrMovieNotFound: Movie not found root#

haijeploeg commented 3 years ago

Hi Tharic,

That is really odd. I am running that version as well, but i don't experience that issue. Can try the following command in a bash shell? This will delete the movie A Bad moms christmas.

curl -X DELETE "http://localhost:7878/api/v3/movie/editor?apiKey=YOUR_API_KEY" -H "accept: */*" -H "Content-Type: application/json" -d "{\"movieIds\":[4],\"deleteFIles\":true,\"addImportExclusion\":true}"

Please adjust the http://localhost:7878 and YOUR_API_KEY to your situation.

Tharic99 commented 3 years ago

Sorry for the delay.

Can you confirm that if I run that command that it will NOT delete the movie from my Sonarr/Plex environment? I'm super leery with this script because I don't want to delete media at all.

haijeploeg commented 3 years ago

Hi Tharic,

You can adjust the parameters: deleteFiles and addImportExclusion to not delete the actual movie file from you system. So Plex still has access to it. Only the database entry in Radarr will be deleted.

curl -X DELETE "http://localhost:7878/api/v3/movie/editor?apiKey=YOUR_API_KEY" -H "accept: */*" -H "Content-Type: application/json" -d "{\"movieIds\":[4],\"deleteFiles\":false,\"addImportExclusion\":false}"

I just want to check if the endoint exists.

Tharic99 commented 3 years ago

Not sure if this helps or made a difference, but..

root@Tower:/mnt/user/appdata/exclude_streaming_radarr#` curl -X DELETE "http://10.233.1.40:7878/api/v3/movie/editor?apiKey=f594b166377f4bdc9b84077cea8809ac" -H "accept: */*" -H "Content-Type: application/json" -d "{\"movieIds\":[4],\"deleteFiles\":false,\"addImportExclusion\":false}"

root@Tower:/mnt/user/appdata/exclude_streaming_radarr# python3 exclude_streaming_from_radarr.py 
Will remove: 4 - A Bad Moms Christmas
Will remove: 23 - American Assassin
Will remove: 25 - Angels & Demons
Will remove: 53 - Beyond Skyline
Will remove: 76 - Chappaquiddick
Will remove: 79 - Chicken Little
Will remove: 94 - Death Race: Beyond Anarchy
Will remove: 107 - Dolphin Tale 2
Will remove: 151 - Hangman
Will remove: 169 - How to Train Your Dragon 2
Will remove: 217 - Monty Python and the Holy Grail
Will remove: 220 - Mowgli: Legend of the Jungle
Will remove: 225 - Jupiter Ascending
Will remove: 246 - Mystic Pizza
Will remove: 332 - Step Sisters
Will remove: 333 - Steve Jobs
Will remove: 338 - Superbad
Will remove: 356 - The Da Vinci Code
Will remove: 373 - The Help
Will remove: 403 - The Polar Express
Will remove: 406 - The Princess and the Frog
Will remove: 408 - The Princess Switch
Will remove: 463 - Life of Brian
Will remove: 629 - Platoon
Will remove: 843 - Mad Max
Will remove: 1090 - The Silence
Will remove: 1102 - Backdraft 2
Will remove: 1236 - The Secret Life of Pets 2
Will remove: 1238 - A Haunted House
Will remove: 1241 - Angel Has Fallen
Will remove: 1245 - Mean Girls 2
Will remove: 1251 - Kevin Hart: Irresponsible
Will remove: 1255 - Kevin Hart: I'm a Grown Little Man
Will remove: 1312 - Arctic Dogs
Will remove: 1469 - GoodFellas
Will remove: 1476 - Stranger Than Fiction
Will remove: 1481 - Total Recall
Will remove: 1503 - Suffragette
Will remove: 1517 - Taxi Driver
Will remove: 1532 - Catch Me If You Can
Will remove: 1543 - The American President
Will remove: 1668 - The Trial of the Chicago 7
Will remove: 1669 - Ava
Will remove: 1670 - Over the Moon
Will remove: 1696 - Sherlock Holmes
Will remove: 1724 - Quantum of Solace
Will remove: 1764 - Casino Royale
Will remove: 1938 - The Boy
Will remove: 1984 - Madagascar: Escape 2 Africa
Will remove: 2110 - Jimmy Neutron: Boy Genius
Will remove: 2157 - Cloudy with a Chance of Meatballs 2
Will remove: 2182 - Bee Movie
Will remove: 2185 - Cloudy with a Chance of Meatballs
Will remove: 2189 - The Lorax
Will remove: 2219 - Ghost Rider
Will remove: 2228 - The Croods
Will remove: 2231 - Penguins of Madagascar
Will remove: 2233 - Joseph: King of Dreams
Will remove: 2401 - A Cinderella Story: Christmas Wish
Will remove: 2411 - Olympus Has Fallen
Will remove: 2438 - Neon Genesis Evangelion: The End of Evangelion
Will remove: 2484 - The Muppets
Will remove: 2485 - Muppets Most Wanted
Will remove: 2558 - Tremors: A Cold Day in Hell
Will remove: 2559 - Tremors: Shrieker Island
Traceback (most recent call last):
  File "exclude_streaming_from_radarr.py", line 60, in <module>
    radarr.movie.delete_movies(
  File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/v3/movie.py", line 69, in delete_movies
    return self.client.http_delete(self.movie_editor_path, json=json)
  File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/__init__.py", line 70, in http_delete
    return self.http_request('delete', path, json=json, params=params)
  File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/__init__.py", line 58, in http_request
    return self._filter_api_error(result)
  File "/mnt/user/appdata/exclude_streaming_radarr/pyradarr/__init__.py", line 40, in _filter_api_error
    raise RadarrMovieNotFound("Movie not found")
pyradarr.exceptions.RadarrMovieNotFound: Movie not found
root@Tower:/mnt/user/appdata/exclude_streaming_radarr# 
haijeploeg commented 3 years ago

Hmm I think the endpoint is not present on your installation for some strange reason. I am currently rewriting this script to a full CLI tool. I am planning to do a for loop over all the movies that it wants to delete and delete them using the https://radarr.video/docs/api/#/Movie/deleteMovie endpoint. I think that will solve your problem. I will come back to you when this is done.

haijeploeg commented 3 years ago

Hi Tharic,

I have just release the cli tool, which can probably help you out as well. You can install the tool via: pip install excludarr. Configure it as needed and make sure you use the -l or --legacy flag. This will cause another method to delete the movies from Radarr. Can you try this?

haijeploeg commented 3 years ago

Closing this issue for now. If you still experiencing this issue, feel free to reopen it.