|
|
|
@ -770,7 +770,7 @@ class Plex:
|
|
|
|
|
|
|
|
|
|
def update_item_from_assets(self, item, overlay=None):
|
|
|
|
|
name = os.path.basename(os.path.dirname(item.locations[0]) if self.is_movie else item.locations[0])
|
|
|
|
|
found_one = False
|
|
|
|
|
found_folder = False
|
|
|
|
|
uploaded = False
|
|
|
|
|
for ad in self.asset_directory:
|
|
|
|
|
poster = None
|
|
|
|
@ -785,20 +785,21 @@ class Plex:
|
|
|
|
|
item_dir = os.path.abspath(matches[0])
|
|
|
|
|
if item_dir is None:
|
|
|
|
|
continue
|
|
|
|
|
found_one = True
|
|
|
|
|
found_folder = True
|
|
|
|
|
poster_filter = os.path.join(item_dir, "poster.*")
|
|
|
|
|
background_filter = os.path.join(item_dir, "background.*")
|
|
|
|
|
else:
|
|
|
|
|
poster_filter = os.path.join(ad, f"{name}.*")
|
|
|
|
|
background_filter = os.path.join(ad, f"{name}_background.*")
|
|
|
|
|
logger.debug(f"Poster Filter: {poster_filter}")
|
|
|
|
|
matches = glob.glob(poster_filter)
|
|
|
|
|
if len(matches) > 0:
|
|
|
|
|
poster = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title}'s ", is_url=False)
|
|
|
|
|
logger.debug(f"Background Filter: {background_filter}")
|
|
|
|
|
matches = glob.glob(background_filter)
|
|
|
|
|
if len(matches) > 0:
|
|
|
|
|
background = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title}'s ", is_poster=False, is_url=False)
|
|
|
|
|
if poster or background:
|
|
|
|
|
uploaded = True
|
|
|
|
|
self.upload_images(item, poster=poster, background=background, overlay=overlay)
|
|
|
|
|
if self.is_show:
|
|
|
|
|
for season in self.query(item.seasons):
|
|
|
|
@ -819,12 +820,12 @@ class Plex:
|
|
|
|
|
if len(matches) > 0:
|
|
|
|
|
episode_poster = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title} {episode.seasonEpisode.upper()}'s ", is_url=False)
|
|
|
|
|
self.upload_images(episode, poster=episode_poster)
|
|
|
|
|
if not found_one and overlay:
|
|
|
|
|
if not found_folder and overlay:
|
|
|
|
|
self.upload_images(item, overlay=overlay)
|
|
|
|
|
elif not found_one:
|
|
|
|
|
elif self.asset_folders and not found_folder:
|
|
|
|
|
logger.error(f"Asset Warning: No asset folder found called '{name}'")
|
|
|
|
|
elif not uploaded:
|
|
|
|
|
logger.error(f"Asset Warning: No poster or background found in an assets folder")
|
|
|
|
|
elif not poster and not background:
|
|
|
|
|
logger.error(f"Asset Warning: No poster or background found in an assets folder for {name}")
|
|
|
|
|
|
|
|
|
|
def find_collection_assets(self, item, name=None):
|
|
|
|
|
if name is None:
|
|
|
|
|