Skip to content

Commit

Permalink
Merge pull request #125 from luigi311/dev
Browse files Browse the repository at this point in the history
Use season number instead of season name
  • Loading branch information
luigi311 authored Dec 11, 2023
2 parents 4297708 + 117932e commit faef0ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/jellyfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ async def get_user_library_watched(
if len(seasons["Items"]) > 0:
for season in seasons["Items"]:
season_identifiers = dict(seasons["Identifiers"])
season_identifiers["season_id"] = season["Id"]
season_identifiers["season_name"] = season["Name"]
season_identifiers["season_index"] = season[
"IndexNumber"
]
watched_task = asyncio.ensure_future(
self.query(
f"/Shows/{season_identifiers['show_id']}/Episodes"
Expand Down Expand Up @@ -390,18 +391,18 @@ async def get_user_library_watched(
] = {}

if (
season_dict["Identifiers"]["season_name"]
season_dict["Identifiers"]["season_index"]
not in user_watched[user_name][library_title][
season_dict["Identifiers"]["show_guids"]
]
):
user_watched[user_name][library_title][
season_dict["Identifiers"]["show_guids"]
][season_dict["Identifiers"]["season_name"]] = []
][season_dict["Identifiers"]["season_index"]] = []

user_watched[user_name][library_title][
season_dict["Identifiers"]["show_guids"]
][season_dict["Identifiers"]["season_name"]] = season_dict[
][season_dict["Identifiers"]["season_index"]] = season_dict[
"Episodes"
]
logger(
Expand Down
12 changes: 6 additions & 6 deletions src/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ def get_user_library_watched_show(show):

for episode in show.episodes():
if episode in watched:
if episode.parentTitle not in episode_guids:
episode_guids[episode.parentTitle] = []
if episode.parentIndex not in episode_guids:
episode_guids[episode.parentIndex] = []

episode_guids[episode.parentTitle].append(
episode_guids[episode.parentIndex].append(
get_episode_guids(episode, show, completed=True)
)
elif episode.viewOffset > 0:
if episode.parentTitle not in episode_guids:
episode_guids[episode.parentTitle] = []
if episode.parentIndex not in episode_guids:
episode_guids[episode.parentIndex] = []

episode_guids[episode.parentTitle].append(
episode_guids[episode.parentIndex].append(
get_episode_guids(episode, show, completed=False)
)

Expand Down

0 comments on commit faef0ae

Please sign in to comment.