Giter Club home page Giter Club logo

purgeomatic's Issues

Matching on movie titles isn't reliable

I've come across some issues matching on title exactly. I know you were dealing with title matching in #9 and touched on using tmdbids but decided against it. Would it be possible to have both? How do you get the tmdb id from tautulli anyway? I can't find any information in the docs :P

Here's an example.
In Radarr: Star Wars: The Last Jedi
In Plex/Tautulli: Star Wars: Episode VIII - The Last Jedi

Error Running Dry Run

Python V3.11

Tried using localhost or ip via the .env as well as testing it through docker but both ways showing same error even when trying to run delete.movies.unwatched.py.

Any help or advice would be appreciated.

python delete.tv.unwatched.py
DRY_RUN enabled!
--------------------------------------
2023-09-29T00:02:48.434880
Traceback (most recent call last):
  File "/home/seed/purgeomatic/delete.tv.unwatched.py", line 93, in <module>
    shows = json.loads(r.text)
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Overseerr Connection

Hey, I don't use overseerr. I see that it's an optional parameter, so i've commented it out of my .env. I am assuming that because it has defaults set, that's the reason why i'm getting my logs spammed by connection errors to overseerr? Is it possible to toggle this off so I only see log messages? Kinda hard to read my dry log.

Docker-Compose

Hi,

First I'd like to thank you for this project. I have been looking for something like this for a long time to keep my library well maintained. This is exactly what I needed.

I am sorry if I did not put this in the right place. I think this is a feature request, but I dunno where to make that.

I can see that docker is supported, however, I was unable to see any instructions for docker-compose. Is it possible to pass these variables using a docker-compose file?

Thanks,

issues in running in linux container

Issue:

/opt/purgeomatic# python3.9 ./delete.movies.unwatched.py 
DRY_RUN enabled!
--------------------------------------
2023-09-10T17:52:01.325669
Traceback (most recent call last):
  File "/opt/purgeomatic/./delete.movies.unwatched.py", line 89, in <module>
    movies = json.loads(r.text)
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

ENV:

# Config for all scripts. Defaults are commented out.

RADARR=http://192.168.1.redacted:7878
RADARR_API=redacted

TAUTULLI=http://192.168.1.redacted:8181
TAUTULLI_API=redacted

SONARR=http://192.168.1.redacted:8989
SONARR_API=redacted

#OVERSEERR=http://localhost:5055 # not using it
#OVERSEERR_API=abcdefghijklmnopqrstuvwxyz987654=

TAUTULLI_MOVIE_SECTIONID=10 # yes i checked
TAUTULLI_TV_SECTIONID=11 # this one too

# Number of rows to pull from Tautulli's media table.
TAUTULLI_NUM_ROWS=3000

# Delete movies/series that haven't been watched in this many days.
DAYS_SINCE_LAST_WATCH=730

# For deleting movies/series that have been added, but nobody ever watched.
# Set to 0 to disable.
DAYS_WITHOUT_WATCH=730

# This is off by default! If you set this to any value, it will be on.
# Even the mere existence of this environment variable, set to nothing/blank, and it will be on.
# Turn it on to disable the delete action. The script will only report what it would do.
DRY_RUN=on
pip install -r requirements.txt
Requirement already satisfied: jq==1.4.1 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (1.4.1)
Requirement already satisfied: python-dotenv==1.0.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 2)) (1.0.0)
Requirement already satisfied: requests==2.31.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 3)) (2.31.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests==2.31.0->-r requirements.txt (line 3)) (1.26.5)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.9/dist-packages (from requests==2.31.0->-r requirements.txt (line 3)) (3.2.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests==2.31.0->-r requirements.txt (line 3)) (2020.6.20)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests==2.31.0->-r requirements.txt (line 3)) (2.10)

Running this in he same LXC that I run tautulli on.

Any ideas?

Transmission support

First of all, thank you for the script, it's awesome. Been looking for something like this for a while. Everything works perfectly, but what I'm missing is Transmission cleanup support, the files/torrents are left there. Can you add this? Thanks!

Days without Watch logic

Sorry if this is the wrong avenue. I have a question about the "Days without Watch" logic.

It looks like it takes the date from Tautulli for when the media was "added" to use for the DAYS_WITHOUT_WATCH.

I started using Tautulli after my library was already pretty large, I think a feature to parse "Added via Overseerr request and not watched within X days" would also be useful.

If that is already part of the logic, please disregard.

Excellent script, BTW!!! So useful!

Size of every result while running?

Hi! Amazing work!!
It would be great to know also the size of every result, it could be useful to decide if a movie should stay or not ๐Ÿ˜ƒ
something like:
DRY RUN: Ad astra | Radarr ID: 1087 | TMDB ID: 419704 | 9.38GB

Sorry if it's an unappropriate request

Thank you!

Support for multiple Radarr and Sonarr instances

Hi!
First, this is a godsend as I have tons of media downloaded, thank you!
I share my Plex servers with friends and family, but they are not tech-savvy, so I only allow them to download up to Full HD quality. But I allow myself to download 4K too.
I could only solve this by having 2 Radarr and Sonarr containers running. One for 4K, one for Full HD cutoff.

I want to prune all 4 of my libraries, but cannot really configure 2 Radarr and Sonarr instances in the .env file as the second one overwrites the first.

Do you plan to support multiple instances of the same type?

Possible to Use Tags

Just discovered this on my journey to keep my library tidy. I have Overseerr tag requested movies accordingly and was wanting to see if this is able to look at and apply only to a specific tag? My brother requests a lot of old movies and TV shows that only he will watch so I have to manually clean those up all the time. I am trying to find a way to auto clean those up based on the tag "overseer" (or his username that overseer tags) and greater than 180 days. From what I can tell, this isn't currently possible without some tweaking, correct? Thanks!

Not an issue: some ideas / feature request

Hi!

Thanks for your work, it looks very promising.

I've found your repo while searching for something special:
I use Ombi and i wanted to look for something that may find and delete movie requested by users some times after the download, leaving everything elses "administrator managed" safe.

i think this can be a cool feature!

Possible to clean multiple libraries at once or setup different .env configs

I love this script. Makes cleaning up my library easier. I have multiple libraries. Is there a way to have it clean multiple libraries at once?
I don't know if its as simple as just putting the ID,ID,ID in the .env
or is there a way to run it and have it reference a different env for each library?
My goal is to be able to set this as a cron job, and have it clean up my libraries once a week.

Thanks

delete.movies.unwatched.py list index out of range

ERROR: There was a problem connecting to Tautulli/Radarr/Overseerr. Please double-check that your connection settings and API keys are correct.

Error message:
list index out of range

The script runs for a while correctly, and then just crashes with that error. I increased the list TAUTULLI_NUM_ROWS=50000 but it doesn't seem to make a difference. I tried refreshing all metadata for that library, and it still fails with that error.

Script seems to crash at variable times. Also get error message with each movie or TV show.

Output below. I am running this in Docker.

sudo docker run --rm -it --env-file environment.env ghcr.io/ask-me-about-loom/purgeomatic:latest python delete.tv.unwatched.py
DRY_RUN enabled!

2023-09-12T06:28:03.563757
ERROR: The Young Ones: Extra data: line 1 column 5 (char 4)
ERROR: Years and Years: Extra data: line 1 column 5 (char 4)
ERROR: Wonders of the Universe: Extra data: line 1 column 5 (char 4)
ERROR: Wolf Pack: Extra data: line 1 column 5 (char 4)
ERROR: Wolf Like Me: Extra data: line 1 column 5 (char 4)
ERROR: The Witcher: Extra data: line 1 column 5 (char 4)
ERROR: Will & Grace: Extra data: line 1 column 5 (char 4)
ERROR: Wild Wild Country: Extra data: line 1 column 5 (char 4)
ERROR: When They See Us: Extra data: line 1 column 5 (char 4)
ERROR: Wayne: Extra data: line 1 column 5 (char 4)
ERROR: WandaVision: Extra data: line 1 column 5 (char 4)
ERROR: Vikings: Valhalla: Extra data: line 1 column 5 (char 4)
ERROR: Vikings: Extra data: line 1 column 5 (char 4)
ERROR: Vigil: Extra data: line 1 column 5 (char 4)
ERROR: Upright: Extra data: line 1 column 5 (char 4)
ERROR: The Unicorn: Extra data: line 1 column 5 (char 4)
ERROR: The Undoing: Extra data: line 1 column 5 (char 4)
ERROR: The Twilight Zone (2019): Extra data: line 1 column 5 (char 4)
ERROR: The Twelve (AU): Extra data: line 1 column 5 (char 4)
ERROR: Turning Point: 9/11 and the War on Terror: Extra data: line 1 column 5 (char 4)
ERROR: Treasures of Ancient Egypt: Extra data: line 1 column 5 (char 4)
ERROR: Top Gear: Extra data: line 1 column 5 (char 4)
ERROR: Tiger King: Extra data: line 1 column 5 (char 4)
ERROR: The Terror: Extra data: line 1 column 5 (char 4)
ERROR: Tell Me Lies: Extra data: line 1 column 5 (char 4)
ERROR: A Teacher: Extra data: line 1 column 5 (char 4)
ERROR: Tales from the Loop: Extra data: line 1 column 5 (char 4)
ERROR: The Super Switch: Extra data: line 1 column 5 (char 4)
ERROR: Strike Back: Extra data: line 1 column 5 (char 4)
ERROR: The Stranger (2020): Extra data: line 1 column 5 (char 4)
ERROR: Stephen Fry: Out There: Extra data: line 1 column 5 (char 4)
ERROR: Stay Close: Extra data: line 1 column 5 (char 4)
ERROR: StartUp (2016): Extra data: line 1 column 5 (char 4)
ERROR: StarTalk with Neil deGrasse Tyson: Extra data: line 1 column 5 (char 4)
ERROR: Squid Game: Extra data: line 1 column 5 (char 4)
ERROR: Soul Mates: Extra data: line 1 column 5 (char 4)
ERROR: Solar Opposites: Extra data: line 1 column 5 (char 4)
ERROR: The Sinner: Extra data: line 1 column 5 (char 4)
ERROR: The Simpsons: Extra data: line 1 column 5 (char 4)
ERROR: Silicon Valley: Extra data: line 1 column 5 (char 4)
ERROR: The Silent Sea: Extra data: line 1 column 5 (char 4)
ERROR: Sick of It: Extra data: line 1 column 5 (char 4)
ERROR: The Shop: Uninterrupted: Extra data: line 1 column 5 (char 4)
ERROR: Shark Wranglers: Extra data: line 1 column 5 (char 4)
ERROR: Shameless (US): Extra data: line 1 column 5 (char 4)
ERROR: Shadow and Bone: Extra data: line 1 column 5 (char 4)
ERROR: Seinfeld: Extra data: line 1 column 5 (char 4)
ERROR: Schitt's Creek: Extra data: line 1 column 5 (char 4)
ERROR: Santa Clarita Diet: Extra data: line 1 column 5 (char 4)
ERROR: Samurai Champloo: Extra data: line 1 column 5 (char 4)
ERROR: Russian Doll: Extra data: line 1 column 5 (char 4)
ERROR: RUN (2020): Extra data: line 1 column 5 (char 4)
ERROR: Round the Twist: Extra data: line 1 column 5 (char 4)
ERROR: The Responder: Extra data: line 1 column 5 (char 4)
ERROR: Real Husbands of Hollywood: More Kevin, More Problems: Extra data: line 1 column 5 (char 4)
ERROR: Real Husbands of Hollywood: Extra data: line 1 column 5 (char 4)
ERROR: Ray Donovan: Extra data: line 1 column 5 (char 4)
ERROR: Raised by Wolves (2020): Extra data: line 1 column 5 (char 4)
ERROR: Quiz: Extra data: line 1 column 5 (char 4)
ERROR: The Queen's Gambit: Extra data: line 1 column 5 (char 4)
ERROR: Pretty Little Liars: Extra data: line 1 column 5 (char 4)
ERROR: Pose: Extra data: line 1 column 5 (char 4)
ERROR: Pororo the Little Penguin: Extra data: line 1 column 5 (char 4)
ERROR: The Planets (2019): Extra data: line 1 column 5 (char 4)
ERROR: Planet Earth II: Extra data: line 1 column 5 (char 4)
ERROR: Patriot (2017): Extra data: line 1 column 5 (char 4)
ERROR: The Pacific: Extra data: line 1 column 5 (char 4)

Make script check TMDB and the TVDB for ratings before deleting.

Hey! Firstly, The project looks awesome!

So, this isn't an issue, but not sure where else to ask this... is it possible to make this script have certain critera. E.g. Movies and/or tv series not watched in 12 months with a rating below 55% will be automatically deleted.

This would be good as it'll just really clear out the junk. You could pretty safely just let that run on its own if setup correctly.

Anyway, hope you like my idea. Keep up the good work!

delete.tv.unwatched.py deleting same series with longer name

First of all, great tool, thank you very much for creating it.

One small bug report that I discovered while using it:
When I was trying to delete a series (in this case "The office"), the script automatically deleted the series with the same name, but longer (in this case "The Office (US)"), the one that should have been deleted stayed at the location.
I assume there might be an issue with the name recognition.

The exact steps I took to arrive at this conclusion:

  • ran the delete.tv.unwatched.py with dry-run (here "The Office" was included)
  • ran the script and it confirmed "DELETED: The Office"
  • after I ran it again to confirm everything was deleted, "The Office" was still included in the dry-run
  • I checked my sonarr, plex and tautulli pages and can confirm, "The Office (US)" was deleted and "The Office" was still there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.