From 2831f4146b5f7f51e1999aabbc2a57aadb35efbb Mon Sep 17 00:00:00 2001 From: "bossanova808@gmail.com" Date: Mon, 6 Oct 2025 22:37:11 +1100 Subject: [PATCH 1/4] Also filter out watched non db items --- resources/lib/playback.py | 16 +++++++++++++--- resources/lib/store.py | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index b295509..4b60551 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -8,7 +8,7 @@ import xbmcvfs # noinspection PyPackages -from bossanova808.utilities import clean_art_url, send_kodi_json, get_resume_point, get_playcount +from bossanova808.utilities import clean_art_url, send_kodi_json, get_resume_point, get_playcount, get_advancedsetting # noinspection PyPackages from bossanova808.logger import Logger # noinspection PyUnresolvedReferences @@ -391,12 +391,22 @@ def load_or_init(self) -> None: if self.remove_watched_playbacks: paths_to_remove = [] for item in list(self.list): + # BD item? Is it marked as watched in the DB? if item.dbid: - # Is it marked as watched in the DB? playcount = get_playcount(item.type, item.dbid) if playcount and playcount > 0: list_needs_save = True - Logger.debug(f"Filtering watched playback from the list: [{item.pluginlabel}]") + Logger.debug(f"Filtering watched playback from the list (as playcount > 0 in Kodi DB): [{item.pluginlabel}]") + paths_to_remove.append(item.path) + + # Not a DB item, use a calculation instead and compare to the playcount_minium_percent + elif item.resumetime and item.totaltime: + percent_played = (item.resumetime / item.totaltime) * 100 + # Use the user set playcount_minium_percent if there is one, or fallback to Kodi default 90 percent + playcount_minium_percent = float(get_advancedsetting('video/playcountminimumpercent')) or 90.0 + if percent_played >= playcount_minium_percent: + list_needs_save = True + Logger.debug(f"Filtering watched playback from the list (as {percent_played:.1f}% played is over playcount_minium_percent {playcount_minium_percent}%: [{item.pluginlabel}]") paths_to_remove.append(item.path) if paths_to_remove: diff --git a/resources/lib/store.py b/resources/lib/store.py index 1402b34..794b552 100644 --- a/resources/lib/store.py +++ b/resources/lib/store.py @@ -4,7 +4,7 @@ from bossanova808.constants import HOME_WINDOW, PROFILE, ADDON from bossanova808.logger import Logger -from bossanova808.utilities import get_kodi_setting, set_property, clear_property +from bossanova808.utilities import get_kodi_setting, set_property, clear_property, get_advancedsetting from resources.lib.playback import PlaybackList From 05a80b967bc85a10ae5eac18127133c620c41202 Mon Sep 17 00:00:00 2001 From: "bossanova808@gmail.com" Date: Tue, 7 Oct 2025 08:09:57 +1100 Subject: [PATCH 2/4] Update playback.py --- resources/lib/playback.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index 4b60551..ca0a855 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -403,10 +403,11 @@ def load_or_init(self) -> None: elif item.resumetime and item.totaltime: percent_played = (item.resumetime / item.totaltime) * 100 # Use the user set playcount_minium_percent if there is one, or fallback to Kodi default 90 percent - playcount_minium_percent = float(get_advancedsetting('video/playcountminimumpercent')) or 90.0 + setting = float(get_advancedsetting('video/playcountminimumpercent')) or None + playcount_minium_percent = float(setting) if setting else 90.0 if percent_played >= playcount_minium_percent: list_needs_save = True - Logger.debug(f"Filtering watched playback from the list (as {percent_played:.1f}% played is over playcount_minium_percent {playcount_minium_percent}%: [{item.pluginlabel}]") + Logger.debug(f"Filtering watched playback from the list (as {percent_played:.1f}% played over playcount_minium_percent {playcount_minium_percent}%: [{item.pluginlabel}]") paths_to_remove.append(item.path) if paths_to_remove: From d3a9bf0d51c54b3bdb27cb0c66dc93ed0c1e80ab Mon Sep 17 00:00:00 2001 From: "bossanova808@gmail.com" Date: Tue, 7 Oct 2025 08:16:26 +1100 Subject: [PATCH 3/4] Update playback.py --- resources/lib/playback.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index ca0a855..026c7ef 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -391,7 +391,7 @@ def load_or_init(self) -> None: if self.remove_watched_playbacks: paths_to_remove = [] for item in list(self.list): - # BD item? Is it marked as watched in the DB? + # DB item? Is it marked as watched in the DB? if item.dbid: playcount = get_playcount(item.type, item.dbid) if playcount and playcount > 0: @@ -403,11 +403,11 @@ def load_or_init(self) -> None: elif item.resumetime and item.totaltime: percent_played = (item.resumetime / item.totaltime) * 100 # Use the user set playcount_minium_percent if there is one, or fallback to Kodi default 90 percent - setting = float(get_advancedsetting('video/playcountminimumpercent')) or None - playcount_minium_percent = float(setting) if setting else 90.0 + setting = get_advancedsetting('video/playcountminimumpercent') + playcount_minium_percent = float(setting) if setting and setting != 0 else 90.0 if percent_played >= playcount_minium_percent: list_needs_save = True - Logger.debug(f"Filtering watched playback from the list (as {percent_played:.1f}% played over playcount_minium_percent {playcount_minium_percent}%: [{item.pluginlabel}]") + Logger.debug(f"Filtering watched playback from the list (as {percent_played:.1f}% played over playcount_minium_percent {playcount_minium_percent}%): [{item.pluginlabel}]") paths_to_remove.append(item.path) if paths_to_remove: From 7d3ae6a1a97f27e53c191fea57974359aeb8a08f Mon Sep 17 00:00:00 2001 From: "bossanova808@gmail.com" Date: Tue, 7 Oct 2025 08:27:47 +1100 Subject: [PATCH 4/4] Update store.py --- resources/lib/store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/store.py b/resources/lib/store.py index 794b552..1402b34 100644 --- a/resources/lib/store.py +++ b/resources/lib/store.py @@ -4,7 +4,7 @@ from bossanova808.constants import HOME_WINDOW, PROFILE, ADDON from bossanova808.logger import Logger -from bossanova808.utilities import get_kodi_setting, set_property, clear_property, get_advancedsetting +from bossanova808.utilities import get_kodi_setting, set_property, clear_property from resources.lib.playback import PlaybackList