diff --git a/backend.py b/backend.py index 8321e76..1a979f1 100644 --- a/backend.py +++ b/backend.py @@ -51,25 +51,23 @@ def generate_thumbnail(filepath): class CalibreDB: - def __init__(self, path='metadata.db', enable_webp=True, webp_quality=80, webp_method=0, webp_size=2048): + def __init__(self, path='metadata.db', webp_quality=80, webp_method=0, webp_size=2048): self.database_path = f'file:{path}?mode=ro' - self.webp = enable_webp - if self.webp is True: - # lossy: 0-100 (used as quality) - # lossless: 101-201 (101 subtracted and used as quality) - if webp_quality > 100: - webp_lossless = True - webp_quality = webp_quality - 101 - else: - webp_lossless = False + # lossy: 0-100 (used as quality) + # lossless: 101-201 (101 subtracted and used as quality) + if webp_quality > 100: + webp_lossless = True + webp_quality = webp_quality - 101 + else: + webp_lossless = False - self.webp_config = { - 'quality': webp_quality, - 'method': webp_method, - 'lossless': webp_lossless, - 'size': webp_size - } + self.webp_config = { + 'quality': webp_quality, + 'method': webp_method, + 'lossless': webp_lossless, + 'size': webp_size + } def create_cursor(self): conn = sqlite3.connect(self.database_path, uri=True) @@ -233,7 +231,7 @@ class CalibreDB: page_filename = zip_info.filename mimetype = mimetypes[os.path.splitext(page_filename)[1]] - if self.webp is True and mimetype != 'image/webp' and original is False: + if original is False: mimetype = 'image/webp' try: