mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Support loading of device images from paths instead of keeping them in memory
This commit is contained in:
parent
7aee85def8
commit
7a9135c8e5
@ -380,7 +380,9 @@ class BookList(list):
|
||||
3. size (file size of the book)
|
||||
4. datetime (a UTC time tuple)
|
||||
5. path (path on the device to the book)
|
||||
6. thumbnail (can be None)
|
||||
6. thumbnail (can be None) thumbnail is either a str/bytes object with the
|
||||
image data or it should have an attribute image_path that stores an
|
||||
absolute (platform native) path to the image
|
||||
7. tags (a list of strings, can be empty).
|
||||
'''
|
||||
|
||||
|
@ -1418,9 +1418,12 @@ class DeviceBooksModel(BooksModel):
|
||||
data = {}
|
||||
item = self.db[self.map[current.row()]]
|
||||
cdata = item.thumbnail
|
||||
if cdata:
|
||||
if cdata is not None:
|
||||
img = QImage()
|
||||
img.loadFromData(cdata)
|
||||
if hasattr(cdata, 'image_path'):
|
||||
img.load(cdata.image_path)
|
||||
else:
|
||||
img.loadFromData(cdata)
|
||||
if img.isNull():
|
||||
img = self.default_image
|
||||
data['cover'] = img
|
||||
|
Loading…
x
Reference in New Issue
Block a user