Also, try changing your command to this (change paths to proper locations:)
echo “DATE: $(date)” > /volume1/scripts/troubleshooting.log
/usr/local/python/bin/python2.7 /volume1/scripts/plexautodelete.py >> /volume1/scripts/troubleshooting.log 2>&1
This should log the error that task scheduler is outputting when it attempts to run (to troubleshooting.log) Let me know what it logs
with your last command and user "root" works!!! At least write the log with all the output..
the function cleanup_movie_folder instead is executed only on section 2 How can I execute it also in tv show section?
PS: I modified this line
if cleanup_movie_folders:
cleanUpFolders(Section,minimum_folder_size)
because was
if cleanup_movie_folders:
cleanUpFolders(Section,30)
;)
Other question:
is it possible to refresh the plex library after execution of the AutoDelete script?
The Cleanupfolders only works on movie sections. What sort of folder naming scheme do you use for tv shows? Usually you don't need to delete folders for that. I just don't want the script to delete a path that might be used by another program.
I think you have an older version of the script. The minimum_folder_size issue has already been changed. Try checking out the latest version from git. There is an option to trigger rescans after changes have been made called trigger_rescan.
ah ok!
I don't know when I download tvshows torrents usually files are inside folders.. so in this way my TvShows dir is full of dir semi-empty :S
Hello, can someone help me please? I've got the script working perfectly, thanks to all involved! My problem is when running AutoDelete.py via Task Scheduler. I've set it all up and it executes the task fine (I think) except no log file is created. When I run the AutoDelete.py file manually a log file is created and I can see what's been deleted.
How can I fix this?
Thanks.
Hello, can someone help me please? I've got the script working perfectly, thanks to all involved! My problem is when running AutoDelete.py via Task Scheduler. I've set it all up and it executes the task fine (I think) except no log file is created. When I run the AutoDelete.py file manually a log file is created and I can see what's been deleted.
How can I fix this?
Thanks.
When you say AutoDelete.py are you using my version from GitHub or another older version of the script?
If using the version from GitHub, then please download the script again from GitHub. I made a change to look for the settings file in the script directory. You can then make a copy of the Cleaner.conf.default file and saved as Cleaner.conf. Then you can edit the Cleaner.conf file with your desired settings.
I'm using the one you linked a few pages.
PlexAutoDelete_1.1.py: https://dl.dropboxus...toDelete_1.1.py
Is the one from GitHub better?
Yes the GitHub Script is better and it will be the one I update from now on.
If you want to keep using the old script, I would try putting in an absolute path to the log file. On Windows it would start with something like C:\ and on a Linux or Mac it would start with a /. Then the file should be saved in that spot no matter which user runs the script.
Thanks, ngovil21.
I changed;
LogFile = "PlexAutoDelete.log"
to
LogFile = "C:\Python33\PlexAutoDelete.log"
and now it creates the log file when executed by Task Scheduler.
I will move to the GitHub one if I run into any more issues in the future.
Thanks again for all your work.
@ngovil21
is it possible to extend the Cleanupfolders to tv show dir? Or you just give to me indications on how to modify the script personally? thanks
Sure, I don't know a good way to add it in right now so I won't be putting it in the general script.
If you have checked out the script from git, then first make a copy of the git script as a new file and make the edits in that file. Otherwise if you try to update the script through git it will complain about changes. If you are handy with git then you could make your own branch, but that's more complicated.
At the end of the checkShow(show) method you would add these lines (just before return changes):
if cleanup_movie_folders:
log("Cleaning up orphaned folders less than " + str(minimum_folder_size) + "MB in Section " + Section)
cleanUpFolders(Section, minimum_folder_size)
Make sure the if statement has the same indent as the return statement (i.e. not in the for loop).
Here's the edit in a python file for you:
https://dl.dropboxusercontent.com/u/9141060/PlexCleanerMB.py
DISCLAIMER: This method will delete any folder and all subfolders that are less than the minimum size folder including Show folders and the Season folders. This may interfere with how you manage your media, which is why I am not putting it in the main script.
If you have an idea of how to do it then let me and I'll see if I can implement it.
Hi, I just found this script and this is exactly what I needed. I need to run this script with variables configs based on each users in my plex home. I am able to run it with my main plex account but when I run it with a friend's account it fails to load the sections. Is there anything special I need to do with users that I share libraries with? is it even supposed to work in that situation?
No I never really tried the script with a shared user and I just checked right now and it doesn't work. Sorry I don't have the time right now to investigate further. In theory it should work, but Plex has some extra authorization measures for shared users.
If someone wants to reverse engineer PlexWeb to get it to work, they can submit a pull request on GitHub and I will merge it. I think it will require the right set of headers for the request.
I was thinkimg on that if one user see the movie and the other not its not delated but if both see it it delated.
No I never really tried the script with a shared user and I just checked right now and it doesn't work. Sorry I don't have the time right now to investigate further. In theory it should work, but Plex has some extra authorization measures for shared users.
If someone wants to reverse engineer PlexWeb to get it to work, they can submit a pull request on GitHub and I will merge it. I think it will require the right set of headers for the request.
Thanks for the reply.
I would really like it to work for shared users, it would be perfect for my use of it.
Any chance you will have the time to work on it in the near future?
OK I figured out how Shared users work and I can post it now that the forums are back up. Updated on GitHub. If you are using the script on a Shared User, set the Shared User boolean to True and it will get the correct token. If you just want to set the Token, login as the Shared User on Plex.tv and go to https://plex.tv/api/resources to get the accessToken for the server you want to manage. You don’t need to use the Shared setting then.
Let me know if you find any bugs.
@ngovil21 said:
OK I figured out how Shared users work and I can post it now that the forums are back up. Updated on GitHub. If you are using the script on a Shared User, set the Shared User boolean to True and it will get the correct token. If you just want to set the Token, login as the Shared User on Plex.tv and go to https://plex.tv/api/resources to get the accessToken for the server you want to manage. You don’t need to use the Shared setting then.Let me know if you find any bugs.
You sir are my hero! I will get on this today and report back asap
I got a bit of time to try it with shared users. Here are my observations:
Firstly I need to mention that I am using Plex Home (not sure if this changes anything). I have added my friend’s account to my plex home and shared some libraries with him.
If I put my friend’s username/password and set the Shared flag to True I get: Access Token not found or not a shared account
If I put my friend’s username/password and set the Shared flag to False I will get a Token back (let’s call it token A) but it says HTTP Error 401: Unauthorized
So I did like you suggested, I logged in as my friend’s account on plex.tv and went to https://plex.tv/api/resources , I copied the AccessToken for the server (which is different from Token A). With that new Token it works, I am able to run the script as the shared user.
I have only ran the script in test mode so far, still need to configure it to my liking before I set it to run normally.
Thanks for the work, I will report back if i find anything
Ya I think I forgot to mention that you need to set the Host option to the server’s actual IP, the one that Plex sees. I’ll push out an update today that will use the Server name or machine identifier, or just default to the first server.
I’m guessing you’re going to run two instances of the script? One with your settings and one with the Shared user’s settings? Make sure you load separate config files for each user then. You can do that by passing the file using the -config parameter.
@eskwire trying to check watched status between multiple users will be quite an effort.