diff --git a/plextraktsync/util/Rating.py b/plextraktsync/util/Rating.py index d2bc1220b8..d88dcc2256 100644 --- a/plextraktsync/util/Rating.py +++ b/plextraktsync/util/Rating.py @@ -10,6 +10,19 @@ class Rating(NamedTuple): rating: int rated_at: datetime | None + RATING_TITLES = { + 1: "Weak Sauce :(", + 2: "Terrible", + 3: "Bad", + 4: "Poor", + 5: "Meh", + 6: "Fair", + 7: "Good", + 8: "Great", + 9: "Superb", + 10: "Totally Ninja!", + } + def __eq__(self, other): """Ratings are equal if their rating value is the same""" if isinstance(other, (int, float)): @@ -20,9 +33,13 @@ def __eq__(self, other): return self.rating == other.rating + @property + def title(self): + return self.RATING_TITLES[self.rating] + def __str__(self): rated_at = f"'{timestamp(self.rated_at)}'" if self.rated_at else None - return f"Rating(rating={self.rating}, rated_at={rated_at})" + return f"Rating(rating={self.rating}, rated_at={rated_at}, title={self.title})" @classmethod def create(cls, rating: int | float | None, rated_at: datetime | str | None):