Skip to content

Commit

Permalink
Merge pull request #2136 from glensc/show-id-reuse
Browse files Browse the repository at this point in the history
Refactor: Reuse code in PlexLibraryItem
  • Loading branch information
glensc authored Jan 2, 2025
2 parents 680c058 + c7cec17 commit 3a25408
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,11 @@ def episodes(self):

@retry()
def _get_episodes(self):
filters = {"show.id": self.show_id}
if self.type == "season":
show_id = self.item.parentRatingKey
season = self.item.seasonNumber
filters["season.index"] = self.season_number

return self.library.search(libtype="episode", filters={"show.id": show_id, "season.index": season})

return self.library.search(libtype="episode", filters={"show.id": self.item.ratingKey})
return self.library.search(libtype="episode", filters=filters)

@cached_property
def season_number(self):
Expand All @@ -353,6 +351,8 @@ def episode_number(self):

@property
def show_id(self):
if self.type == "show":
return self.item.ratingKey
if self.type == "season":
return self.item.parentRatingKey
if self.type == "episode":
Expand Down

0 comments on commit 3a25408

Please sign in to comment.