Skip to content

Commit

Permalink
Raise error when plex_rating needs show but it is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Feb 6, 2024
1 parent fd1fb91 commit 57ea86c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plextraktsync/media/Media.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ def trakt_rating(self):

@cached_property
def plex_rating(self):
show_id = self.show.plex.item.ratingKey if self.media_type == "episodes" and not self.plex.is_discover else None
if self.media_type == "episodes" and not self.plex.is_discover:
if not self.show:
raise RuntimeError(f"Need show attribute, but it is missing for {self}")
show_id = self.show.plex.item.ratingKey
else:
show_id = None
return self.plex.rating(show_id)

def trakt_rate(self):
Expand Down

0 comments on commit 57ea86c

Please sign in to comment.