clara-j / media_cleaner

Python script to delete watched content on Emby
31 stars 17 forks source link

me again after more testing done #24

Closed elvis0288 closed 3 years ago

elvis0288 commented 3 years ago

Hello @terrelsa13 so i did what you told me and i created 2 different folders one for me and one for requested items.. now i found 2 new features/improvements that you might want to consider

  1. when scanning all library for the max age and you have mutliple users, you are scanning the whole library for each one of them. i guess this is correct becuase i am using the same library and because i do not have them separated am i right? i guess while writing this out i figured this is the right behavior in case they do not have the same libraries even though on this case it is just waste of resources becuase it is scanning the same thing over and over again

  2. is there a posibility to have the summary of deleted save into a txt file and record that with a date and time? image what is happening is that i will be running this on a job on the background so i am not able to see the summary of deleted but it would be nice to keep a history of what was deleted on a txt file so i can go back a day or 2 later and see what was deleted.

Thanks!

terrelsa13 commented 3 years ago

Hey @elvis0288 Glad running multiple instances of the script is working for you in the way you want it to.

  1. Yes, you got it. This is by design and what comes with wanting this script to handle multiple users. For instance, if two users have watched the same media item the script needs to check if none, either, or both have also set the media item as a favorite so it knows how to handle keeping or deleting the media item with multiple users involved. The more users involved, the more checking the script needs to perform. The more media items involved, the more checking the script needs to perform. The decision to keep or delete for both the "days since watched" and the "max age" option are determined for each episode in the same if statement. I agree this could be made more efficient. Luckily this is not a script that needs to execute in real-time and most users will set up some kind of cron-task in Linux or a job in Windows to execute this in the background during a time when the machines load is minimal. Because of this, if the script takes 1 second or if it takes 10mins to execute is irrelevant as long as it provides the desired end result.

  2. The script could do this, but I will not implement it. This is something the OS can handle when it is executing the script in the background. For example; the following is how to make a Debian/Ubuntu based machine send the standard output (aka everything seen on the screen) to a file when the script is executed using cron: 30 2 * * 1 /usr/local/bin/python3.8 /opt/media_cleaner/media_cleaner.py > /var/log/media_cleaner.log 2>&1 This tells crontab to run the script at 2:30am every Monday and save the output to a file called _mediacleaner.log in the /var/log/ directory. The date and time could also be appended to the log file name in the command above. Windows certainly has similar functionality.