chg: add debug log

This commit is contained in:
Felipe Marinho 2024-11-13 18:04:39 -03:00 committed by Zoe Roux
parent db15a5649a
commit 196f5678df
No known key found for this signature in database

View File

@ -149,6 +149,8 @@ class TheMovieDatabase(Provider):
Returns: Returns:
list: A list of images, prioritized by localization, original language, and any available image. list: A list of images, prioritized by localization, original language, and any available image.
""" """
print(f"Trying to get best image for {item['title']} in {lng}")
print(f"All available languageCodes: {list(map(lambda x: x['iso_639_1'], item['images'][key]))}")
# Order images by size and vote average # Order images by size and vote average
item["images"][key] = sorted( item["images"][key] = sorted(
item["images"][key], item["images"][key],
@ -163,8 +165,11 @@ class TheMovieDatabase(Provider):
if image.get("iso_639_1") == lng if image.get("iso_639_1") == lng
] ]
print(f"Localized images: {localized_images}")
# Step 2: If no localized images, try images in the original language # Step 2: If no localized images, try images in the original language
if not localized_images: if not localized_images:
print(f"Could not find localized images for {lng}, trying original language")
localized_images = [ localized_images = [
image image
for image in item["images"][key] for image in item["images"][key]
@ -173,6 +178,7 @@ class TheMovieDatabase(Provider):
# Step 3: If still no images, use any available images # Step 3: If still no images, use any available images
if not localized_images: if not localized_images:
print(f"Could not find images for {lng} or original language, using any available")
localized_images = item["images"][key] localized_images = item["images"][key]
return localized_images return localized_images