Use PlexRatings class rather PlexRatingCollection
@@ -225,19 +225,7 @@ def title(self):
@retry(retries=1)
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}")
+ return self.plex.ratings.get(self, show_id)
else:
user_rating = self.item.userRating
@@ -615,7 +603,9 @@ def system_account(self, account_id: int) -> SystemAccount:
@cached_property
def ratings(self):
- return PlexRatingCollection(self)
+ from plextraktsync.plex.PlexRatings import PlexRatings
+
+ return PlexRatings(self)
@nocache
@retry()
