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
-3
View File
@@ -1,8 +1,5 @@
import logging
from app.settings import logger
class CustomFormatter(logging.Formatter):
grey = "\x1b[38;20m"
+6 -2
View File
@@ -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