Closed elvis0288 closed 3 years ago
@elvis0288 I am not familiar with ombi. Let me know if I understand your request correctly... You are requesting the ability to configure multiple users with one instance of this script?
Example: User1 - Delete played tv shows after 10 days and played movies after 20 days; whitelist /some/path0,/some/path1,etc... User2 - Delete played tv shows after 15 days and played movies after 25 days; whitelist /some/path0,/some/path2,etc... User3 - Delete played tv shows after 20 days and played movies after 30 days; whitelist /some/path0,/some/path3,etc... UserX - blah, blah, blah...
Question:
Hello @terrelsa13 so Ombi is used for user to request movies or shows so the way i have it configure is that if i am not the one requesting the movies (which i usually dont as i use trakt list for me) then it will be save for all users into a ombi show/movies folder and that folder is also part of my jellyfin libraries but they are not the same library as mine
if you see on the picture i have my general movies and tv shows (the ones i select from my list) and then i have the ombi's tv shows and requested movies which is for all the users in my ombi network.. so whatever they request there it will go into those 2 libraries so what you are saying on the example is correct, so when i do the configuration the first time around, is it possible to do lets say
enter number of user to track: i do lets say 1 here then it shows enter number of library to whitelist: i choose the libraries then instead of just asking me to run the script again, it will ask me if i want to setup another user, of blank to skip then if i choose another user then i get the whitelist again and continue until i enter blank on the user...
then when i run the script i would be able to delete for my user first then check on the other users... in this case the other users will all be just looking into those ombi folders. i will be whitelisting my collections as their requests are not the same as mine and that way if they already watched i can clean it without asking them if they watched or not...
i guess in your example yes we could add days for movies/shows for each person to make it general but in my case i will do 180 for all my users including me
Thanks!
if we add the days for movies and tv shows on the beginning configuration would also be nice as that way we would not need to go into the config even though we will still need to just to remove the debug mode on
Ok, I follow so far. How are you handling movies/episodes that you watch and other users watch? For instance; if you and one of the Ombi users want to watch 'Titanic2 - Tropical Thunder' which folder does that movie go into?
There is also the complication of how to know when ALL users that INTEND on watching a movie/episode have watched the movie/episode. For instance; if UserOmbi0 watches Titanic2 the not_played_age_movie=180 day countdown starts. How will the script know if UserOmbi1 does or does not intend on watching Titanic2?
This gets even more complicated with more users and tv-series, seasons, and episodes. During setup the script would need to go thru every movie, tv-series, season, and episode and ask if each user intends on watching it in the future. If they do, their "isPlayed" state is tracked. If they do not, then their "isPlayed" state is ignored.
Now let's say we add a new movie to the ...Multimedia\Movies\Requested Movies\ folder; the script would need to be re-run for each user so it knows which users to track the isPlayed state for?
Let me know if I am way off base with what you are asking.
Generally adding multiple users to the "cleaning" of media libraries is messy. The only way I would consider doing this would be if emby/jellyfin required each user to have their own separate library folders.
How are you handling movies/episodes that you watch and other users watch? For instance; if you and one of the Ombi users want to watch 'Titanic2 - Tropical Thunder' which folder does that movie go into? R: so if i already have the movie in my personal folder then and they go into ombi, it will show the movie is already available so they cannot request it again and they can just go to my folder and watch it. if they request the movie first then i will know and i will be moving it to my folder so even if they watched it already it will not be deleted until i watch it.
There is also the complication of how to know when ALL users that INTEND on watching a movie/episode have watched the movie/episode. For instance; if UserOmbi0 watches Titanic2 the not_played_age_movie=180 day countdown starts. How will the script know if UserOmbi1 does or does not intend on watching Titanic2? R: i guess you are right on some extend so if ombi0 requested titanic and then ombi1 watched it it will be deleted before ombi0 actually watched it which i guess it is a mess. now they can always go back into ombi and request it again.
it would be nice but i guess more complex to use ombi api to see who requested the movie and if that person already watched the video then we delete it but that is out of the scope i guess..
what about instead of when it was watch we set a time period in which a movie will be available? so lets say ombi0 request titanic2 and nobody has watch it but it has been there for 1 year then we delete it but if it was watched and 180 days has passed then it will also be deleted.. if another user wants it then they can request it again on ombi.
what do you think?
Generally adding multiple users to the "cleaning" of media libraries is messy. The only way I would consider doing this would be if emby/jellyfin required each user to have their own separate library folders. R: i was thinking about doing this when i started this and it is an option but if ombiuser0 ask for it then ombiuser1 would not be able to request it and will not be able to watch it either because ombi does not currently do this by library/user.. just talked to them and they will do in a future update but for now they will not... i guess you could develop it that way then? i mean each user having its own separate library so ombi is ready for this we could use it..
in the meantime i was just thinking 1 not_played_age_movie for all users so it does not matter who watched it but it just matter somebody did and it has been more than that period of time on that requested library..
the additional option to have delete media if added is more than time would be a nice addition too.
what about instead of when it was watch we set a time period in which a movie will be available? Yeah, this is actually a good idea. I can see this being useful. I have no clue if emby/jellyfin store and send the date when a media item was added to the library? Sounds like something that should be there, but I would have to look. There is a catch though; the script currently only request media that has been played. For servers with very large libraries, requesting media which has not been played to apply a "max time period cutoff" will likely cause the script to run much slower. I will have to play around with this to see what it does to the scripts performance. It is likely not a huge issue, I assume almost everyone runs this script in some kind of task scheduler like Crontab. So even if it is slow or were to take a chunk of RAM/Processor power that could be mitigated by scheduling the script to run during off-peak hours. Ok, now that I am done thinking outloud... Should this max time period variable be a single value that applies to all media types? Or should each media type have its own max time period variable?
it would be nice but i guess more complex to use ombi api to see who requested the movie and if that person already watched the video then we delete it but that is out of the scope i guess.. I do not want to complicate this script by adding additional interactions with anything outside of the emby/jellyfin API. I want to keep it simple. Emby/Jellyfin will have to offer libraries on a per user basis in order for me to consider handling multiple users.
in the meantime i was just thinking 1 not_played_age_movie for all users so it does not matter who watched it but it just matter somebody did and it has been more than that period of time on that requested library.. This is doable. Script would need to allow picking multiple users to monitor. But it has much of the same catches the "max time period cutoff" has.
I will think about the best way to implement these and let you know when I have something for you to try out.
Jellyfin does store the date/time it was added as it is one of their filters when searching for movies/tv shows "date added" so you could get it from there. For servers with very large libraries, requesting media which has not been played to apply a "max time period cutoff" will likely cause the script to run much slower. R: i guess this is right but i guess it should not be a problem.
Should this max time period variable be a single value that applies to all media types? Or should each media type have its own max time period variable? R: i would say each one should have each own max time period as maybe i would keep movies longer than tv shows for sure. and even if it is the same time i guess having that there would be a nice to have feature.
I want to keep it simple. Emby/Jellyfin will have to offer libraries on a per user basis in order for me to consider handling multiple users. they do this already so i guess you could build this functionality.. it will still not work with my ombi but it will work for me to say that movies from user1 library will be the only one for user1.. i guess this would be better if we could select what libraries they we can search for delete rather than what libraries to whitelist... right now on jellyfin i could make user1 only see my main library and a custom library (i can select what libraries to see) so if i have a specific library just for user1 movies then those will be the movies i could delete..
This is doable. Script would need to allow picking multiple users to monitor. But it has much of the same catches the "max time period cutoff" has. R: this is fine i mean yes i would need to be able to pick multiple users but i would like to also be able to select what libraries to whitelist per user (it would be better to do which one not to whitelist) but the logic is there already for whitelist so that is ok with me
Thanks!
@elvis0288 I have added the ability to monitor multiple users.
When running the script for the first time, you will be allowed to select multiple emby/jellyfin user accounts.
Try this branch let me know if you have any feedback.
I will start working on implementing a max time period cutoff after this multiple user feature is finalized.
@elvis0288 Made additional updates to the branch link above to allow users to Blacklist or Whitelist media libraries.
Nice thank you I will test this tomorrow.. What are you working on next?
Have a few scripts I use at home I need to update. Plus this script has a handful of places with redundant code that could be cleaned up. Plus I am still trying to figure out the best way to implement this max time period cutoff feature.
@elvis0288 the above branch now has the ability to delete media items based on their age. BUT - BE CAREFUL WITH IT! It very much can delete your entire media center if not configured correctly.
For now the script uses the DateCreated metadata item. I have noticed this date is not always the date the media item was created on the server. Sometimes it is the date the media item aired publicly.
Example: If today the original Lion King (1994) is added to the media server. There is a possibility the movie will be added with a DateCreated metadata item of 1994-June-14th and not today's date. If the server has several items like this and the max_age_xyz configuration setting is set to a lower number of days; EVERYTHING matching this criteria WILL BE DELETED.
Extensive testing and verification with remove_files=0 should be done before setting remove_files=1. A backup of the media should be created to be extra safe. (I will say it again, this feature will potentially delete every media item. Use with CAUTION!!!)
I will keep trying to find another metadata option that consistently has the date the item was created on the server. Instead of the air date.
New settings were added to the configuration file. Probably easiest to rename the current config file. Run the script again. And let it create an updated config with all the new settings. You can then use the values in renamed config to finish creating the new config.
@terrelsa13 thank you for all your hard work i was thinking when looking at the new config that you should allow the option to delete the whole tv show if the max_age_episode is set to something other than -1. so for instance lets say i do max_age_episode=20 and "allowdeletingcompletetvshow" = 1 then you scan through the tv shows and find a game of throne episode that match those 20 days then instead of just deleting that episode, we delete the whole show..
what i think is lets say i download a tv show usually in order from season 1 episode 1 all the way to the last season but what happen if that s01e01 was downloaded 20 days ago and then season 4 was downloaded 10 days ago then we will be cleaning season 1 and we will not have that season to watch which will make no sense to start watching season 4 instead of season 1. this is why having this option if 1 episode from that tv show match the max_age_episode then the whole show should be deleted
@elvis0288 You are welcome.
what i think is lets say i download a tv show usually in order from season 1 episode 1 all the way to the last season but what happen if that s01e01 was downloaded 20 days ago and then season 4 was downloaded 10 days ago then we will be cleaning season 1 and we will not have that season to watch which will make no sense to start watching season 4 instead of season 1.
This is the normal behavior:
I would suggest: Config settings:
These settings will keep an episode (or entire season/series) if anyone has it set as a favorite. Then as soon as no one has it set as a favorite it will be deleted if it is older than max_age_episode.
Users will have to learn to use the favorite feature for shows they are watching. They should understand if they do not favorite a show they are watching it will be deleted after some amount of time. And vice versa they will have to learn to un-favorite shows they are no longer watching. They should understand if they fail to un-favorite shows it wastes hard drive space and they could end up causing a situation where no one can add a new show to the library because there is no more disk space.
that makes sense.. i guess that would be the best option for this case.. thank you
Hello me again, so i am sharing my jellyfin with my sisters and some friends and i was thinking about also deleting things that they have already watched but right now what i am doing is having different folders with different configurations and different users so i need to run each one of them to delete media for that particular user.
is there a way to put everything tgether? so on my setup, i have ombi and whatever users request there it will go into a ombi folder and that will be another media library on jellyfin, so i am whilisting everything except for tv shows and movies on the ombi folder for those users.. so if they watched already then i delete it.
it would be nice to configure this by user and then when running just 1 time the script it will do all that per user checking their whitelist and everything.. i guess it would need to be a whitelist per user and at the beginning of the config it should do something like the whitelist does in which you can select multiple users and after selecting the user then select the folders for that user
Thanks!