Merge pull request #296 from luigi311/fix_emby
Jellyfin/Emby: Add fallback for played percentage if missing
This commit is contained in:
@@ -377,8 +377,24 @@ class JellyfinEmby:
|
|||||||
if not show.get("UserData"):
|
if not show.get("UserData"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if show["UserData"].get("PlayedPercentage", 0) > 0:
|
played_percentage = show["UserData"].get("PlayedPercentage")
|
||||||
watched_shows_filtered.append(show)
|
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
|
# Retrieve the watched/partially watched list of episodes of each watched show
|
||||||
for show in watched_shows_filtered:
|
for show in watched_shows_filtered:
|
||||||
|
|||||||
Reference in New Issue
Block a user