pull/211/head
meisnate12 4 years ago
parent 6dcc30d554
commit d5121cdc23

@ -523,7 +523,7 @@ class CollectionBuilder:
final_values = method_data final_values = method_data
search = os.path.splitext(method_name)[0] search = os.path.splitext(method_name)[0]
valid_values = self.library.validate_search_list(final_values, search) valid_values = self.library.validate_search_list(final_values, search)
if valid_values: if len(valid_values) > 0:
self.methods.append(("plex_search", [{method_name: valid_values}])) self.methods.append(("plex_search", [{method_name: valid_values}]))
else: else:
logger.warning(f"Collection Warning: No valid {search} values found in {final_values}") logger.warning(f"Collection Warning: No valid {search} values found in {final_values}")

@ -576,11 +576,11 @@ class PlexAPI:
logger.error(f"Metadata Error: {attr} attribute only works for show libraries") logger.error(f"Metadata Error: {attr} attribute only works for show libraries")
elif meta[methods[attr]]: elif meta[methods[attr]]:
method_data = str(meta[methods[attr]]).lower() method_data = str(meta[methods[attr]]).lower()
if method_data in options and getattr(item, key) != options[method_data]: if method_data not in options:
logger.error(f"Metadata Error: {meta[methods[attr]]} {attr} attribute invalid")
elif getattr(item, key) != options[method_data]:
advance_edits[key] = options[method_data] advance_edits[key] = options[method_data]
logger.info(f"Detail: {attr} updated to {method_data}") logger.info(f"Detail: {attr} updated to {method_data}")
else:
logger.error(f"Metadata Error: {meta[methods[attr]]} {attr} attribute invalid")
else: else:
logger.error(f"Metadata Error: {attr} attribute is blank") logger.error(f"Metadata Error: {attr} attribute is blank")
@ -644,14 +644,22 @@ class PlexAPI:
edit_tags("producer", item, movie_library=True) edit_tags("producer", item, movie_library=True)
edit_tags("writer", item, movie_library=True) edit_tags("writer", item, movie_library=True)
logger.info(f"{item_type}: {mapping_name} Details Update {'Complete' if updated else 'Not Needed'}")
if "seasons" in methods and self.is_show: if "seasons" in methods and self.is_show:
if meta[methods["seasons"]]: if meta[methods["seasons"]]:
for season_id in meta[methods["seasons"]]: for season_id in meta[methods["seasons"]]:
updated = False
logger.info("") logger.info("")
logger.info(f"Updating season {season_id} of {mapping_name}...") logger.info(f"Updating season {season_id} of {mapping_name}...")
if isinstance(season_id, int): if isinstance(season_id, int):
try: season = item.season(season_id) season = None
except NotFound: logger.error(f"Metadata Error: Season: {season_id} not found") for s in item.seasons():
if s.index == season_id:
season = s
break
if season is None:
logger.error(f"Metadata Error: Season: {season_id} not found")
else: else:
season_dict = meta[methods["seasons"]][season_id] season_dict = meta[methods["seasons"]][season_id]
season_methods = {sm.lower(): sm for sm in season_dict} season_methods = {sm.lower(): sm for sm in season_dict}
@ -685,6 +693,7 @@ class PlexAPI:
logger.error(f"Season: {season_id} Details Update Failed") logger.error(f"Season: {season_id} Details Update Failed")
else: else:
logger.error(f"Metadata Error: Season: {season_id} invalid, it must be an integer") logger.error(f"Metadata Error: Season: {season_id} invalid, it must be an integer")
logger.info(f"Season {season_id} of {mapping_name} Details Update {'Complete' if updated else 'Not Needed'}")
else: else:
logger.error("Metadata Error: seasons attribute is blank") logger.error("Metadata Error: seasons attribute is blank")
elif "seasons" in methods: elif "seasons" in methods:
@ -693,10 +702,13 @@ class PlexAPI:
if "episodes" in methods and self.is_show: if "episodes" in methods and self.is_show:
if meta[methods["episodes"]]: if meta[methods["episodes"]]:
for episode_str in meta[methods["episodes"]]: for episode_str in meta[methods["episodes"]]:
updated = False
logger.info("") logger.info("")
match = re.search("[Ss]\\d+[Ee]\\d+", episode_str) match = re.search("[Ss]\\d+[Ee]\\d+", episode_str)
if match: if match:
output = match.group(0)[1:].split("E" if "E" in match.group(0) else "e") output = match.group(0)[1:].split("E" if "E" in match.group(0) else "e")
season_str = output[0]
episode_str = output[1]
season_id = int(output[0]) season_id = int(output[0])
episode_id = int(output[1]) episode_id = int(output[1])
logger.info(f"Updating episode S{episode_id}E{season_id} of {mapping_name}...") logger.info(f"Updating episode S{episode_id}E{season_id} of {mapping_name}...")
@ -738,13 +750,10 @@ class PlexAPI:
logger.error(f"Season: {season_id} Episode: {episode_id} Details Update Failed") logger.error(f"Season: {season_id} Episode: {episode_id} Details Update Failed")
edit_tags("director", episode) edit_tags("director", episode)
edit_tags("writer", episode) edit_tags("writer", episode)
logger.info(f"Episode S{episode_id}E{season_id} of {mapping_name} Details Update {'Complete' if updated else 'Not Needed'}")
else: else:
logger.error(f"Metadata Error: episode {episode_str} invalid must have S##E## format") logger.error(f"Metadata Error: episode {episode_str} invalid must have S##E## format")
else: else:
logger.error("Metadata Error: episodes attribute is blank") logger.error("Metadata Error: episodes attribute is blank")
elif "episodes" in methods: elif "episodes" in methods:
logger.error("Metadata Error: episodes attribute only works for show libraries") logger.error("Metadata Error: episodes attribute only works for show libraries")
if not updated:
logger.info(f"{item_type}: {mapping_name} Details Update Not Needed")
Loading…
Cancel
Save