Merge pull request #296 from luigi311/fix_emby

Jellyfin/Emby: Add fallback for played percentage if missing
pull/298/head
Luigi311 2025-07-14 13:09:58 -06:00 committed by GitHub
commit 3e2450b5fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 2 deletions

View File

@ -377,8 +377,24 @@ class JellyfinEmby:
if not show.get("UserData"):
continue
if show["UserData"].get("PlayedPercentage", 0) > 0:
watched_shows_filtered.append(show)
played_percentage = show["UserData"].get("PlayedPercentage")
if played_percentage is None:
# Emby no longer shows PlayedPercentage
total_episodes = show.get("RecursiveItemCount")
unplayed_episodes = show["UserData"].get("UnplayedItemCount")
if total_episodes is None:
# Failed to get total count of episodes
continue
if (
unplayed_episodes is not None
and unplayed_episodes < total_episodes
):
watched_shows_filtered.append(show)
else:
if played_percentage > 0:
watched_shows_filtered.append(show)
# Retrieve the watched/partially watched list of episodes of each watched show
for show in watched_shows_filtered: