[47] Trakt Ratings (#2425)

pull/2427/head
Chaz Larson 1 week ago committed by GitHub Action
parent 8614b308b1
commit f8ecbcbfb9

@ -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

@ -1 +1 @@
2.1.0-build46
2.1.0-build47

@ -385,6 +385,7 @@ You can create individual blocks of operations by using a list under `operations
<table class="clearTable">
<tr><td>`tmdb`</td><td>Use TMDb Rating</td></tr>
<tr><td>`imdb`</td><td>Use IMDb Rating</td></tr>
<tr><td>`trakt`</td><td>Use Trakt Rating</td></tr>
<tr><td>`trakt_user`</td><td>Use Trakt User's Personal Rating</td></tr>
<tr><td>`omdb`</td><td>Use IMDbRating through OMDb</td></tr>
<tr><td>`omdb_metascore`</td><td>Use Metacritic Metascore through OMDb</td></tr>
@ -456,6 +457,7 @@ You can create individual blocks of operations by using a list under `operations
<table class="clearTable">
<tr><td>`tmdb`</td><td>Use TMDb Rating</td></tr>
<tr><td>`imdb`</td><td>Use IMDb Rating</td></tr>
<tr><td>`trakt`</td><td>Use Trakt Rating</td></tr>
<tr><td>`lock`</td><td>Lock Rating Field</td></tr>
<tr><td>`unlock`</td><td>Unlock Rating Field</td></tr>
<tr><td>`remove`</td><td>Remove Rating and Lock Field</td></tr>

@ -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",

@ -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)

@ -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

Loading…
Cancel
Save