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