fixed custom cover resize

This commit is contained in:
Zurdi
2024-01-24 19:25:06 +01:00
parent dc8755c7c7
commit e688d4e2fe
2 changed files with 4 additions and 2 deletions

View File

@@ -281,10 +281,12 @@ async def update_rom(
file_location_s = f"{artwork_path}/small.{file_ext}"
with open(file_location_s, "wb+") as artwork_s:
artwork_s.write(artwork_file)
fs_resource_handler.resize_cover(file_location_s)
file_location_l = f"{artwork_path}/big.{file_ext}"
with open(file_location_l, "wb+") as artwork_l:
artwork_l.write(artwork_file)
fs_resource_handler.resize_cover(file_location_l)
db_rom_handler.update_rom(id, cleaned_data)

View File

@@ -45,7 +45,7 @@ class FSResourceHandler(FSHandler):
)
@staticmethod
def _resize_cover(cover_path: str, size: CoverSize) -> None:
def resize_cover(cover_path: str, size: CoverSize = CoverSize.BIG) -> None:
"""Resizes the cover image to the standard size
Args:
@@ -97,7 +97,7 @@ class FSResourceHandler(FSHandler):
Path(cover_path).mkdir(parents=True, exist_ok=True)
with open(f"{cover_path}/{cover_file}", "wb") as f:
shutil.copyfileobj(res.raw, f)
self._resize_cover(f"{cover_path}/{cover_file}", size)
self.resize_cover(f"{cover_path}/{cover_file}", size)
@staticmethod
def _get_cover_path(fs_slug: str, rom_name: str, size: CoverSize):