|
|
|
@ -199,65 +199,23 @@ def pick_image(title, images, prioritize_assets, download_url_assets, item_dir,
|
|
|
|
|
logger.debug(f"{len(images)} {image_type}{'s' if len(images) > 1 else ''} found:")
|
|
|
|
|
for i in images:
|
|
|
|
|
logger.debug(f"Method: {i} {image_type.capitalize()}: {images[i]}")
|
|
|
|
|
is_url = True
|
|
|
|
|
final_attr = None
|
|
|
|
|
if prioritize_assets and "asset_directory" in images:
|
|
|
|
|
return images["asset_directory"]
|
|
|
|
|
elif "image_set" in images:
|
|
|
|
|
final_attr = "image_set"
|
|
|
|
|
elif f"url_{image_type}" in images:
|
|
|
|
|
if download_url_assets and item_dir:
|
|
|
|
|
if "asset_directory" in images:
|
|
|
|
|
return images["asset_directory"]
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
return download_image(title, images[f"url_{image_type}"], item_dir, image_name)
|
|
|
|
|
except Failed as e:
|
|
|
|
|
logger.error(e)
|
|
|
|
|
final_attr = f"url_{image_type}"
|
|
|
|
|
elif f"file_{image_type}" in images:
|
|
|
|
|
final_attr = f"file_{image_type}"
|
|
|
|
|
is_url = False
|
|
|
|
|
elif f"tmdb_{image_type}" in images:
|
|
|
|
|
final_attr = f"tmdb_{image_type}"
|
|
|
|
|
elif "tmdb_profile" in images:
|
|
|
|
|
final_attr = "tmdb_profile"
|
|
|
|
|
elif "tmdb_list_poster" in images:
|
|
|
|
|
final_attr = "tmdb_list_poster"
|
|
|
|
|
elif "tvdb_list_poster" in images:
|
|
|
|
|
final_attr = "tvdb_list_poster"
|
|
|
|
|
elif f"tvdb_{image_type}" in images:
|
|
|
|
|
final_attr = f"tvdb_{image_type}"
|
|
|
|
|
elif "asset_directory" in images:
|
|
|
|
|
return images["asset_directory"]
|
|
|
|
|
elif "tmdb_person" in images:
|
|
|
|
|
final_attr = "tmdb_person"
|
|
|
|
|
elif "tmdb_collection_details" in images:
|
|
|
|
|
final_attr = "tmdb_collection_details"
|
|
|
|
|
elif "tmdb_actor_details" in images:
|
|
|
|
|
final_attr = "tmdb_actor_details"
|
|
|
|
|
elif "tmdb_crew_details" in images:
|
|
|
|
|
final_attr = "tmdb_crew_details"
|
|
|
|
|
elif "tmdb_director_details" in images:
|
|
|
|
|
final_attr = "tmdb_director_details"
|
|
|
|
|
elif "tmdb_producer_details" in images:
|
|
|
|
|
final_attr = "tmdb_producer_details"
|
|
|
|
|
elif "tmdb_writer_details" in images:
|
|
|
|
|
final_attr = "tmdb_writer_details"
|
|
|
|
|
elif "tmdb_movie_details" in images:
|
|
|
|
|
final_attr = "tmdb_movie_details"
|
|
|
|
|
elif "tmdb_list_details" in images:
|
|
|
|
|
final_attr = "tmdb_list_details"
|
|
|
|
|
elif "tvdb_list_details" in images:
|
|
|
|
|
final_attr = "tvdb_list_details"
|
|
|
|
|
elif "tvdb_movie_details" in images:
|
|
|
|
|
final_attr = "tvdb_movie_details"
|
|
|
|
|
elif "tvdb_show_details" in images:
|
|
|
|
|
final_attr = "tvdb_show_details"
|
|
|
|
|
elif "tmdb_show_details" in images:
|
|
|
|
|
final_attr = "tmdb_show_details"
|
|
|
|
|
if final_attr:
|
|
|
|
|
return ImageData(final_attr, images[final_attr], is_poster=is_poster, is_url=is_url)
|
|
|
|
|
if download_url_assets and item_dir and ("image_set" in images or f"url_{image_type}" in images):
|
|
|
|
|
if "asset_directory" in images:
|
|
|
|
|
return images["asset_directory"]
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
return download_image(title, images[f"url_{image_type}"], item_dir, image_name)
|
|
|
|
|
except Failed as e:
|
|
|
|
|
logger.error(e)
|
|
|
|
|
for attr in ["image_set", f"url_{image_type}", f"file_{image_type}", f"tmdb_{image_type}", "tmdb_profile",
|
|
|
|
|
"tmdb_list_poster", "tvdb_list_poster", f"tvdb_{image_type}", "asset_directory", "tmdb_person",
|
|
|
|
|
"tmdb_collection_details", "tmdb_actor_details", "tmdb_crew_details", "tmdb_director_details",
|
|
|
|
|
"tmdb_producer_details", "tmdb_writer_details", "tmdb_movie_details", "tmdb_list_details",
|
|
|
|
|
"tvdb_list_details", "tvdb_movie_details", "tvdb_show_details", "tmdb_show_details"]:
|
|
|
|
|
if attr in images:
|
|
|
|
|
return images[attr] if attr == "asset_directory" else ImageData(attr, images[attr], is_poster=is_poster, is_url=attr != f"file_{image_type}")
|
|
|
|
|
|
|
|
|
|
def add_dict_list(keys, value, dict_map):
|
|
|
|
|
for key in keys:
|
|
|
|
|