Plex Auto-Delete Script

@ngovil21 – I must have had one too many whiskey’s the night I was trying it out… Probably spilled something on the keyboard and put invalid characters somewhere in the file… I downloaded latest version and it works like a champ! Cheers!

I redirected the first post to your GitHub – Let me know if you want to add or change anything to it…

@Steven4x4 Thanks for changing the first post. It’s a great intro. The only change I would make the preferred method for changing the settings is to make a copy of Cleaner.conf.default and name it Cleaner.conf, then edit the settings there. Make sure to use the same formatting as the example items when adding new settings. That way the script can be updated between versions more easily. Instructions are on GitHub.

@ngovil21 – Hopefully I updated it correctly.

Question – If the Cleaner.conf and Plex-Cleaner.py are in the same folder… are you able to just execute the Plex-Cleaner.py file without calling the config file? Or is the --config “c:…conf” required?

I know the answer is somewhere in the python script, I just hopped on for a quick second - So I didn’t have a chance to check the code for this.

Also – Just a thought – for people that are unfamiliar with Python Scripting… Or just scripting in general…
What would you think about putting the comments regarding the different setting into the config file itself?
That way – there is no need to open up the .py file to read the comments… or maybe just have a different file name SettingsAndConfigurationGuide?

@Steven4x4 Yes no need to specify the config file if it is in the same directory as the script.The script will also look for a .plexcleaner file in the users home directory.

Comments in the config file won’t really work, but a separate file could be made. The Wiki page on GitHub has the descriptions for most of the settings

First, thanks for this great script. Has saved a ton of time. :smile:

I have a question about multi-user config. I have the this up and running with no issues for my main user, but I can’t seem to get it to trigger anything for a second user.

"ShowPreferences": { "show": { "location": "/path/to/show", "homeUsers": "user1,user2" }

There is no mention of user2 in the log when running a test. I’m thinking I may be misunderstanding the default user settings in the main config. I currently just have my token in there, with shared set to false.

What I’m trying to do, is set it where all shows except for the ones listed in ShowPreferences are marked for delete when user1 has watched them, and the listed shows are only deleted when both users have watched them.

Am I missing something here?

PS: the search on here sucks. :frowning:

@sek0n That is the correct way to set it up. For efficiency sake, if one user hasn’t seen the show, the script just stops and marks the show as not watched. You can test it on a show that both users have watched and then it will check the user who last watched the show for the other checks. If that user passes then both users would pass.

I’m sorry the log is not more descriptive, it was just a design choice. The script should be checking all users, it just takes shortcuts if it knows the end result already. You can test it with some dummy accounts. Please report back if you notice any discrepancies.


And just a heads up, but I just saw that Plex has built -in similar functions of this script into the media server. It’s not as feature rich, but it may work for some people.

@OttoKerner said:
Each tv show (from Plex Server 1.4.x on) has now this in its properties:

@ngovil21 That makes sense. Thought I was just doing something wrong.

I’ll test it later tonight to be sure, but sounds like it is working as intended.

Thanks again :smile:

Just to update; I tested it, and it works great. :smiley:

And just a heads up, but I just saw that Plex has built -in similar functions of this script into the media server. It’s not as feature rich, but it may work for some people.

@OttoKerner said:
Each tv show (from Plex Server 1.4.x on) has now this in its properties:

While I plan on sticking with the script for now. Where did you get information on this? I’ve been searching for a while and I"m not seeing it mentioned anywhere. I figured this would be something highly desired and would have more conversation in the forums.

@MovieGhoul said:
While I plan on sticking with the script for now. Where did you get information on this? I’ve been searching for a while and I"m not seeing it mentioned anywhere. I figured this would be something highly desired and would have more conversation in the forums.

I stumbled on it before by accident as well. I’ve not seen any talk about it either, except in this thread.
It’s a per-show setting, when you click on Edit on the series page.

The script is still way more feature rich. Will be nice if they eventually get it up to standards.

Hi,
I’m thinking of moving my plex server to a nvidia shield for 4k playback
Will plex auto delete still work if plex server isn’t on the same system

Ok so a have a server at a VPS, how do i do to run this scrip from my server home and that it also delate the show i already watched in the remote server.

@ngovil21 gonna try use that option in the online server to see if it do what it say it do. would be better if they add that to a funtion in configuration instead of in every show. To configure this in every show i have its kind of a pain.

Do show ID’s change often? I had a show set to keep and noticed it started deleting watched episodes. Checked plex.tv and the show ID was different then what I had in the configuration.

@MovieGhoul said:
Do show ID’s change often? I had a show set to keep and noticed it started deleting watched episodes. Checked plex.tv and the show ID was different then what I had in the configuration.

If a show gets completed deleted, and then added at another time, Plex may give it a new id because it does some clean-up of the database. You can specify shows by name in Show Preferences. The name should be the exact name of the show in Plex, or some unique part of the show name.

In my case the test worked it look like it delate the episode that i already watched. The thing is that looks like it delate the hole folder also.

@ngovil21 said:

@MovieGhoul said:
Do show ID’s change often? I had a show set to keep and noticed it started deleting watched episodes. Checked plex.tv and the show ID was different then what I had in the configuration.

If a show gets completed deleted, and then added at another time, Plex may give it a new id because it does some clean-up of the database. You can specify shows by name in Show Preferences. The name should be the exact name of the show in Plex, or some unique part of the show name.

It wasn’t deleted. However, I’ll go with your suggestion of specifying the show name specifically.

Updated the script to version 2.0. New features include a fix for plex authentication on python3, and the ability to email a summary of the log. Thanks to stevenflesch on GitHub for getting it started.

The new options to setup email will be added to the config file after you update the script and run it for the first time. Or you can make a new config file from Cleaner.config.default.

Gracias will be updating it and see what happens.

Would love to let this loose on my Movies library as well, but need a way to flag certain ones to Keep. Was thinking a category and using profiles but I read that Movies don’t honor profiles. Is there any priority to add that?

Nevermind, I tested it and does what I wanted.

@cylke said:
Would love to let this loose on my Movies library as well, but need a way to flag certain ones to Keep. Was thinking a category and using profiles but I read that Movies don’t honor profiles. Is there any priority to add that?