Skip to content

Commit

Permalink
MTP driver: Preserve cover aspect ratio for thumbnail generation. Fix…
Browse files Browse the repository at this point in the history
…es #2067755 [Thumbnails for Kindle Scribe are resized and look weird](https://bugs.launchpad.net/calibre/+bug/2067755)
  • Loading branch information
kovidgoyal committed Jun 1, 2024
1 parent 55a19f6 commit 7a2a5a7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/calibre/devices/mtp/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

BASE = importlib.import_module('calibre.devices.mtp.%s.driver'%(
'windows' if iswindows else 'unix')).MTP_DEVICE
DEFAULT_THUMBNAIL_WIDTH, DEFAULT_THUMBNAIL_HEIGHT = 120, 160
DEFAULT_THUMBNAIL_HEIGHT = 320


class MTPInvalidSendPathError(PathError):
Expand All @@ -45,7 +45,6 @@ class MTP_DEVICE(BASE):
NEWS_IN_FOLDER = True
MAX_PATH_LEN = 230
THUMBNAIL_HEIGHT = DEFAULT_THUMBNAIL_HEIGHT
THUMBNAIL_WIDTH = DEFAULT_THUMBNAIL_WIDTH
CAN_SET_METADATA = []
BACKLOADING_ERROR_MESSAGE = None
MANAGES_DEVICE_PRESENCE = True
Expand Down Expand Up @@ -156,9 +155,9 @@ def open(self, device, library_uuid):
self.current_device_defaults, self.current_vid, self.current_pid = self.device_defaults(device, self)
self.calibre_file_paths = self.current_device_defaults.get(
'calibre_file_paths', {'metadata':self.METADATA_CACHE, 'driveinfo':self.DRIVEINFO})
self.THUMBNAIL_WIDTH, self.THUMBNAIL_HEIGHT = DEFAULT_THUMBNAIL_WIDTH, DEFAULT_THUMBNAIL_HEIGHT
self.THUMBNAIL_HEIGHT = DEFAULT_THUMBNAIL_HEIGHT
if self.is_kindle:
self.THUMBNAIL_WIDTH = self.THUMBNAIL_HEIGHT = 500 # see kindle/driver.py
self.THUMBNAIL_HEIGHT = 500 # see kindle/driver.py
try:
self.sync_kindle_thumbnails()
except Exception:
Expand Down

0 comments on commit 7a2a5a7

Please sign in to comment.