Skip to content

Commit

Permalink
Merge pull request #2134 from glensc/inspect-season
Browse files Browse the repository at this point in the history
Fix inspect season for tmdb
  • Loading branch information
glensc authored Jan 2, 2025
2 parents ece0881 + 16a196d commit fe92612
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,11 @@ def episode_number(self):

@property
def show_id(self):
if self.type != "episode":
raise RuntimeError("show_id is valid for episodes only")
return self.item.grandparentRatingKey
if self.type == "season":
return self.item.parentRatingKey
if self.type == "episode":
return self.item.grandparentRatingKey
raise RuntimeError(f"Unsupported type={self.type} for show_id")

@property
def show(self):
Expand Down
3 changes: 3 additions & 0 deletions plextraktsync/plex/guid/provider/TMDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class TMDB(Abstract):

@cached_property
def link(self):
if self.guid.type == "season":
return f"{self.url}/tv/{self.show_guid.id}/season/{self.season_number}"

if self.guid.type == "episode":
return f"{self.url}/tv/{self.show_guid.id}/season/{self.season_number}/episode/{self.episode_number}"

Expand Down

0 comments on commit fe92612

Please sign in to comment.