Closed washedszn closed 4 months ago
Neat idea. When I get a moment. I'll look into this.
~Want me to fix the merge conflicts? Looks pretty simple - just caused by the new tags variables, from the allow ignore tags feature~ Found a bug so I fixed that as well as the conflicts
It's been a whirlwind weekend, I haven't had a chance to look this over, glad to see you found issues and fixed them.
No problem! Take your time. It's a pretty difficult script to refactor once knowing it'll all work, as I'm using it I'm discovering issues/improvements. I believe there's an efficiency improvement that can be done, taking a look at that today
I was wrong... Did realise I hadn't updated a docstring though
So couple things to look into
season_monitored_threshold
is not w/in the YML file as to not break people's configs who don't have it within their config filesAll in all I like the implementation. Sorry I don't have time to fully read over the code 100% I skimmed through it while I'm sitting in my car at my kids evening events.
I'm always up for code improvements and refactors that make the code make more sense as well as better documentation (I'm not a coder by trade and this is 100% self taught..)
The default value for season_monitored_threshold
is 0, which means that the default behaviour when users don't set the variable is the same as before this feature was added - minus how the script performs searches: Prior to the implementation, the script would send a search request to sonarr for a series, letting sonarr handle searching everything within it, whereas now the script will search specific seasons (search season 1, wait, search season 2, wait etc).
I'll update the sample config, wasn't really sure where to document this till now.
Please don't be sorry! It's my first time contributing code to an open source, so it's quite fun and I have a bunch of time on my hands at the moment.
Description
This PR refactors the searching logic within Upgradinatorr to allow for improved series searching, which reduces the number of potential hits upgradinatorr triggers. It does this by introducing a new config parameter for the sonarr instance called
season_monitored_threshold
. This threshold is then used to make a decision during media filteration, whereby if the percentage of episodes monitored within a season is less than the threshold, upgradinator will then mark the season as unmonitored, resulting in no search request being sent to sonarr for that season. The media processing has been updated to support these changes.Example
season_monitored_threshold
set to 0.92/8 = 25% of episodes within this season are monitored. Therefore, since 0.25 is less than our threshold of 0.9, upgradinator will not request a search.
Debug logs for the above example (has some improved logging missing from it): notifiarr log link
Reason
I don't want season packs to be grabbed when I have already started watching a season, which results in unnecessary download usage. Was curious about how searches are handled on sonarrs end of things and it seems like a pack could be grabbed despite episodes being unmonitored, so I looked into implementing a solution within upgradinatorr. Managed to get my desired results, whilst maintaining all existing functionality.
If you want to read more about the sonarr side of this, I asked in their support discord here.
Development
Thought I'd explain how I went about contributing to your repo. After cloning the fork, I setup radarr and sonarr on my local machine so I could test the upgradinatorr script with a small library with no indexers. Once I was sure about my implementation, I added it to my server and tested it on there with my main library with all my indexers. The implementation is working as expected and I'll continue to use the fork on my server, so I'll continue to test it myself.
Config I tested with:
Also one last note, I was really stumped as to what the best name of the new argument should be, I'm still not really happy with
season_monitored_threshold
. Feel free to make a request/suggestion on renaming it.