Add helper to fetch previous ratings of an media
MODIFY
plextraktsync/trakt_api.py
plextraktsync/trakt_api.py
@@ -212,6 +212,22 @@ def watchlist_shows(self):
def ratings(self):
return TraktRatingCollection(self)
+ def rating(self, m):
+ """
+ The trakt api (Python module) is inconsistent:
+ - Movie has "rating" property, while TVShow does not
+ """
+ if m.media_type == "movies":
+ return m.rating
+ elif m.media_type == "shows":
+ r = self.ratings["shows"]
+ try:
+ return r[m.trakt]
+ except KeyError:
+ return None
+ else:
+ raise ValueError(f"Unsupported type: {m.media_type}")
+
@nocache
@rate_limit()
@retry()

Add helper to fetch previous ratings of an media