Remove option to disable webp

This commit is contained in:
Simon Bruder 2019-12-31 14:19:56 +00:00
parent d02ae9dbb4
commit cfe77a82c1
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -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: