|
|
|
@ -1494,27 +1494,40 @@ class Plex(Library):
|
|
|
|
|
imdb_id = self.get_imdb_from_map(item)
|
|
|
|
|
return tmdb_id, tvdb_id, imdb_id
|
|
|
|
|
|
|
|
|
|
def get_locked_attributes(self, item, titles=None):
|
|
|
|
|
def get_locked_attributes(self, item, titles=None, year_titles=None):
|
|
|
|
|
item = self.reload(item)
|
|
|
|
|
attrs = {}
|
|
|
|
|
match_dict = {}
|
|
|
|
|
fields = {f.name: f for f in item.fields if f.locked}
|
|
|
|
|
if isinstance(item, (Movie, Show)) and titles and titles.count(item.title) > 1:
|
|
|
|
|
map_key = f"{item.title} ({item.year})"
|
|
|
|
|
attrs["title"] = item.title
|
|
|
|
|
attrs["year"] = item.year
|
|
|
|
|
if year_titles.count(f"{item.title} ({item.year})") > 1:
|
|
|
|
|
match_dict["title"] = item.title
|
|
|
|
|
match_dict["year"] = item.year
|
|
|
|
|
if item.editionTitle:
|
|
|
|
|
map_key = f"{item.title} ({item.year}) [{item.editionTitle}]"
|
|
|
|
|
match_dict["edition"] = item.editionTitle
|
|
|
|
|
else:
|
|
|
|
|
map_key = f"{item.title} ({item.year})"
|
|
|
|
|
match_dict["blank_edition"] = True
|
|
|
|
|
else:
|
|
|
|
|
map_key = f"{item.title} ({item.year})"
|
|
|
|
|
match_dict["title"] = item.title
|
|
|
|
|
match_dict["year"] = item.year
|
|
|
|
|
elif isinstance(item, (Season, Episode, Track)) and item.index:
|
|
|
|
|
map_key = int(item.index)
|
|
|
|
|
else:
|
|
|
|
|
map_key = item.title
|
|
|
|
|
|
|
|
|
|
if "title" in fields:
|
|
|
|
|
attrs["title"] = item.title
|
|
|
|
|
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:
|
|
|
|
|
attrs["alt_title"] = tmdb_item.title
|
|
|
|
|
elif isinstance(item, (Season, Episode, Track)):
|
|
|
|
|
attrs["title"] = item.title
|
|
|
|
|
match_dict["title"] = [item.title, tmdb_item.title]
|
|
|
|
|
|
|
|
|
|
if match_dict:
|
|
|
|
|
attrs["match"] = match_dict
|
|
|
|
|
|
|
|
|
|
def check_field(plex_key, pmm_key, var_key=None):
|
|
|
|
|
if plex_key in fields and pmm_key not in self.metadata_backup["exclude"]:
|
|
|
|
@ -1532,6 +1545,7 @@ class Plex(Library):
|
|
|
|
|
attrs[pmm_key] = plex_value
|
|
|
|
|
|
|
|
|
|
check_field("titleSort", "sort_title")
|
|
|
|
|
check_field("editionTitle", "edition")
|
|
|
|
|
check_field("originalTitle", "original_artist" if self.is_music else "original_title")
|
|
|
|
|
check_field("originallyAvailableAt", "originally_available")
|
|
|
|
|
check_field("contentRating", "content_rating")
|
|
|
|
|