diff --git a/CHANGELOG b/CHANGELOG
index 27106881..f98863bd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,8 @@ Logic added to Kometa to create `config.yml` if it does not exist from the `conf
When using `mass_poster_update`, added `ignore_locked` and `ignore_overlays` attributes which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update) or if the item has an Overlay. This can effectively act as a differential update system.
When using `mass_background_update`, added `ignore_locked` attribute which will prevent Kometa from resetting the image if the poster field is locked (i.e. a previous mass poster update). This can effectively act as a differential update system.
Add `date` option for schedules
+Add `trakt`, `omdb_metascore`, `omdb_tomatoes` ratings sources for mass operations.
+Add `trakt` ratings source for mass episode operations.
# Docs
Added "getting started" page
diff --git a/VERSION b/VERSION
index a8b68a49..2a51ede1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.0-build46
+2.1.0-build47
diff --git a/docs/config/operations.md b/docs/config/operations.md
index b63f6505..698f77ab 100644
--- a/docs/config/operations.md
+++ b/docs/config/operations.md
@@ -385,6 +385,7 @@ You can create individual blocks of operations by using a list under `operations
`tmdb` | Use TMDb Rating |
`imdb` | Use IMDb Rating |
+ `trakt` | Use Trakt Rating |
`trakt_user` | Use Trakt User's Personal Rating |
`omdb` | Use IMDbRating through OMDb |
`omdb_metascore` | Use Metacritic Metascore through OMDb |
@@ -456,6 +457,7 @@ You can create individual blocks of operations by using a list under `operations
`tmdb` | Use TMDb Rating |
`imdb` | Use IMDb Rating |
+ `trakt` | Use Trakt Rating |
`lock` | Lock Rating Field |
`unlock` | Unlock Rating Field |
`remove` | Remove Rating and Lock Field |
diff --git a/modules/config.py b/modules/config.py
index cecee851..0b11fb83 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -97,7 +97,7 @@ mass_image_options = {
}
mass_episode_rating_options = {
"lock": "Lock Rating", "unlock": "Unlock Rating", "remove": "Remove and Lock Rating", "reset": "Remove and Unlock Rating",
- "tmdb": "Use TMDb Rating", "imdb": "Use IMDb Rating"
+ "tmdb": "Use TMDb Rating", "imdb": "Use IMDb Rating", "trakt": "Use Trakt Rating"
}
mass_rating_options = {
"lock": "Lock Rating",
@@ -106,6 +106,7 @@ mass_rating_options = {
"reset": "Remove and Unlock Rating",
"tmdb": "Use TMDb Rating",
"imdb": "Use IMDb Rating",
+ "trakt": "Use Trakt Rating",
"trakt_user": "Use Trakt User Rating",
"omdb": "Use IMDb Rating through OMDb",
"omdb_metascore": "Use Metacritic Metascore through OMDb",
diff --git a/modules/operations.py b/modules/operations.py
index 91742222..1c02baa8 100644
--- a/modules/operations.py
+++ b/modules/operations.py
@@ -376,6 +376,8 @@ class Operations:
found_rating = tmdb_obj().vote_average # noqa
elif option == "imdb":
found_rating = self.config.IMDb.get_rating(imdb_id)
+ elif option == "trakt":
+ found_rating = self.config.Trakt.get_rating(imdb_id, self.library.is_movie)
elif option == "trakt_user":
_ratings = trakt_ratings()
_id = tmdb_id if self.library.is_movie else tvdb_id
@@ -916,6 +918,8 @@ class Operations:
logger.error(er)
elif imdb_id and option == "imdb":
found_rating = self.config.IMDb.get_episode_rating(imdb_id, ep.seasonNumber, ep.episodeNumber)
+ elif imdb_id and option == "trakt":
+ found_rating = self.config.Trakt.get_episode_rating(imdb_id, ep.seasonNumber, ep.episodeNumber)
else:
try:
found_rating = float(option)
diff --git a/modules/trakt.py b/modules/trakt.py
index a04d68ff..4e543c96 100644
--- a/modules/trakt.py
+++ b/modules/trakt.py
@@ -242,6 +242,15 @@ class Trakt:
id_type = "tmdb" if is_movie else "tvdb"
return {int(i[media]["ids"][id_type]): i["rating"] for i in self._request(f"/users/me/ratings/{media}s")}
+ def get_episode_rating(self, show_id, season, episode):
+ response = self._request(f"/shows/{show_id}/seasons/{season}/episodes/{episode}/ratings")
+ return response["rating"]
+
+ def get_rating(self, show_id, is_movie):
+ item_type = 'movies' if is_movie else 'shows'
+ response = self._request(f"/{item_type}/{show_id}/ratings")
+ return response["rating"]
+
def convert(self, external_id, from_source, to_source, media_type):
path = f"/search/{from_source}/{external_id}"
params = {"type": media_type} if from_source in ["tmdb", "tvdb"] else None