[42] asset updates

pull/935/head
meisnate12 3 years ago
parent c7ccae1253
commit c2488400a0

@ -1 +1 @@
1.17.0-develop41 1.17.0-develop42

@ -260,6 +260,8 @@ class IMDb:
return self.ratings[imdb_id] if imdb_id in self.ratings else None return self.ratings[imdb_id] if imdb_id in self.ratings else None
def get_episode_rating(self, imdb_id, season_num, episode_num): def get_episode_rating(self, imdb_id, season_num, episode_num):
season_num = str(season_num)
episode_num = str(episode_num)
if imdb_id not in self.episode_ratings or season_num not in self.episode_ratings[imdb_id] or episode_num not in self.episode_ratings[imdb_id][season_num]: if imdb_id not in self.episode_ratings or season_num not in self.episode_ratings[imdb_id] or episode_num not in self.episode_ratings[imdb_id][season_num]:
return None return None
return self.episode_ratings[imdb_id][season_num][episode_num] return self.episode_ratings[imdb_id][season_num][episode_num]

@ -939,6 +939,8 @@ class Plex(Library):
return asset_location, folder_name return asset_location, folder_name
def find_and_upload_assets(self, item, current_labels): def find_and_upload_assets(self, item, current_labels):
item_dir = None
name = None
try: try:
poster, background, item_dir, name = self.find_item_assets(item) poster, background, item_dir, name = self.find_item_assets(item)
if "Overlay" not in current_labels: if "Overlay" not in current_labels:
@ -948,13 +950,16 @@ class Plex(Library):
logger.warning(f"Asset Warning: No poster or background found in the assets folder '{item_dir}'") logger.warning(f"Asset Warning: No poster or background found in the assets folder '{item_dir}'")
else: else:
logger.warning(f"Asset Warning: {name} has an Overlay and will be updated when overlays are run") logger.warning(f"Asset Warning: {name} has an Overlay and will be updated when overlays are run")
except Failed as e:
if isinstance(item, Show): if self.show_missing_assets:
missing_seasons = "" logger.warning(e)
missing_episodes = "" if isinstance(item, Show):
found_season = False missing_seasons = ""
found_episode = False missing_episodes = ""
for season in self.query(item.seasons): found_season = False
found_episode = False
for season in self.query(item.seasons):
try:
season_poster, season_background, _, _ = self.find_item_assets(season, item_asset_directory=item_dir, folder_name=name) season_poster, season_background, _, _ = self.find_item_assets(season, item_asset_directory=item_dir, folder_name=name)
if season_poster: if season_poster:
found_season = True found_season = True
@ -962,7 +967,11 @@ class Plex(Library):
missing_seasons += f"\nMissing Season {season.seasonNumber} Poster" missing_seasons += f"\nMissing Season {season.seasonNumber} Poster"
if season_poster or season_background and "Overlay" not in [la.tag for la in self.item_labels(season)]: if season_poster or season_background and "Overlay" not in [la.tag for la in self.item_labels(season)]:
self.upload_images(season, poster=season_poster, background=season_background) self.upload_images(season, poster=season_poster, background=season_background)
for episode in self.query(season.episodes): except Failed as e:
if self.show_missing_assets:
logger.warning(e)
for episode in self.query(season.episodes):
try:
if episode.seasonEpisode: if episode.seasonEpisode:
episode_poster, episode_background, _, _ = self.find_item_assets(episode, item_asset_directory=item_dir, folder_name=name) episode_poster, episode_background, _, _ = self.find_item_assets(episode, item_asset_directory=item_dir, folder_name=name)
if episode_poster or episode_background: if episode_poster or episode_background:
@ -971,12 +980,16 @@ class Plex(Library):
self.upload_images(episode, poster=episode_poster, background=episode_background) self.upload_images(episode, poster=episode_poster, background=episode_background)
elif self.show_missing_episode_assets: elif self.show_missing_episode_assets:
missing_episodes += f"\nMissing {episode.seasonEpisode.upper()} Title Card" missing_episodes += f"\nMissing {episode.seasonEpisode.upper()} Title Card"
if (found_season and missing_seasons) or (found_episode and missing_episodes): except Failed as e:
logger.info(f"Missing Posters for {item.title}{missing_seasons}{missing_episodes}") if self.show_missing_assets:
if isinstance(item, Artist): logger.warning(e)
missing_assets = "" if (found_season and missing_seasons) or (found_episode and missing_episodes):
found_album = False logger.info(f"Missing Posters for {item.title}{missing_seasons}{missing_episodes}")
for album in self.query(item.albums): if isinstance(item, Artist):
missing_assets = ""
found_album = False
for album in self.query(item.albums):
try:
album_poster, album_background, _, _ = self.find_item_assets(album, item_asset_directory=item_dir, folder_name=name) album_poster, album_background, _, _ = self.find_item_assets(album, item_asset_directory=item_dir, folder_name=name)
if album_poster or album_background: if album_poster or album_background:
found_album = True found_album = True
@ -984,11 +997,11 @@ class Plex(Library):
missing_assets += f"\nMissing Album {album.title} Poster" missing_assets += f"\nMissing Album {album.title} Poster"
if album_poster or album_background: if album_poster or album_background:
self.upload_images(album, poster=album_poster, background=album_background) self.upload_images(album, poster=album_poster, background=album_background)
if self.show_missing_season_assets and found_album and missing_assets: except Failed as e:
logger.info(f"Missing Album Posters for {item.title}{missing_assets}") if self.show_missing_assets:
except Failed as e: logger.warning(e)
if self.show_missing_assets: if self.show_missing_season_assets and found_album and missing_assets:
logger.warning(e) logger.info(f"Missing Album Posters for {item.title}{missing_assets}")
def find_item_assets(self, item, item_asset_directory=None, asset_directory=None, folder_name=None): def find_item_assets(self, item, item_asset_directory=None, asset_directory=None, folder_name=None):
poster = None poster = None

Loading…
Cancel
Save