[64] fix item_assets with metadata specific directories

This commit is contained in:
meisnate12 2022-12-16 14:28:08 -05:00
parent 2df6206461
commit de5ed4d916
3 changed files with 8 additions and 8 deletions

View file

@ -1 +1 @@
1.18.0-develop63
1.18.0-develop64

View file

@ -2471,8 +2471,8 @@ class CollectionBuilder:
tvdb_paths = []
for item in self.items:
current_labels = [la.tag for la in self.library.item_labels(item)]
if "item_assets" in self.item_details and self.library.asset_directory and "Overlay" not in current_labels:
self.library.find_and_upload_assets(item, current_labels)
if "item_assets" in self.item_details and self.asset_directory and "Overlay" not in current_labels:
self.library.find_and_upload_assets(item, current_labels, asset_directory=self.asset_directory)
self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags)
self.library.edit_tags("genre", item, add_tags=add_genres, remove_tags=remove_genres, sync_tags=sync_genres)
if "item_edition" in self.item_details and item.editionTitle != self.item_details["item_edition"]:

View file

@ -1084,11 +1084,11 @@ class Plex(Library):
updated = True
return asset_location, folder_name, updated
def find_and_upload_assets(self, item, current_labels):
def find_and_upload_assets(self, item, current_labels, asset_directory=None):
item_dir = None
name = None
try:
poster, background, item_dir, name = self.find_item_assets(item)
poster, background, item_dir, name = self.find_item_assets(item, asset_directory=asset_directory)
if "Overlay" not in current_labels:
if poster or background:
self.upload_images(item, poster=poster, background=background)
@ -1106,7 +1106,7 @@ class Plex(Library):
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, asset_directory=asset_directory, folder_name=name)
if season_poster:
found_season = True
elif self.show_missing_season_assets and season.seasonNumber > 0:
@ -1119,7 +1119,7 @@ class Plex(Library):
for episode in self.query(season.episodes):
try:
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, asset_directory=asset_directory, folder_name=name)
if episode_poster or episode_background:
found_episode = True
if "Overlay" not in [la.tag for la in self.item_labels(episode)]:
@ -1136,7 +1136,7 @@ class Plex(Library):
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, asset_directory=asset_directory, folder_name=name)
if album_poster or album_background:
found_album = True
elif self.show_missing_season_assets: