From 19f77c89e7f6c937a26adae9cc26c98afa640d01 Mon Sep 17 00:00:00 2001 From: Luigi311 Date: Tue, 18 Jul 2023 16:27:13 -0600 Subject: [PATCH] Jellyfin: Fix locations logic Signed-off-by: Luigi311 --- src/jellyfin.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/jellyfin.py b/src/jellyfin.py index 32078bc..03beeba 100644 --- a/src/jellyfin.py +++ b/src/jellyfin.py @@ -35,6 +35,8 @@ def get_movie_guids(movie): movie_guids["locations"] = tuple( [x["Path"].split("/")[-1] for x in movie["MediaSources"]] ) + else: + movie_guids["locations"] = tuple() movie_guids["status"] = { "completed": movie["UserData"]["Played"], @@ -50,11 +52,11 @@ def get_episode_guids(episode): episode_dict = {k.lower(): v for k, v in episode["ProviderIds"].items()} episode_dict["title"] = episode["Name"] - episode_dict["locations"] = ( - tuple([x["Path"].split("/")[-1] for x in ["MediaSources"] if "Path" in x]) - if "MediaSources" in episode - else tuple() - ) + episode_dict["locations"] = tuple() + if "MediaSources" in episode: + for x in episode["MediaSources"]: + if "Path" in x: + episode_dict["locations"] += (x["Path"].split("/")[-1],) episode_dict["status"] = { "completed": episode["UserData"]["Played"],