added mass_critic_rating_update

pull/240/head
meisnate12 4 years ago
parent fae06ce8c0
commit 6f59e860c4

@ -381,6 +381,14 @@ class Config:
else: else:
params["mass_audience_rating_update"] = None params["mass_audience_rating_update"] = None
if lib and "mass_critic_rating_update" in lib and lib["mass_critic_rating_update"]:
params["mass_critic_rating_update"] = check_for_attribute(lib, "mass_critic_rating_update", test_list=mass_update_options, default_is_none=True, save=False)
if self.OMDb is None and params["mass_critic_rating_update"] == "omdb":
params["mass_critic_rating_update"] = None
logger.error("Config Error: mass_critic_rating_update cannot be omdb without a successful OMDb Connection")
else:
params["mass_critic_rating_update"] = None
try: try:
if lib and "metadata_path" in lib: if lib and "metadata_path" in lib:
params["metadata_path"] = [] params["metadata_path"] = []

@ -335,7 +335,8 @@ class PlexAPI:
self.save_missing = params["save_missing"] self.save_missing = params["save_missing"]
self.mass_genre_update = params["mass_genre_update"] self.mass_genre_update = params["mass_genre_update"]
self.mass_audience_rating_update = params["mass_audience_rating_update"] self.mass_audience_rating_update = params["mass_audience_rating_update"]
self.mass_update = self.mass_genre_update or self.mass_audience_rating_update self.mass_critic_rating_update = params["mass_critic_rating_update"]
self.mass_update = self.mass_genre_update or self.mass_audience_rating_update or self.mass_critic_rating_update
self.plex = params["plex"] self.plex = params["plex"]
self.url = params["plex"]["url"] self.url = params["plex"]["url"]
self.token = params["plex"]["token"] self.token = params["plex"]["token"]

@ -264,7 +264,7 @@ def mass_metadata(config, library, movie_map, show_map):
imdb_id = config.Convert.tvdb_to_imdb(tvdb_id) imdb_id = config.Convert.tvdb_to_imdb(tvdb_id)
tmdb_item = None tmdb_item = None
if library.mass_genre_update == "tmdb" or library.mass_audience_rating_update == "tmdb": if library.mass_genre_update == "tmdb" or library.mass_audience_rating_update == "tmdb" or library.mass_critic_rating_update == "tmdb":
if tmdb_id: if tmdb_id:
try: try:
tmdb_item = config.TMDb.get_movie(tmdb_id) if library.is_movie else config.TMDb.get_show(tmdb_id) tmdb_item = config.TMDb.get_movie(tmdb_id) if library.is_movie else config.TMDb.get_show(tmdb_id)
@ -274,7 +274,7 @@ def mass_metadata(config, library, movie_map, show_map):
util.print_end(length, f"{item.title[:25]:<25} | No TMDb ID for Guid: {item.guid}") util.print_end(length, f"{item.title[:25]:<25} | No TMDb ID for Guid: {item.guid}")
omdb_item = None omdb_item = None
if library.mass_genre_update in ["omdb", "imdb"] or library.mass_audience_rating_update in ["omdb", "imdb"]: if library.mass_genre_update in ["omdb", "imdb"] or library.mass_audience_rating_update in ["omdb", "imdb"] or library.mass_critic_rating_update in ["omdb", "imdb"]:
if config.OMDb.limit is False: if config.OMDb.limit is False:
if imdb_id: if imdb_id:
try: try:
@ -307,7 +307,7 @@ def mass_metadata(config, library, movie_map, show_map):
util.print_end(length, f"{item.title[:25]:<25} | Genres | {display_str}") util.print_end(length, f"{item.title[:25]:<25} | Genres | {display_str}")
except Failed: except Failed:
pass pass
if library.mass_audience_rating_update: if library.mass_audience_rating_update or library.mass_critic_rating_update:
try: try:
if tmdb_item and library.mass_genre_update == "tmdb": if tmdb_item and library.mass_genre_update == "tmdb":
new_rating = tmdb_item.vote_average new_rating = tmdb_item.vote_average
@ -317,9 +317,13 @@ def mass_metadata(config, library, movie_map, show_map):
raise Failed raise Failed
if new_rating is None: if new_rating is None:
util.print_end(length, f"{item.title[:25]:<25} | No Rating Found") util.print_end(length, f"{item.title[:25]:<25} | No Rating Found")
elif str(item.audienceRating) != str(new_rating): else:
library.edit_query(item, {"audienceRating.value": new_rating, "audienceRating.locked": 1}) if library.mass_audience_rating_update and str(item.audienceRating) != str(new_rating):
util.print_end(length, f"{item.title[:25]:<25} | Audience Rating | {new_rating}") library.edit_query(item, {"audienceRating.value": new_rating, "audienceRating.locked": 1})
util.print_end(length, f"{item.title[:25]:<25} | Audience Rating | {new_rating}")
if library.mass_critic_rating_update and str(item.rating) != str(new_rating):
library.edit_query(item, {"rating.value": new_rating, "rating.locked": 1})
util.print_end(length, f"{item.title[:25]:<25} | Critic Rating | {new_rating}")
except Failed: except Failed:
pass pass

Loading…
Cancel
Save