jpc82 16 Posted September 18, 2019 Share Posted September 18, 2019 Hi, I created a python script that will look for all watched content for a specific user. If the last played date is past the cut off date it will delete the file.I built this for myself and it works good enough for me, but I have only tested it on my system (ubuntu 18.04) with my server. So no guarantee it will work for everyone, and since it can delete files have a backup to be safe. By default it does not delete files until you modify the config file to be safer.It first lists all the files, then will list the files that will be deleted.On first run it will ask you some questions to generate the config file, or you can create it manuallyHere is the script if anyone else is interested in trying it out: https://github.com/clara-j/media_cleaner 6 1 Link to comment Share on other sites More sharing options...
jpc82 16 Posted September 18, 2019 Author Share Posted September 18, 2019 Kurosh asked for the ability to treat TV vs Movies different. For my use case I don't care and delete all files the same. But I will try to add the ability to configure if you want Episodes, Movies or Videos to be deleted or ignored. 1 Link to comment Share on other sites More sharing options...
jpc82 16 Posted September 19, 2019 Author Share Posted September 19, 2019 I have pushed the new version. Config file will need to be re-generated. You can now have the following three options video_action='delete'movie_action='delete'episode_action='delete' Anything other then delete will ignore that content type. 1 Link to comment Share on other sites More sharing options...
Luke 37023 Posted September 19, 2019 Share Posted September 19, 2019 Cool, thanks for sharing. Link to comment Share on other sites More sharing options...
mastrmind11 717 Posted September 19, 2019 Share Posted September 19, 2019 @@Luke, what is the timeframe to get something like this bundled w/ Emby? I know it's been a FR for quite some time (2 years now?). The ability to remove watched episodes at the series level is the most basic DVR feature out there. Link to comment Share on other sites More sharing options...
Luke 37023 Posted September 19, 2019 Share Posted September 19, 2019 This exact script isn't getting bundled. We would just do our feature for it. Link to comment Share on other sites More sharing options...
Kurosh 16 Posted September 24, 2019 Share Posted September 24, 2019 I have pushed the new version. Config file will need to be re-generated. You can now have the following three options video_action='delete' movie_action='delete' episode_action='delete' Anything other then delete will ignore that content type. Thanks for this, so "movie_action" = movies and "episode_action" = TV shows. Therefore what is "video_action"? Link to comment Share on other sites More sharing options...
Kurosh 16 Posted September 24, 2019 Share Posted September 24, 2019 (edited) This exact script isn't getting bundled. We would just do our feature for it. Any idea on a timeframe for this feature though? The feature was initially requested in June 2014 Edited September 24, 2019 by Kurosh Link to comment Share on other sites More sharing options...
Luke 37023 Posted September 24, 2019 Share Posted September 24, 2019 Not yet, sorry. Link to comment Share on other sites More sharing options...
jpc82 16 Posted September 25, 2019 Author Share Posted September 25, 2019 Thanks for this, so "movie_action" = movies and "episode_action" = TV shows. Therefore what is "video_action"? video is for things in the home video or other video category. I use that for random videos I download off the internet like youtube videos where I don't have metadata for. Link to comment Share on other sites More sharing options...
jpc82 16 Posted October 27, 2019 Author Share Posted October 27, 2019 I have pushed a couple of new updates. Some users were getting error depending on the results their servers were returning. That should all be fixed now, if anyone is still getting errors let me know. I also added a new option to ignore favorite files so they don't get deleted. Link to comment Share on other sites More sharing options...
anian 0 Posted November 4, 2019 Share Posted November 4, 2019 Hello. May you add an option to exclude some libraries. Like classic movie that I download to left for all times. Link to comment Share on other sites More sharing options...
Michael Poulsen 4 Posted November 15, 2019 Share Posted November 15, 2019 excactly what i have been looking for, but it trows me this error in debian stretch (openmediavault) i have both python 2.7 ant python 3 an have tried running with python3 command (Anyone that can help me) Traceback (most recent call last): File "./media_cleaner.py", line 154, in <module> import media_cleaner_config as cfg ImportError: No module named 'media_cleaner_config' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./media_cleaner.py", line 162, in <module> except (AttributeError, ModuleNotFoundError): NameError: name 'ModuleNotFoundError' is not defined Link to comment Share on other sites More sharing options...
jpc82 16 Posted November 16, 2019 Author Share Posted November 16, 2019 Can you try downloading the latest version from git and trying again. I can't seem to re-create this issue. Also, can you let me know what version of python3 you are using with the following: python3 --version Link to comment Share on other sites More sharing options...
Michael Poulsen 4 Posted November 17, 2019 Share Posted November 17, 2019 python 3.5.3 Link to comment Share on other sites More sharing options...
Michael Poulsen 4 Posted November 17, 2019 Share Posted November 17, 2019 python 3.5.3 this is the exact error python3 /srv/dev-disk-by-label-Data/Scripts/media_cleaner.py Traceback (most recent call last): File "/srv/dev-disk-by-label-Data/Scripts/media_cleaner.py", line 154, in <module> import media_cleaner_config as cfg ImportError: No module named 'media_cleaner_config' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/dev-disk-by-label-Data/Scripts/media_cleaner.py", line 162, in <module> except (AttributeError, ModuleNotFoundError): NameError: name 'ModuleNotFoundError' is not defined Link to comment Share on other sites More sharing options...
Michael Poulsen 4 Posted November 17, 2019 Share Posted November 17, 2019 maybe because i have both python 3 and python 2.7, but have many other things that require 2.7 Link to comment Share on other sites More sharing options...
Crowley_00 1 Posted November 18, 2019 Share Posted November 18, 2019 Thank you for this, just what I needed. One thing I think would be useful is logging to a file with an indicator how many days ago a file was watched. The current date format in the output when running the script is kind of hard to read. Link to comment Share on other sites More sharing options...
jpc82 16 Posted November 19, 2019 Author Share Posted November 19, 2019 @@Michael sorry but I can't seem to re-create the issue your having. Are you using Windows, Linux or Mac? @@Crowley_00 I can look into creating a log file. So your looking for a log file that just appends the file name, date watched for any file deleted. I assume you would want the log file to append between runs. Link to comment Share on other sites More sharing options...
Crowley_00 1 Posted November 19, 2019 Share Posted November 19, 2019 (edited) I like to automate everything and logs help me check what the scripts have been doing. I think it would be useful to list all the watched files, and separate deleted. Something like: Time ran Watched: Series X S01E01 (7 days ago) Series X S01E02 (6 days ago) Series X S01E03 (5 days ago) Deleted: Series X S01E01 (7 day setting in the config file) Append would be fine, I could always delete the log if it gets too big. So pretty similar what the script outputs now but a little easier to read. Right now it does not seem to show series name and the date format could be simpler. But this is all just wishful thinking, the script is working fine for me as is. Thanks again! Edited November 19, 2019 by Crowley_00 Link to comment Share on other sites More sharing options...
jpc82 16 Posted November 19, 2019 Author Share Posted November 19, 2019 Ok, so your not looking for a actual log from what your saying. Your looking for better/cleaner output. Let me work on that first. This version still has a fair bit of debug info just as part of my testing. I can move that into the actual debug option so it is better to view for normal runs. Link to comment Share on other sites More sharing options...
Crowley_00 1 Posted November 19, 2019 Share Posted November 19, 2019 Sounds good, thanks! Link to comment Share on other sites More sharing options...
jpc82 16 Posted November 20, 2019 Author Share Posted November 20, 2019 Here is what I have working right now for a cleaned up output. Let me know if this is more what you are looking for: <VIDEO NAME> (<VIDEO TYPE>) Last Played: 10/23/2019 Days ago: 28 Favorite: Yes Result: Keep <VIDEO NAME> (<VIDEO TYPE>) Last Played: 11/15/2019 Days ago: 5 Favorite: No Result: Keep <VIDEO NAME> (<VIDEO TYPE>) Last Played: 11/07/2019 Days ago: 13 Favorite: No Result: Delete Items to be deleted - <VIDEO NAME> - 11/07/2019 (Days ago 13) 1 Link to comment Share on other sites More sharing options...
Crowley_00 1 Posted November 21, 2019 Share Posted November 21, 2019 Looks good to me. Thank you again for your trouble. Link to comment Share on other sites More sharing options...
Michael Poulsen 4 Posted November 27, 2019 Share Posted November 27, 2019 @@Michael sorry but I can't seem to re-create the issue your having. Are you using Windows, Linux or Mac? @@Crowley_00 I can look into creating a log file. So your looking for a log file that just appends the file name, date watched for any file deleted. I assume you would want the log file to append between runs. im using debian stretch and still same error Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now