mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
bump large thumbnails to 512 px
+ stop extracting original thumbnails
This commit is contained in:
+10
-10
@@ -29,18 +29,18 @@ class ImagePath(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
@api.get("/t/o/<imgpath>")
|
||||
def send_original_thumbnail(path: ImagePath):
|
||||
"""
|
||||
Get original thumbnail
|
||||
"""
|
||||
folder = Paths.get_original_thumb_path()
|
||||
fpath = Path(folder) / path.imgpath
|
||||
# @api.get("/t/o/<imgpath>")
|
||||
# def send_original_thumbnail(path: ImagePath):
|
||||
# """
|
||||
# Get original thumbnail
|
||||
# """
|
||||
# folder = Paths.get_original_thumb_path()
|
||||
# fpath = Path(folder) / path.imgpath
|
||||
|
||||
if fpath.exists():
|
||||
return send_from_directory(folder, path.imgpath)
|
||||
# if fpath.exists():
|
||||
# return send_from_directory(folder, path.imgpath)
|
||||
|
||||
return send_fallback_img()
|
||||
# return send_fallback_img()
|
||||
|
||||
|
||||
@api.get("/t/<imgpath>")
|
||||
|
||||
@@ -31,7 +31,6 @@ def extract_thumb(filepath: str, webp_path: str, overwrite=False) -> bool:
|
||||
Extracts the thumbnail from an audio file.
|
||||
Returns the path to the thumbnail.
|
||||
"""
|
||||
original_img_path = os.path.join(Paths.get_original_thumb_path(), webp_path)
|
||||
lg_img_path = os.path.join(Paths.get_lg_thumb_path(), webp_path)
|
||||
sm_img_path = os.path.join(Paths.get_sm_thumb_path(), webp_path)
|
||||
|
||||
@@ -42,7 +41,6 @@ def extract_thumb(filepath: str, webp_path: str, overwrite=False) -> bool:
|
||||
width, height = img.size
|
||||
ratio = width / height
|
||||
|
||||
img.save(original_img_path, "webp")
|
||||
img.resize((tsize, int(tsize / ratio)), Image.ANTIALIAS).save(
|
||||
lg_img_path, "webp"
|
||||
)
|
||||
|
||||
@@ -39,3 +39,11 @@ class MoveHashesToSha1(Migration):
|
||||
|
||||
# INFO: Apparentlly, every single table is affected by this migration.
|
||||
# NOTE: Use generators to avoid memory issues.
|
||||
|
||||
|
||||
class DeleteOriginalThumbnails(Migration):
|
||||
"""
|
||||
Original thumbnails are too large and are not needed.
|
||||
"""
|
||||
# TODO: Implement this migration
|
||||
pass
|
||||
|
||||
+1
-5
@@ -73,10 +73,6 @@ class Paths:
|
||||
def get_lg_thumb_path(cls):
|
||||
return join(cls.get_thumbs_path(), "large")
|
||||
|
||||
@classmethod
|
||||
def get_original_thumb_path(cls):
|
||||
return join(cls.get_thumbs_path(), "original")
|
||||
|
||||
@classmethod
|
||||
def get_assets_path(cls):
|
||||
return join(Paths.get_app_dir(), "assets")
|
||||
@@ -92,7 +88,7 @@ class Paths:
|
||||
|
||||
# defaults
|
||||
class Defaults:
|
||||
THUMB_SIZE = 500
|
||||
THUMB_SIZE = 512
|
||||
SM_THUMB_SIZE = 128
|
||||
SM_ARTIST_IMG_SIZE = 128
|
||||
"""
|
||||
|
||||
@@ -54,7 +54,6 @@ def create_config_dir() -> None:
|
||||
thumb_path = os.path.join("images", "thumbnails")
|
||||
small_thumb_path = os.path.join(thumb_path, "small")
|
||||
large_thumb_path = os.path.join(thumb_path, "large")
|
||||
original_thumb_path = os.path.join(thumb_path, "original")
|
||||
|
||||
artist_img_path = os.path.join("images", "artists")
|
||||
small_artist_img_path = os.path.join(artist_img_path, "small")
|
||||
@@ -70,7 +69,6 @@ def create_config_dir() -> None:
|
||||
thumb_path,
|
||||
small_thumb_path,
|
||||
large_thumb_path,
|
||||
original_thumb_path,
|
||||
artist_img_path,
|
||||
small_artist_img_path,
|
||||
large_artist_img_path,
|
||||
|
||||
Reference in New Issue
Block a user