[38] Fixed metadata backup issue where Artist, Album, and Track ratings were not being backed up

pull/1914/head
meisnate12 8 months ago
parent 39c7975fe1
commit c3c22bd789

@ -38,5 +38,6 @@ Fixed an issue where dynamic collection errors would sometimes appear before the
Fixed IMDb Null issue
Fixed mapper operations not working without a mass update operation
Fixed episode rating mass update operations
Fixed metadata backup issue where Artist, Album, and Track ratings were not being backed up
Various other Minor Fixes

@ -1 +1 @@
1.20.0-develop37
1.20.0-develop38

@ -3,6 +3,7 @@ from datetime import datetime
from modules import plex, util, anidb
from modules.util import Failed, LimitReached, YAML
from plexapi.exceptions import NotFound
from plexapi.video import Movie, Show
logger = util.logger
@ -811,7 +812,6 @@ class Operations:
logger.info("")
logger.info(f"Processing {item_title}")
item_edits = ""
episode_locked_fields = [f.name for f in ep.fields if f.locked]
for attribute, item_attr in episode_ops:
if attribute:
@ -821,24 +821,24 @@ class Operations:
if option == "remove" and current:
if item_attr not in ep_remove_edits:
ep_remove_edits[item_attr] = []
ep_remove_edits[item_attr].append(ep.ratingKey)
ep_remove_edits[item_attr].append(ep)
item_edits += f"\nRemove {name_display[item_attr]} (Batched)"
elif item_attr not in locked_fields:
if item_attr not in ep_lock_edits:
ep_lock_edits[item_attr] = []
ep_lock_edits[item_attr].append(ep.ratingKey)
ep_lock_edits[item_attr].append(ep)
item_edits += f"\nLock {name_display[item_attr]} (Batched)"
break
elif option in ["unlock", "reset"]:
if option == "reset" and current:
if item_attr not in ep_reset_edits:
ep_reset_edits[item_attr] = []
ep_reset_edits[item_attr].append(ep.ratingKey)
ep_reset_edits[item_attr].append(ep)
item_edits += f"\nReset {name_display[item_attr]} (Batched)"
elif item_attr in locked_fields:
if item_attr not in ep_unlock_edits:
ep_unlock_edits[item_attr] = []
ep_unlock_edits[item_attr].append(ep.ratingKey)
ep_unlock_edits[item_attr].append(ep)
item_edits += f"\nUnlock {name_display[item_attr]} (Batched)"
break
else:
@ -848,15 +848,18 @@ class Operations:
except Failed:
tmdb_item = None
found_rating = None
if tmdb_item and attribute == "tmdb":
if tmdb_item and option == "tmdb":
try:
found_rating = self.config.TMDb.get_episode(tmdb_item.tmdb_id, ep.seasonNumber, ep.episodeNumber).vote_average # noqa
except Failed as er:
logger.error(er)
elif imdb_id and attribute == "imdb":
elif imdb_id and option == "imdb":
found_rating = self.config.IMDb.get_episode_rating(imdb_id, ep.seasonNumber, ep.episodeNumber)
else:
found_rating = option
try:
found_rating = float(option)
except ValueError:
pass
if not found_rating:
logger.info(f"No {option} {name_display[item_attr]} Found")
raise Failed
@ -864,7 +867,7 @@ class Operations:
if str(current) != found_rating:
if found_rating not in ep_rating_edits[item_attr]:
ep_rating_edits[item_attr][found_rating] = []
ep_rating_edits[item_attr][found_rating].append(ep.ratingKey)
ep_rating_edits[item_attr][found_rating].append(ep)
item_edits += f"\nUpdate {name_display[item_attr]} (Batched) | {found_rating}"
break
except Failed:
@ -1137,7 +1140,8 @@ class Operations:
year_titles = []
for item in items:
titles.append(item.title)
year_titles.append(f"{item.title} ({item.year})")
if isinstance(item, (Movie, Show)):
year_titles.append(f"{item.title} ({item.year})")
for i, item in enumerate(items, 1):
logger.ghost(f"Processing: {i}/{len(items)} {item.title}")
map_key, attrs = self.library.get_locked_attributes(item, titles, year_titles)

@ -1519,6 +1519,9 @@ class Plex(Library):
attrs = {}
match_dict = {}
fields = {f.name: f for f in item.fields if f.locked}
if isinstance(item, (Artist, Album, Track)):
if item.userRating:
fields["userRating"] = item.userRating
if isinstance(item, (Movie, Show)) and titles and titles.count(item.title) > 1:
if year_titles.count(f"{item.title} ({item.year})") > 1:
match_dict["title"] = item.title
@ -1543,7 +1546,7 @@ class Plex(Library):
if isinstance(item, (Movie, Show)):
tmdb_id, tvdb_id, imdb_id = self.get_ids(item)
tmdb_item = self.config.TMDb.get_item(item, tmdb_id, tvdb_id, imdb_id, is_movie=isinstance(item, Movie))
if tmdb_item:
if tmdb_item and tmdb_item.title != item.title:
match_dict["title"] = [item.title, tmdb_item.title]
if match_dict:

Loading…
Cancel
Save