Skip to content

Commit

Permalink
Jellyfin: Fix locations logic
Browse files Browse the repository at this point in the history
Signed-off-by: Luigi311 <[email protected]>
  • Loading branch information
luigi311 committed Jul 18, 2023
1 parent 81e9678 commit 19f77c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/jellyfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down

0 comments on commit 19f77c8

Please sign in to comment.