[37] fixed #1903 episode and mapper operations

pull/1912/head
meisnate12 9 months ago
parent 029fa3cd93
commit 39c7975fe1

@ -35,6 +35,8 @@ Fixed `trakt_userlist`
Fixed an issue where sometimes the resolution default overlay would be off center Fixed an issue where sometimes the resolution default overlay would be off center
Fixed multiple issues with playlist deletion. Thanks @benbou8231! Fixed multiple issues with playlist deletion. Thanks @benbou8231!
Fixed an issue where dynamic collection errors would sometimes appear before the title of the Dynamic Collection. Fixed an issue where dynamic collection errors would sometimes appear before the title of the Dynamic Collection.
Fix IMDb Null issue Fixed IMDb Null issue
Fixed mapper operations not working without a mass update operation
Fixed episode rating mass update operations
Various other Minor Fixes Various other Minor Fixes

@ -1 +1 @@
1.20.0-develop36 1.20.0-develop37

@ -412,9 +412,9 @@ class Operations:
continue continue
if self.library.mass_genre_update or self.library.genre_mapper: if self.library.mass_genre_update or self.library.genre_mapper:
if self.library.mass_genre_update:
new_genres = [] new_genres = []
extra_option = None extra_option = None
if self.library.mass_genre_update:
for option in self.library.mass_genre_update: for option in self.library.mass_genre_update:
if option in ["lock", "unlock", "remove", "reset"]: if option in ["lock", "unlock", "remove", "reset"]:
extra_option = option extra_option = option
@ -474,9 +474,9 @@ class Operations:
item_edits += "\nLock Genre (Batched)" item_edits += "\nLock Genre (Batched)"
if self.library.mass_content_rating_update or self.library.content_rating_mapper: if self.library.mass_content_rating_update or self.library.content_rating_mapper:
if self.library.mass_content_rating_update:
new_rating = None new_rating = None
extra_option = None extra_option = None
if self.library.mass_content_rating_update:
for option in self.library.mass_content_rating_update: for option in self.library.mass_content_rating_update:
if option in ["lock", "unlock", "remove", "reset"]: if option in ["lock", "unlock", "remove", "reset"]:
extra_option = option extra_option = option
@ -802,7 +802,7 @@ class Operations:
if any([x is not None for x, _ in episode_ops]): if any([x is not None for x, _ in episode_ops]):
if any([x == "imdb" for x, _ in episode_ops]) and not imdb_id: if any(["imdb" in x for x, _ in episode_ops]) and not imdb_id:
logger.info(f"No IMDb ID for Guid: {item.guid}") logger.info(f"No IMDb ID for Guid: {item.guid}")
for ep in item.episodes(): for ep in item.episodes():
@ -816,27 +816,33 @@ class Operations:
for attribute, item_attr in episode_ops: for attribute, item_attr in episode_ops:
if attribute: if attribute:
current = getattr(ep, item_attr) current = getattr(ep, item_attr)
if attribute == "remove" and current is not None: for option in attribute:
if option in ["lock", "remove"]:
if option == "remove" and current:
if item_attr not in ep_remove_edits: if item_attr not in ep_remove_edits:
ep_remove_edits[item_attr] = [] ep_remove_edits[item_attr] = []
ep_remove_edits[item_attr].append(ep) ep_remove_edits[item_attr].append(ep.ratingKey)
item_edits += f"\nRemove {name_display[item_attr]} (Batched)" item_edits += f"\nRemove {name_display[item_attr]} (Batched)"
elif attribute == "reset" and current is not None: 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)
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: if item_attr not in ep_reset_edits:
ep_reset_edits[item_attr] = [] ep_reset_edits[item_attr] = []
ep_reset_edits[item_attr].append(ep) ep_reset_edits[item_attr].append(ep.ratingKey)
item_edits += f"\nReset {name_display[item_attr]} (Batched)" item_edits += f"\nReset {name_display[item_attr]} (Batched)"
elif attribute in ["unlock", "reset"] and item_attr in episode_locked_fields: elif item_attr in locked_fields:
if item_attr not in ep_unlock_edits: if item_attr not in ep_unlock_edits:
ep_unlock_edits[item_attr] = [] ep_unlock_edits[item_attr] = []
ep_unlock_edits[item_attr].append(ep) ep_unlock_edits[item_attr].append(ep.ratingKey)
item_edits += f"\nUnlock {name_display[item_attr]} (Batched)" item_edits += f"\nUnlock {name_display[item_attr]} (Batched)"
elif attribute in ["lock", "remove"] and item_attr not in episode_locked_fields: break
if item_attr not in ep_lock_edits: else:
ep_lock_edits[item_attr] = [] try:
ep_lock_edits[item_attr].append(ep)
item_edits += f"\nLock {name_display[item_attr]} (Batched)"
elif attribute not in ["lock", "unlock", "remove", "reset"]:
try: try:
tmdb_item = tmdb_obj() tmdb_item = tmdb_obj()
except Failed: except Failed:
@ -849,16 +855,20 @@ class Operations:
logger.error(er) logger.error(er)
elif imdb_id and attribute == "imdb": elif imdb_id and attribute == "imdb":
found_rating = self.config.IMDb.get_episode_rating(imdb_id, ep.seasonNumber, ep.episodeNumber) found_rating = self.config.IMDb.get_episode_rating(imdb_id, ep.seasonNumber, ep.episodeNumber)
else:
if found_rating and float(found_rating) > 0: found_rating = option
if not found_rating:
logger.info(f"No {option} {name_display[item_attr]} Found")
raise Failed
found_rating = f"{float(found_rating):.1f}" found_rating = f"{float(found_rating):.1f}"
if str(current) != found_rating: if str(current) != found_rating:
if found_rating not in ep_rating_edits[item_attr]: if found_rating not in ep_rating_edits[item_attr]:
ep_rating_edits[item_attr][found_rating] = [] ep_rating_edits[item_attr][found_rating] = []
ep_rating_edits[item_attr][found_rating].append(ep) ep_rating_edits[item_attr][found_rating].append(ep.ratingKey)
item_edits += f"\nUpdate {name_display[item_attr]} (Batched) | {found_rating}" item_edits += f"\nUpdate {name_display[item_attr]} (Batched) | {found_rating}"
else: break
logger.info(f"No {name_display[item_attr]} Found") except Failed:
continue
if len(item_edits) > 0: if len(item_edits) > 0:
logger.info(f"Item Edits:{item_edits}") logger.info(f"Item Edits:{item_edits}")

Loading…
Cancel
Save