mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 12:33:03 +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
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import logging
|
||||
|
||||
from app.settings import logger
|
||||
|
||||
|
||||
class CustomFormatter(logging.Formatter):
|
||||
|
||||
grey = "\x1b[38;20m"
|
||||
|
||||
@@ -29,5 +29,9 @@ LAST_FM_API_KEY = "762db7a44a9e6fb5585661f5f2bdf23a"
|
||||
CPU_COUNT = multiprocessing.cpu_count()
|
||||
|
||||
|
||||
class logger:
|
||||
enable = True
|
||||
THUMB_SIZE: int = 400
|
||||
"""
|
||||
The size of extracted in pixels
|
||||
"""
|
||||
|
||||
LOGGER_ENABLE: bool = True
|
||||
|
||||
Reference in New Issue
Block a user