|
|
@ -8,7 +8,7 @@ logger = util.logger
|
|
|
|
meta_operations = [
|
|
|
|
meta_operations = [
|
|
|
|
"mass_audience_rating_update", "mass_user_rating_update", "mass_critic_rating_update",
|
|
|
|
"mass_audience_rating_update", "mass_user_rating_update", "mass_critic_rating_update",
|
|
|
|
"mass_episode_audience_rating_update", "mass_episode_user_rating_update", "mass_episode_critic_rating_update",
|
|
|
|
"mass_episode_audience_rating_update", "mass_episode_user_rating_update", "mass_episode_critic_rating_update",
|
|
|
|
"mass_genre_update", "mass_content_rating_update", "mass_originally_available_update"
|
|
|
|
"mass_genre_update", "mass_content_rating_update", "mass_originally_available_update", "mass_original_title_update"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class Operations:
|
|
|
|
class Operations:
|
|
|
@ -33,6 +33,7 @@ class Operations:
|
|
|
|
logger.debug(f"Mass Episode Critic Rating Update: {self.library.mass_episode_critic_rating_update}")
|
|
|
|
logger.debug(f"Mass Episode Critic Rating Update: {self.library.mass_episode_critic_rating_update}")
|
|
|
|
logger.debug(f"Mass Episode User Rating Update: {self.library.mass_episode_user_rating_update}")
|
|
|
|
logger.debug(f"Mass Episode User Rating Update: {self.library.mass_episode_user_rating_update}")
|
|
|
|
logger.debug(f"Mass Content Rating Update: {self.library.mass_content_rating_update}")
|
|
|
|
logger.debug(f"Mass Content Rating Update: {self.library.mass_content_rating_update}")
|
|
|
|
|
|
|
|
logger.debug(f"Mass Original Title Update: {self.library.mass_original_title_update}")
|
|
|
|
logger.debug(f"Mass Originally Available Update: {self.library.mass_originally_available_update}")
|
|
|
|
logger.debug(f"Mass Originally Available Update: {self.library.mass_originally_available_update}")
|
|
|
|
logger.debug(f"Mass IMDb Parental Labels: {self.library.mass_imdb_parental_labels}")
|
|
|
|
logger.debug(f"Mass IMDb Parental Labels: {self.library.mass_imdb_parental_labels}")
|
|
|
|
logger.debug(f"Mass Collection Mode Update: {self.library.mass_collection_mode}")
|
|
|
|
logger.debug(f"Mass Collection Mode Update: {self.library.mass_collection_mode}")
|
|
|
@ -226,8 +227,10 @@ class Operations:
|
|
|
|
return f"\n{display} | None"
|
|
|
|
return f"\n{display} | None"
|
|
|
|
elif attribute in ["unlock", "reset"] and item_attr in locked_fields:
|
|
|
|
elif attribute in ["unlock", "reset"] and item_attr in locked_fields:
|
|
|
|
self.library.edit_query(item, {f"{item_attr}.locked": 0})
|
|
|
|
self.library.edit_query(item, {f"{item_attr}.locked": 0})
|
|
|
|
|
|
|
|
return f"\n{display} | Unlocked"
|
|
|
|
elif attribute in ["lock", "remove"] and item_attr not in locked_fields:
|
|
|
|
elif attribute in ["lock", "remove"] and item_attr not in locked_fields:
|
|
|
|
self.library.edit_query(item, {f"{item_attr}.locked": 1})
|
|
|
|
self.library.edit_query(item, {f"{item_attr}.locked": 1})
|
|
|
|
|
|
|
|
return f"\n{display} | Locked"
|
|
|
|
elif attribute not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
elif attribute not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
if tmdb_item and attribute == "tmdb":
|
|
|
|
if tmdb_item and attribute == "tmdb":
|
|
|
|
found_rating = tmdb_item.vote_average
|
|
|
|
found_rating = tmdb_item.vote_average
|
|
|
@ -306,9 +309,10 @@ class Operations:
|
|
|
|
raise Failed
|
|
|
|
raise Failed
|
|
|
|
if not new_genres:
|
|
|
|
if not new_genres:
|
|
|
|
logger.info(f"No Genres Found")
|
|
|
|
logger.info(f"No Genres Found")
|
|
|
|
if self.library.genre_mapper:
|
|
|
|
if self.library.genre_mapper or self.library.mass_genre_update in ["lock", "unlock"]:
|
|
|
|
if not new_genres and self.library.mass_genre_update not in ["remove", "reset"]:
|
|
|
|
if not new_genres and self.library.mass_genre_update not in ["remove", "reset"]:
|
|
|
|
new_genres = [g.tag for g in item.genres]
|
|
|
|
new_genres = [g.tag for g in item.genres]
|
|
|
|
|
|
|
|
if self.library.genre_mapper:
|
|
|
|
mapped_genres = []
|
|
|
|
mapped_genres = []
|
|
|
|
for genre in new_genres:
|
|
|
|
for genre in new_genres:
|
|
|
|
if genre in self.library.genre_mapper:
|
|
|
|
if genre in self.library.genre_mapper:
|
|
|
@ -328,7 +332,7 @@ class Operations:
|
|
|
|
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:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
new_rating = None
|
|
|
|
new_rating = None
|
|
|
|
if self.library.mass_content_rating_update and self.library.mass_genre_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
if self.library.mass_content_rating_update and self.library.mass_content_rating_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
if omdb_item and self.library.mass_content_rating_update == "omdb":
|
|
|
|
if omdb_item and self.library.mass_content_rating_update == "omdb":
|
|
|
|
new_rating = omdb_item.content_rating
|
|
|
|
new_rating = omdb_item.content_rating
|
|
|
|
elif mdb_item and self.library.mass_content_rating_update == "mdb":
|
|
|
|
elif mdb_item and self.library.mass_content_rating_update == "mdb":
|
|
|
@ -340,23 +344,24 @@ class Operations:
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Failed
|
|
|
|
raise Failed
|
|
|
|
if self.library.content_rating_mapper:
|
|
|
|
if self.library.content_rating_mapper:
|
|
|
|
if new_rating is None and self.library.mass_genre_update not in ["remove", "reset"]:
|
|
|
|
if new_rating is None and self.library.mass_content_rating_update not in ["remove", "reset"]:
|
|
|
|
new_rating = item.contentRating
|
|
|
|
new_rating = item.contentRating
|
|
|
|
if new_rating in self.library.content_rating_mapper:
|
|
|
|
if new_rating in self.library.content_rating_mapper:
|
|
|
|
new_rating = self.library.content_rating_mapper[new_rating]
|
|
|
|
new_rating = self.library.content_rating_mapper[new_rating]
|
|
|
|
|
|
|
|
|
|
|
|
if self.library.mass_content_rating_update in ["remove", "reset"] and item.contentRating:
|
|
|
|
if self.library.mass_content_rating_update in ["remove", "reset"] and item.contentRating:
|
|
|
|
item.editField("contentRating", None, locked=self.library.mass_content_rating_update == "remove")
|
|
|
|
item.editField("contentRating", None, locked=self.library.mass_content_rating_update == "remove")
|
|
|
|
batch_display += f"\nContent Rating | None"
|
|
|
|
batch_display += f"\nContent Rating | None"
|
|
|
|
elif not new_rating and self.library.mass_genre_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
elif not new_rating and self.library.mass_content_rating_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
logger.info(f"No Content Rating Found")
|
|
|
|
logger.info(f"No Content Rating Found")
|
|
|
|
elif str(item.contentRating) != str(new_rating):
|
|
|
|
elif str(item.contentRating) != str(new_rating):
|
|
|
|
item.editContentRating(new_rating)
|
|
|
|
item.editContentRating(new_rating)
|
|
|
|
batch_display += f"\nContent Rating | {new_rating}"
|
|
|
|
batch_display += f"\nContent Rating | {new_rating}"
|
|
|
|
elif self.library.mass_content_rating_update in ["unlock", "reset"] and "contentRating" in locked_fields:
|
|
|
|
elif self.library.mass_content_rating_update in ["unlock", "reset"] and "contentRating" in locked_fields:
|
|
|
|
self.library.edit_query(item, {"contentRating.locked": 0})
|
|
|
|
self.library.edit_query(item, {"contentRating.locked": 0})
|
|
|
|
|
|
|
|
batch_display += f"\nContent Rating | Unlocked"
|
|
|
|
elif self.library.mass_content_rating_update in ["lock", "remove"] and "contentRating" not in locked_fields:
|
|
|
|
elif self.library.mass_content_rating_update in ["lock", "remove"] and "contentRating" not in locked_fields:
|
|
|
|
self.library.edit_query(item, {"contentRating.locked": 1})
|
|
|
|
self.library.edit_query(item, {"contentRating.locked": 1})
|
|
|
|
|
|
|
|
batch_display += f"\nContent Rating | Locked"
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
@ -366,8 +371,10 @@ class Operations:
|
|
|
|
batch_display += f"\nOriginal Title | None"
|
|
|
|
batch_display += f"\nOriginal Title | None"
|
|
|
|
elif self.library.mass_original_title_update in ["unlock", "reset"] and "originalTitle" in locked_fields:
|
|
|
|
elif self.library.mass_original_title_update in ["unlock", "reset"] and "originalTitle" in locked_fields:
|
|
|
|
self.library.edit_query(item, {"originalTitle.locked": 0})
|
|
|
|
self.library.edit_query(item, {"originalTitle.locked": 0})
|
|
|
|
|
|
|
|
batch_display += f"\nOriginal Title | Unlocked"
|
|
|
|
elif self.library.mass_original_title_update in ["lock", "remove"] and "originalTitle" not in locked_fields:
|
|
|
|
elif self.library.mass_original_title_update in ["lock", "remove"] and "originalTitle" not in locked_fields:
|
|
|
|
self.library.edit_query(item, {"originalTitle.locked": 1})
|
|
|
|
self.library.edit_query(item, {"originalTitle.locked": 1})
|
|
|
|
|
|
|
|
batch_display += f"\nOriginal Title | Locked"
|
|
|
|
elif self.library.mass_original_title_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
elif self.library.mass_original_title_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if anidb_item and self.library.mass_original_title_update == "anidb":
|
|
|
|
if anidb_item and self.library.mass_original_title_update == "anidb":
|
|
|
@ -396,8 +403,10 @@ class Operations:
|
|
|
|
batch_display += f"\nOriginally Available Date | None"
|
|
|
|
batch_display += f"\nOriginally Available Date | None"
|
|
|
|
elif self.library.mass_originally_available_update in ["unlock", "reset"] and "originallyAvailableAt" in locked_fields:
|
|
|
|
elif self.library.mass_originally_available_update in ["unlock", "reset"] and "originallyAvailableAt" in locked_fields:
|
|
|
|
self.library.edit_query(item, {"originallyAvailableAt.locked": 0})
|
|
|
|
self.library.edit_query(item, {"originallyAvailableAt.locked": 0})
|
|
|
|
|
|
|
|
batch_display += f"\nOriginally Available Date | Unlocked"
|
|
|
|
elif self.library.mass_originally_available_update in ["lock", "remove"] and "originallyAvailableAt" not in locked_fields:
|
|
|
|
elif self.library.mass_originally_available_update in ["lock", "remove"] and "originallyAvailableAt" not in locked_fields:
|
|
|
|
self.library.edit_query(item, {"originallyAvailableAt.locked": 1})
|
|
|
|
self.library.edit_query(item, {"originallyAvailableAt.locked": 1})
|
|
|
|
|
|
|
|
batch_display += f"\nOriginally Available Date | Locked"
|
|
|
|
elif self.library.mass_originally_available_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
elif self.library.mass_originally_available_update not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if omdb_item and self.library.mass_originally_available_update == "omdb":
|
|
|
|
if omdb_item and self.library.mass_originally_available_update == "omdb":
|
|
|
@ -448,8 +457,10 @@ class Operations:
|
|
|
|
return f"\n{display} | None"
|
|
|
|
return f"\n{display} | None"
|
|
|
|
elif attribute in ["unlock", "reset"] and item_attr in episode_locked_fields:
|
|
|
|
elif attribute in ["unlock", "reset"] and item_attr in episode_locked_fields:
|
|
|
|
self.library.edit_query(ep, {f"{item_attr}.locked": 0})
|
|
|
|
self.library.edit_query(ep, {f"{item_attr}.locked": 0})
|
|
|
|
|
|
|
|
return f"\n{display} | Unlocked"
|
|
|
|
elif attribute in ["lock", "remove"] and item_attr not in episode_locked_fields:
|
|
|
|
elif attribute in ["lock", "remove"] and item_attr not in episode_locked_fields:
|
|
|
|
self.library.edit_query(ep, {f"{item_attr}.locked": 1})
|
|
|
|
self.library.edit_query(ep, {f"{item_attr}.locked": 1})
|
|
|
|
|
|
|
|
return f"\n{display} | Locked"
|
|
|
|
elif attribute not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
elif attribute not in ["lock", "unlock", "remove", "reset"]:
|
|
|
|
found_rating = None
|
|
|
|
found_rating = None
|
|
|
|
if tmdb_item and attribute == "tmdb":
|
|
|
|
if tmdb_item and attribute == "tmdb":
|
|
|
|