mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Kill letterboxing in KOBO
It makes no sense without an "honor AR" option ;).
This commit is contained in:
parent
5883667ebe
commit
a79f9b9b54
@ -139,12 +139,6 @@ class KOBO(USBMS):
|
|||||||
'to perform full read-write functionality - Here be Dragons!! '
|
'to perform full read-write functionality - Here be Dragons!! '
|
||||||
'Enable only if you are comfortable with restoring your kobo '
|
'Enable only if you are comfortable with restoring your kobo '
|
||||||
'to factory defaults and testing software'),
|
'to factory defaults and testing software'),
|
||||||
_('Letterbox full-screen covers') + ':::'+_(
|
|
||||||
'Do it on our end, instead of letting Nickel handle it. '
|
|
||||||
'Provides pixel-perfect results on devices where Nickel does not do extra processing. '
|
|
||||||
'Obviously has no effect without "Keep cover aspect ratio". '
|
|
||||||
'This is probably undesirable if you disable the "Show book covers full screen" '
|
|
||||||
'setting on your device.'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_CUSTOMIZATION_DEFAULT = [
|
EXTRA_CUSTOMIZATION_DEFAULT = [
|
||||||
@ -154,7 +148,6 @@ class KOBO(USBMS):
|
|||||||
True,
|
True,
|
||||||
False,
|
False,
|
||||||
False,
|
False,
|
||||||
False,
|
|
||||||
False
|
False
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -165,7 +158,6 @@ class KOBO(USBMS):
|
|||||||
OPT_SHOW_PREVIEWS = 4
|
OPT_SHOW_PREVIEWS = 4
|
||||||
OPT_SHOW_RECOMMENDATIONS = 5
|
OPT_SHOW_RECOMMENDATIONS = 5
|
||||||
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
||||||
OPT_LETTERBOX_FULLSCREEN_COVERS = 7
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
USBMS.__init__(self, *args, **kwargs)
|
USBMS.__init__(self, *args, **kwargs)
|
||||||
@ -1006,18 +998,13 @@ class KOBO(USBMS):
|
|||||||
else:
|
else:
|
||||||
uploadgrayscale = True
|
uploadgrayscale = True
|
||||||
|
|
||||||
if not opts.extra_customization[self.OPT_LETTERBOX_FULLSCREEN_COVERS]:
|
|
||||||
letterboxcovers = False
|
|
||||||
else:
|
|
||||||
letterboxcovers = True
|
|
||||||
|
|
||||||
debug_print('KOBO: uploading cover')
|
debug_print('KOBO: uploading cover')
|
||||||
try:
|
try:
|
||||||
self._upload_cover(path, filename, metadata, filepath, uploadgrayscale, letterboxcovers)
|
self._upload_cover(path, filename, metadata, filepath, uploadgrayscale)
|
||||||
except:
|
except:
|
||||||
debug_print('FAILED to upload cover', filepath)
|
debug_print('FAILED to upload cover', filepath)
|
||||||
|
|
||||||
def _upload_cover(self, path, filename, metadata, filepath, uploadgrayscale, letterboxcovers):
|
def _upload_cover(self, path, filename, metadata, filepath, uploadgrayscale):
|
||||||
from calibre.utils.img import save_cover_data_to
|
from calibre.utils.img import save_cover_data_to
|
||||||
if metadata.cover:
|
if metadata.cover:
|
||||||
cover = self.normalize_path(metadata.cover.replace('/', os.sep))
|
cover = self.normalize_path(metadata.cover.replace('/', os.sep))
|
||||||
@ -1060,16 +1047,13 @@ class KOBO(USBMS):
|
|||||||
fpath = path + ending
|
fpath = path + ending
|
||||||
fpath = self.normalize_path(fpath.replace('/', os.sep))
|
fpath = self.normalize_path(fpath.replace('/', os.sep))
|
||||||
|
|
||||||
# Only full-screen covers should be letterboxed
|
|
||||||
letterbox = letterboxcovers and "N3_FULL" in ending
|
|
||||||
|
|
||||||
if os.path.exists(fpath):
|
if os.path.exists(fpath):
|
||||||
with lopen(cover, 'rb') as f:
|
with lopen(cover, 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
# Return the data resized and grayscaled/letterboxed if
|
# Return the data resized and grayscaled if
|
||||||
# required
|
# required
|
||||||
data = save_cover_data_to(data, grayscale=uploadgrayscale, resize_to=resize, minify_to=resize, letterbox=letterbox)
|
data = save_cover_data_to(data, grayscale=uploadgrayscale, resize_to=resize, minify_to=resize)
|
||||||
|
|
||||||
with lopen(fpath, 'wb') as f:
|
with lopen(fpath, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
@ -1118,7 +1102,6 @@ class KOBO(USBMS):
|
|||||||
OPT_SHOW_PREVIEWS = 4
|
OPT_SHOW_PREVIEWS = 4
|
||||||
OPT_SHOW_RECOMMENDATIONS = 5
|
OPT_SHOW_RECOMMENDATIONS = 5
|
||||||
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
||||||
OPT_LETTERBOX_FULLSCREEN_COVERS = 7
|
|
||||||
|
|
||||||
p = {}
|
p = {}
|
||||||
p['format_map'] = old_settings.format_map
|
p['format_map'] = old_settings.format_map
|
||||||
@ -1132,7 +1115,6 @@ class KOBO(USBMS):
|
|||||||
|
|
||||||
p['upload_covers'] = old_settings.extra_customization[OPT_UPLOAD_COVERS]
|
p['upload_covers'] = old_settings.extra_customization[OPT_UPLOAD_COVERS]
|
||||||
p['upload_grayscale'] = old_settings.extra_customization[OPT_UPLOAD_GRAYSCALE_COVERS]
|
p['upload_grayscale'] = old_settings.extra_customization[OPT_UPLOAD_GRAYSCALE_COVERS]
|
||||||
p['letterbox_fs_covers'] = old_settings.extra_customization[OPT_LETTERBOX_FULLSCREEN_COVERS]
|
|
||||||
|
|
||||||
p['show_expired_books'] = old_settings.extra_customization[OPT_SHOW_EXPIRED_BOOK_RECORDS]
|
p['show_expired_books'] = old_settings.extra_customization[OPT_SHOW_EXPIRED_BOOK_RECORDS]
|
||||||
p['show_previews'] = old_settings.extra_customization[OPT_SHOW_PREVIEWS]
|
p['show_previews'] = old_settings.extra_customization[OPT_SHOW_PREVIEWS]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2015-2018, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2015-2019, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
Loading…
x
Reference in New Issue
Block a user