From 376ad9da73b20a797ac36f67697fcd68f35013f6 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 12 Aug 2024 13:35:32 -0400 Subject: [PATCH] Fixed #2186 `total_runtime` will now trigger an overlay update --- CHANGELOG | 1 + modules/overlay.py | 2 +- modules/overlays.py | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c7ba319c1..ce79a9f1d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -26,5 +26,6 @@ Fixes #2135 AniDB Builder type conversion error Fixed #2150; change xmen list to a new one Fixed #2169 Add handling for blank secrets Fixed #2176 `clean_bundles`, `optimize`, and `empty_trash` not working as global attributes +Fixed #2186 `total_runtime` will now trigger an overlay update Various other Minor Fixes diff --git a/modules/overlay.py b/modules/overlay.py index 9f8e62f47..30bfabe54 100644 --- a/modules/overlay.py +++ b/modules/overlay.py @@ -19,7 +19,7 @@ "anidb_rating", "anidb_average_rating", "anidb_score_rating", "mal_rating" ] float_vars = ["audience_rating", "critic_rating", "user_rating"] + rating_sources -int_vars = ["runtime", "season_number", "episode_number", "episode_count", "versions"] +int_vars = ["runtime", "total_runtime", "season_number", "episode_number", "episode_count", "versions"] date_vars = ["originally_available"] types_for_var = { "movie_show_season_episode_artist_album": ["runtime", "user_rating", "title"], diff --git a/modules/overlays.py b/modules/overlays.py index a0933b02c..b5bbb59d0 100644 --- a/modules/overlays.py +++ b/modules/overlays.py @@ -132,9 +132,14 @@ def trakt_ratings(): if properties[over_name].name.startswith("text"): for cache_key, cache_value in self.cache.query_overlay_special_text(item.ratingKey).items(): actual = plex.attribute_translation[cache_key] if cache_key in plex.attribute_translation else cache_key - if not hasattr(item, actual): - continue - real_value = getattr(item, actual) + if actual == "total_runtime": + sub_items = item.episodes() if current_overlay.level in ["show", "season"] else item.tracks() + sub_items = [ep.duration for ep in sub_items if hasattr(ep, "duration") and ep.duration] + real_value = sum(sub_items) + else: + if not hasattr(item, actual): + continue + real_value = getattr(item, actual) if cache_value is None or real_value is None: continue if cache_key in overlay.float_vars: