try new bottom components

This commit is contained in:
geoffrey45
2022-06-29 15:59:58 +03:00
committed by Mungai Geoffrey
parent 2f78ee3883
commit f919ce35df
8 changed files with 134 additions and 86 deletions
+3 -2
View File
@@ -33,6 +33,7 @@ def extract_thumb(filepath: str, webp_path: str) -> bool:
Extracts the thumbnail from an audio file. Returns the path to the thumbnail.
"""
img_path = os.path.join(settings.THUMBS_PATH, webp_path)
tsize = settings.THUMB_SIZE
if os.path.exists(img_path):
return True
@@ -43,12 +44,12 @@ def extract_thumb(filepath: str, webp_path: str) -> bool:
img = Image.open(BytesIO(album_art))
try:
small_img = img.resize((250, 250), Image.ANTIALIAS)
small_img = img.resize((tsize, tsize), Image.ANTIALIAS)
small_img.save(img_path, format="webp")
except OSError:
try:
png = img.convert("RGB")
small_img = png.resize((250, 250), Image.ANTIALIAS)
small_img = png.resize((tsize, tsize), Image.ANTIALIAS)
small_img.save(webp_path, format="webp")
except:
return False