Fetch episode ratings from item
Previous logic would fetch them from show
@@ -223,12 +223,21 @@ def title(self):
@nocache
@retry(retries=1)
- def rating(self):
+ def rating(self, show_id: int = None):
if self.plex is not None:
ratings = self.plex.ratings[self.item.librarySectionID]
+ if self.type in ["movie", "show"]:
user_rating = (
ratings[self.item.ratingKey] if self.item.ratingKey in ratings else None
)
+ elif self.type == "episode":
+ # For episodes the ratings is just (show_id, show_rating) tuples
+ # if show id is not listed, return none, otherwise fetch from item itself
+ if show_id not in ratings:
+ return None
+ user_rating = self.item.userRating
+ else:
+ raise RuntimeError(f"Unsupported media type: {self.media_type}")
else:
user_rating = self.item.userRating
