terrelsa13 / MUMC

Multi-User Media Cleaner aka MUMC (pronounced Mew-Mick) will go through movies, tv episodes, audio tracks, and audiobooks in your Emby/Jellyfin libraries deleting media items you no longer want.
GNU General Public License v3.0
98 stars 6 forks source link

Add new setting for keeping n watched episodes #30

Closed listy-bit closed 2 years ago

listy-bit commented 2 years ago

Problem

When using Jellyfin for Kodi, the addon defers to Kodi's library internals for its "Next Up" widget. This differs from main Jellyfin in that there must be at least one watched episode in the library in order for a Next episode to be listed, or for the show to be listed in "In Progress Shows".

Solution

Add an option to keep n number of watched episodes of a show, so that Kodi will display the next unwatched episode in the widget.

EG:

Setting Keep watched episode(s): 1

Before run:

s01e01 (w)
s01e02 (w)
s01e03

After run:

s01e02 (w)
s01e03
terrelsa13 commented 2 years ago

Hey @listy-bit

This is already a feature (#15). Please verify you are using the latest.

I suggest using the MUMC_v3-beta branch. The MUMC_v2 trunk will be obsoleting in a few weeks.

Either way, the same configuration option exists in both: minimum_number_episodes=#

listy-bit commented 2 years ago

That feature is subtly different, and doesn't solve this specific issue. The difference is that the existing minimum_number_episodes=2 sets the minimum total episode count which includes unwatched episodes. so if you have 2 unwatched episodes and 1 watched, the script deletes the watched episode because there are 2 unwatched, leaving 2 episodes total. That causes Kodi to forget the show for the purposes of "In Progress" and "Next Up".

We need at least one watched episode at all times to keep Next Up functional using Jellyfin for Kodi, so it'd be helpful to have some setting for keep_watched_episodes=#, which would keep an additional watched episode if the minimum_number_episodes=# is satisfied completely by unwatched episodes, but contribute to the total if it isn't.

terrelsa13 commented 2 years ago

What you have described is not how the minimum_number_episodes option is setup to work. The option takes into account watched and unwatched episodes. If the number of unwatched is >= what minimum_number_episodes is set to, all watched are deleted and unwatched remain.

If the number of unwatched is < what minimum_number_episodes number is set to then the difference is taken to figure out how many watched need to remain to meet the minimum_number_episodes.

Example#1

If minimum_number_episodes=2:

s1e8 is deleted. Both s1e9 and s2e1 remain.

Example#2

If minimum_number_episodes=2:

s1e8 is deleted. Both s1e9 and s2e1 remain.

If it is not working as described please send me pastebin links of your configuration and a pastebin of the complete output.

listy-bit commented 2 years ago

If the number of unwatched is >= what minimum_number_episodes is set to, all watched are deleted and unwatched remain.

This is exactly the problem. Because all watched are deleted, this breaks Jellyfin for Kodi's Next Up feature, which needs a watched episode present to populate the list. If there are no watched episodes of a show, it doesn't appear in Next Up or In Progress Shows.

The way to solve this issue is for a setting to make the script check if number of unwatched >= minimum_number_episodes and if so, keep an additional unwatched episode, and operate as usual on any others.

terrelsa13 commented 2 years ago

Ahh ok ok, I misunderstood the original request. We don't just need a minimum number of episodes it has to be a minimum number of watched episodes. Thanks for helping me understand this! I will update the script so it leaves the desired number of watched episodes.

Just to verify I understand the request this time around; this is the behavior we want?

Example#1

If minimum_number_episodes=2:

s1e8 is deleted. Both s1e9 and s2e1 remain.

Example#2

If minimum_number_episodes=2:

s1e8, s1e9 and s2e1 all remain.

listy-bit commented 2 years ago

Yes, thats the correct behaviour to keep the show "alive" in Kodi. Thanks.

However, it would also need to do this:

If minimum_number_episodes=2:

s1e8 - watched s1e9 - watched

e8 deleted, e9 remain

so perhaps it isn't a minimum setting but rather keep_watched_episodes=1

terrelsa13 commented 2 years ago

@listy-bit I have not forgotten about this feature. Once I get time to do it, I will let you know.

terrelsa13 commented 2 years ago

@listy-bit This feature is in the v3 Beta Branch.

Check out the minimum_number_played_episodes and minimum_number_episodes_behavior configuration options.