mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix cover handling in device drivers
This commit is contained in:
parent
22f0d6908c
commit
5e3cb90b12
@ -275,7 +275,7 @@ class DevicePlugin(Plugin):
|
||||
:metadata: If not None, it is a list of :class:`MetaInformation` objects.
|
||||
The idea is to use the metadata to determine where on the device to
|
||||
put the book. len(metadata) == len(files). Apart from the regular
|
||||
cover_data, there may also be a thumbnail attribute, which should
|
||||
cover (path to cover), there may also be a thumbnail attribute, which should
|
||||
be used in preference. The thumbnail attribute is of the form
|
||||
(width, height, cover_data as jpeg). In addition the MetaInformation
|
||||
objects can have a tag_order attribute.
|
||||
|
@ -715,8 +715,9 @@ class DeviceGUI(object):
|
||||
prefix = ascii_filename(prefix)
|
||||
names.append('%s_%d%s'%(prefix, id,
|
||||
os.path.splitext(f.name)[1]))
|
||||
if mi.cover_data and mi.cover_data[1]:
|
||||
mi.thumbnail = self.cover_to_thumbnail(mi.cover_data[1])
|
||||
if mi.cover and os.path.access(mi.cover, os.R_OK):
|
||||
mi.thumbnail = self.cover_to_thumbnail(open(mi.cover,
|
||||
'rb').read())
|
||||
dynamic.set('news_to_be_synced', set([]))
|
||||
if config['upload_news_to_device'] and files:
|
||||
remove = ids if \
|
||||
@ -751,8 +752,9 @@ class DeviceGUI(object):
|
||||
metadata = self.library_view.model().metadata_for(ids)
|
||||
ids = iter(ids)
|
||||
for mi in metadata:
|
||||
if mi.cover_data and mi.cover_data[1]:
|
||||
mi.thumbnail = self.cover_to_thumbnail(mi.cover_data[1])
|
||||
if mi.cover and os.path.access(mi.cover, os.R_OK):
|
||||
mi.thumbnail = self.cover_to_thumbnail(open(mi.cover,
|
||||
'rb').read())
|
||||
imetadata = iter(metadata)
|
||||
|
||||
files = [getattr(f, 'name', None) for f in _files]
|
||||
|
@ -405,7 +405,7 @@ class BooksModel(QAbstractTableModel):
|
||||
mi = self.db.get_metadata(id, index_is_id=True)
|
||||
if mi.series is not None:
|
||||
mi.tag_order = { mi.series: self.db.books_in_series_of(id,
|
||||
index_is_id=True)}
|
||||
index_is_id=True, get_cover=True)}
|
||||
ans.append(mi)
|
||||
return ans
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user