mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-22 12:33:10 +00:00
added mass_critic_rating_update
This commit is contained in:
parent
fae06ce8c0
commit
6f59e860c4
3 changed files with 20 additions and 7 deletions
|
@ -381,6 +381,14 @@ class Config:
|
|||
else:
|
||||
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:
|
||||
if lib and "metadata_path" in lib:
|
||||
params["metadata_path"] = []
|
||||
|
|
|
@ -335,7 +335,8 @@ class PlexAPI:
|
|||
self.save_missing = params["save_missing"]
|
||||
self.mass_genre_update = params["mass_genre_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.url = params["plex"]["url"]
|
||||
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)
|
||||
|
||||
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:
|
||||
try:
|
||||
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}")
|
||||
|
||||
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 imdb_id:
|
||||
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}")
|
||||
except Failed:
|
||||
pass
|
||||
if library.mass_audience_rating_update:
|
||||
if library.mass_audience_rating_update or library.mass_critic_rating_update:
|
||||
try:
|
||||
if tmdb_item and library.mass_genre_update == "tmdb":
|
||||
new_rating = tmdb_item.vote_average
|
||||
|
@ -317,9 +317,13 @@ def mass_metadata(config, library, movie_map, show_map):
|
|||
raise Failed
|
||||
if new_rating is None:
|
||||
util.print_end(length, f"{item.title[:25]:<25} | No Rating Found")
|
||||
elif str(item.audienceRating) != str(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}")
|
||||
else:
|
||||
if library.mass_audience_rating_update and str(item.audienceRating) != str(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:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in a new issue