Any update on adding shared users for watched status’s?
Quick question on the default_onDeck setting.
The help at the top of the PlexCleaner.py describes it like this.
“If set to True, episodes that are On Deck in Plex will not be deleted”
But is it really the onDeck episode that won’t be deleted, or is it actually the just watched episode that won’t be deleted?
In my research I believe I understand the purpose for the setting, but the “help” quoted above make me question that understanding.
Can someone clear that up for me?
Thanks,
Bob
It is actually the episode just before the onDeck episode that isn’t deleted. Because if the episode before is deleted, then Plex no longer recognizes the new episode as onDeck and it may be deleted.
@ngovil21 said:
It is actually the episode just before the onDeck episode that isn’t deleted. Because if the episode before is deleted, then Plex no longer recognizes the new episode as onDeck and it may be deleted.
Thanks, that’s what I thought. I just found it odd that I could find nothing, or no one anywhere, questioning that line of help in the file. It took me a little while to figure out why that last watched show wasn’t getting deleted… ![]()
Thanks again!!!
First of all, great plug-in. Makes the whole Plex experience complete.
I have a few questions:
From the log:
Insurgent | Viewed: 1 | Days Since Viewed: 312 | On Deck: True
It was removed, why? It wasn’t viewed, it’s on deck (for a long time tbh). ( “default_onDeck”: true, )
If a movie is watched, then set to unwatched then on deck for a few weeks, does the script removes it?
if it is viewed once, but set to unwatched after that, does it count as Viewed, and it will be removed?
my other question:
I have a local admin user, and a remote shared user.
can use a common script for both, or i need to run two different scripts. one for my libraries, and one for the remote account?
thank you!
if it is viewed once, but set to unwatched after that, does it count as Viewed, and it will be removed?
No, it always queries the Plex Server for the status of a movie or show and the Plex Server report the status of unwatched for anything that have been set to unwatched. That is if you have not enabled the user support in script, if it’s enabled the Plex Server will report the status for that user only without caring for the rest.
Is it possible to set up this script with a local AND a shared user?
in case of library1-2-3 it should use the local(admin user) watched status
in case of library 4-5-6 it should use the shared users’s watch status
bonus points. if in library 1-2-3 there is an item on deck for the second(shared) user, it shouldn’t delete it.
can this be done with a single script?
as far as i understand, i can set this up via 2 scripts, one configured for user A and section 1-3, and a different script configured for user B and section 4-6. But than there is nothing common between the two, cant check multiple watch statuses on a library which is used by both.
I don’t want to use plex home, they are seperate accounts/users
I have just pushed a new update to the master branch. You are now optionally specify a dict for your tokens, it will look like this in the config file:
"Token": {
"admin*": "ADMIN_TOKEN",
"user1": "TOKEN_1",
"user2": "TOKEN_2"
},
The admin token that is used to manage files must be specified, ending with a *. You can just make it * if you want.
They name specified for tokens can then be used in the homeUsers section. Using this method will replace the getting home user tokens, so if you still want to check home users you will need to get their tokens manually and specify them in the Token setting.
You will need to ask users to provide you with their tokens, the easiest way I have found in Firefox is to go to https://app.plex.tv/desktop and login to the account. When the media shows make sure you are on the server you want the token for, press Ctrl + Shift + i, a box will popup, go to the Storage tab and on the left choose the Local Storage option and choose https://app.plex.tv. The token will be displayed in the table next to myPlexAccessToken.
The page will look like this, the token is highlighted:
@LSL1337 You can use this to check Shared Users as well. Checking watch status cannot be configured by library but can be configured by show or Profiles. You can set a profile and then tag those shows or movies in Plex in a Collection. The script will then use the settings in the Profile to check the media and you can specify your Shared User in the homeUsers section. Hope that works with your use case.
This is a more advanced configuration. Whenever changing the config file please make sure to run the script with --test to make sure everything is running as you want.
As an additional update there is a Dockerized version of the script, thanks to NitriKx , you can find here:
I’m excited that you added shared users support! Some shows only my shared users watch so it will be nice to have the episodes deleted after they watch them, otherwise I have no way of knowing.
I updated Cleaner.conf via the --update_config argument, however I do not see the new “Token” section as mentioned above. Out of curiosity I ran PlexCleaner --test and it states at the end “[Error] Do not have token for movieghoul. Please check spelling or token”
I’m guessing this is because the original config setup still shows my token under the line “Token”, correct?
BTW, my cleaner.conf shows Version 2.0 at the bottom.
@MovieGhoul said:
I’m excited that you added shared users support! Some shows only my shared users watch so it will be nice to have the episodes deleted after they watch them, otherwise I have no way of knowing.I updated Cleaner.conf via the --update_config argument, however I do not see the new “Token” section as mentioned above. Out of curiosity I ran PlexCleaner --test and it states at the end “[Error] Do not have token for movieghoul. Please check spelling or token”
I’m guessing this is because the original config setup still shows my token under the line “Token”, correct?
BTW, my cleaner.conf shows Version 2.0 at the bottom.
Ok, I was able to get it working. Apparently my token has changed. I also had to add the token twice, once for the admin* account and the my actual username account. Will test shared user account as soon as I can get the token.
@MovieGhoul said:
@MovieGhoul said:
I’m excited that you added shared users support! Some shows only my shared users watch so it will be nice to have the episodes deleted after they watch them, otherwise I have no way of knowing.I updated Cleaner.conf via the --update_config argument, however I do not see the new “Token” section as mentioned above. Out of curiosity I ran PlexCleaner --test and it states at the end “[Error] Do not have token for movieghoul. Please check spelling or token”
I’m guessing this is because the original config setup still shows my token under the line “Token”, correct?
BTW, my cleaner.conf shows Version 2.0 at the bottom.Ok, I was able to get it working. Apparently my token has changed. I also had to add the token twice, once for the admin* account and the my actual username account. Will test shared user account as soon as I can get the token.
Glad it is working. You do not need to add the token twice. Just replace your username in the homeUsers section to whatever admin* is named in the Token dict (you must include the *). If you use the manual token dict, Plex Home Users are no longer loaded.
Hi @ngovil21 sorry but i’m not english speaker so i have a hard time to understand some options, can you go
through settings with me?
So, my first wish was to install pms on server, and to watch this server on two smart tv’s…i will be using main account and my mother will be using friend account (i don’t have plex pass), but problem was that with this way i can’t restrict myself from seeing her libraries, so her movies will show up on my dashboard (like recently added) and my dashboard will be cluttered with her content…and i didn’t want to turn off “include on dashboard” on her libraries, because she will lost “continue watching” on main screen… so i decided to make me a new plex account and to join my mother as friend to main plex account… but then i lost ability to delete content from my smart tv (friends can’t delete content in plex)…so i found your script… luckily… so for this to work i need to change?
“test”: True, - is this options must be all the time True, or only when testing to see if everything is ok
“SectionList”: [3,5,6], - i want to use plex-cleaner on 3 libraries, two mine, and one from my mother
“trigger_rescan”: false, - what this options do? if plex-cleaner delete movie file from hdd, will this movie be deleted from plex library also, or i must delete that entry manually?
“Token”: {
“server*”: “123456789etcetc”, - main account
“Ben”: “987654321etcetc”, - friend 1
“Jane”: “2468642etcetc” - friend 2
},
“Shared”: true,
“DeviceName”: “”, - for this options it says - To help map the server for Shared users, you can specify the server friendly name
or machine identifier. but i don’t know what this mean? do i must write here my server name?
“default_action”: “delete”,
“default_watched”: true,
“default_minDays”: 7,
“similar_files”: true, - i want to delete sub-zero subtitles with files, subtitles naming are same, just with added country codes.
“cleanup_movie_folders”: true,
default_homeUsers = ‘’ # ‘Bob,Joe,Will’ - i will not using this option but can you write me what will look like if there are not users but friends, from example from above (Ben,Jane) if i change my mind and use it in future…
is this all i need to configure or i need more settings to change?
Thanks, and sorry for a long post…
I have included my answers in italics after your questions.
@boris9898989 said:
Hi @ngovil21 sorry but i’m not english speaker so i have a hard time to understand some options, can you go
through settings with me?
So, my first wish was to install pms on server, and to watch this server on two smart tv’s…i will be using main account and my mother will be using friend account (i don’t have plex pass), but problem was that with this way i can’t restrict myself from seeing her libraries, so her movies will show up on my dashboard (like recently added) and my dashboard will be cluttered with her content…and i didn’t want to turn off “include on dashboard” on her libraries, because she will lost “continue watching” on main screen… so i decided to make me a new plex account and to join my mother as friend to main plex account… but then i lost ability to delete content from my smart tv (friends can’t delete content in plex)…so i found your script… luckily… so for this to work i need to change?
I’m not sure what your setup is. Correct me if I’m wrong. You have one PMS server, and 2 smart TVs. Smart TV 1 is connected to your account and can delete files, and Smart TV 2 is logged into your mom’s account and cannot delete files. You also have 3 libraries on your PMS, 2 Libraries have your content and 1 library has content for your mom. If that is the case, you will need to run 2 scripts. One script that will have your token in it and will scan your 2 library sections. And one script that has your mom’s token and only scans here library section. Alternatively you can define “Profiles” in the script with different “homeUsers” options, but that will require you to manually tag movies into collections.
The config below will probably need to be changed, but I’m providing my comments.
“test”: True, - is this options must be all the time True, or only when testing to see if everything is ok
Only True while testing to see if everything is ok
“SectionList”: [3,5,6], - i want to use plex-cleaner on 3 libraries, two mine, and one from my mother
“trigger_rescan”: false, - what this options do? if plex-cleaner delete movie file from hdd, will this movie be deleted from plex library also, or i must delete that entry manually?
This will trigger the Plex Server to rescan the library after cleaning. Plex will remove the file from its library, otherwise the file will show up as unavailable until the next time the Plex Library is updated.
“Token”: {
“server*”: “123456789etcetc”, - main account
“Ben”: “987654321etcetc”, - friend 1
“Jane”: “2468642etcetc” - friend 2
},
You will probably want to separate tokens into separate scripts for each Library section.
“Shared”: true,
Keep false, this is only if the main user is a shared user
“DeviceName”: “”, - for this options it says - To help map the server for Shared users, you can specify the server friendly name
or machine identifier. but i don’t know what this mean? do i must write here my server name?
Again do not use this option.
“default_action”: “delete”,
“default_watched”: true,
“default_minDays”: 7,
“similar_files”: true, - i want to delete sub-zero subtitles with files, subtitles naming are same, just with added country codes.
“cleanup_movie_folders”: true,
default_homeUsers = ‘’ # ‘Bob,Joe,Will’ - i will not using this option but can you write me what will look like if there are not users but friends, from example from above (Ben,Jane) if i change my mind and use it in future…
You would use the names specified above (server*, Ben, Jane). All users in this list would be checked and the media file deleted when all the users in this list have watched the movie. You can also set this option to “any” and if one user has watched the file and satisfied the other conditions, the file will be deleted. By default only the “*” account status will be checked for watch status
is this all i need to configure or i need more settings to change?
Thanks, and sorry for a long post…
You can refer to the Wiki for more explanation on some settings: Home · ngovil21/Plex-Cleaner Wiki · GitHub
@ngovil21 thanks for your help… i didn’t explained really well… me and my mother will be both friends to the main account, so we can have separate libraries…
ok i will run two scripts… so to do this, i need to copy your scripts files in two separate folders and configure each .conf files for different friend? or i must do this differently? Thanks
Edit: you said for this option “Shared”: true, — Keep false, this is only if the main user is a shared user
but both scripts will have friends credentials… i will not use my main account for this script
you wrote on wiki — “Shared = False: Is this a shared account on the server? Shared accounts won’t have delete privileges through Plex”
and when i google “shared account plex”
i get this article that talks about friends ---- https://support.plex.tv/articles/201105738-create-a-new-share/
-------------------- Edit2: i’m getting this error everytime, i only changed few simple options
root@DietPi:/home/dietpi/Plex-Cleaner-master# python PlexCleaner.py --test
Loading config file: /home/dietpi/Plex-Cleaner-master/Cleaner.conf
Traceback (most recent call last):
File “PlexCleaner.py”, line 1054, in
options = json.loads(opt_string)
File “/usr/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded ----------------------
Edit3: so i solved this by creating new config file with python PlexCleaner.py --config /Cleaner.conf and edit it with nano…now it’s working…previously edited conf file with notepad++ on windows… what was the error, can you tell me?
Edit4: is it normal that i need to type --config /home/cleaner/Cleaner.conf every time if Cleaner.conf is in the same directory as PlexCleaner.py i thought that this command is just when conf file is in another folder?
What is the difference between
“default_minDays”: 0, and
“default_maxDays”: 60, what is maxDays used for if file will be deleted after 0 days like minDays is saying…What will happen after 60 days?
That’s all hopefully from me, please don’t mind for this many questions… i really like your script…
You said:
“You will probably want to separate tokens into separate scripts for each Library section.”
I’m using it via docker.
I have a similiar situation.
so if i want to delete stuff based on two different (admin and remote shared user), than i should write two scripts?
how would that work work with docker?
why do i need 2 scripts?
can’t i specify the admin and shared user, and set it up for each library, in case of librarary1 check admin watched status, in case library 2 check shared user watched status, in case of library 3 check watch status for both users.
is my ‘logic’ right?
@boris9898989 Ok so you are running the script with shared user credentials, but the script is being run on the same machine as PMS correct? If you are using Shared Users then yes you should have Shared: True You should run two scripts if you need to manage different sections differently. If there is one section for your mom and one section for you.
Edit 2: It looks like Windows messed up the formatting of the Config file. Using nano works better. If you use Notepad++ make sure you save as a Unicode encoding and don’t use a Windows format.
Edit 3: The script should look in the script directory for the config file, but this may vary depending on the OS.
Edit 4: max_days is used if you have the option episodes set. Plex_Cleaner will not delete episodes if there is less than episodes of the show in the library, but will if the file has been there longer than max_days. max_days should always be greater than min_days
@LSL1337 With docker you should mount the config folder to a volume on your local drive. After you run the script it will create a Cleaner.conf file for you that you can edit. The script does not allow you to create settings per library. It allows you to create settings by movie, show or collection tags. So if you want to have different settings for each section, then you will need to run the script with different config files where each config file scans a different section.
Wanted some clarification on using shared users. If I want SharedUserA to be applied to only ShowA, could I do it like this?
“ShowA”: {
“homeUsers: SharedUserA”
“maxDays”: 5,
“minDays”: 5,
“action”: “delete”,
“watched”: true
Edit: I attempted setting it up via Profiles as you stated above. However, it does not acknowledge that the show has been watched by the user. I do see the shared username pop up “SharedUserA has not seen video #####”. This comes up for a couple dozen lines with different numbers.
@MovieGhoul said:
Wanted some clarification on using shared users. If I want SharedUserA to be applied to only ShowA, could I do it like this?“ShowA”: {
“homeUsers: SharedUserA”
“maxDays”: 5,
“minDays”: 5,
“action”: “delete”,
“watched”: true
Yes as long as SharedUserA is defined in Token, with their token. Also use all lower case for the keys in Token and in homeUsers. So “sharedusera”
@ngovil21 said:
@MovieGhoul said:
Wanted some clarification on using shared users. If I want SharedUserA to be applied to only ShowA, could I do it like this?“ShowA”: {
“homeUsers: SharedUserA”
“maxDays”: 5,
“minDays”: 5,
“action”: “delete”,
“watched”: trueYes as long as SharedUserA is defined in Token, with their token. Also use all lower case for the keys in Token and in homeUsers. So “sharedusera”
Thanks, the script runs and I see the sharedusera’s name mentioned in the logs. However, the show assigned to them shows as not watched (they are the only one that watch it). Checking PlexPy confirms they have watched several episodes.
So I’ve tried adding the shared user to delete episodes for 1 show they are currently watching that we do not. I’ve tried via the Profile method and Show method and neither one returns that the show has been watched. The last episode they watched of this show was 16 days ago. I made sure their Token and homeUser is in lower case (though my token and name isn’t).
I’m at a bit of a loss on what else to check to see why it isn’t working.