mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
try new bottom components
This commit is contained in:
committed by
Mungai Geoffrey
parent
2f78ee3883
commit
f919ce35df
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user