Created attachment 563140 [details]
Point no 1 and 2
Calibre in every available version has some problems with displaying covers.
1. It show generic Calibre cover in main window instead of the one used in book, cover is even without title and author.
2. Generating cover in calibre does nothing - new cover is not generated, always shows generic one.
3. Obtaining covers also does not work. Log says that it found covers and download them but it does not show them.
For me looks like some missing image processing related dependency since same versions works perfecly for me on other distros.
Created attachment 563142 [details]
Log from built in cover lookup tool
Created attachment 563144 [details]
Spend some time analyzing Calibre code and finally found a solution.
Calibre uses PyQt5 with USE=gui necessary to install. This flag pulls dev-qt/qtgui but Calibre ebuild does not enforce user to set USE=jpeg to dev-qt/qtgui which is needed to display and generate images, because Calibre uses QtImageWriter class and internally operates on jpeg images.
Adding USE=jpeg to dev-qt/qtgui solves the problem, tested on stable and newest version available in official overlay.
Proposed fix: require USE=jpeg for dev-qt/qtgui in Calibre ebuild
Can confirm that this is still an issue with a fresh install of Calibre. Attempting to manually apply cover art to a book yields the unhandled exception below. Applying USE="jpeg" to dev-qt/qtgui rectifys the error.
calibre, version 4.9.1
ERROR: Unhandled exception: <b>ValueError</b>:Failed to export image as JPEG with error: Unsupported image format
calibre 4.9.1 embedded-python: False is64bit: True
Linux-4.19.66-gentoo-x86_64-Intel-R-_Core-TM-_i7-8550U_CPU_@_1.80GHz-with-gentoo-2.6 Linux ('64bit', 'ELF')
('Linux', '4.19.66-gentoo', '#8 SMP Thu Jul 9 10:40:18 EDT 2020')
Linux: ('Gentoo Base System', '2.6', '')
Interface language: None
Traceback (most recent call last):
File "/usr/lib64/calibre/calibre/gui2/metadata/single.py", line 639, in accept
if not self.apply_changes():
File "/usr/lib64/calibre/calibre/gui2/metadata/single.py", line 614, in apply_changes
File "/usr/lib64/calibre/calibre/gui2/metadata/basic_widgets.py", line 1268, in commit
db.set_cover(id_, self.current_val, notify=False, commit=False)
File "/usr/lib64/calibre/calibre/db/legacy.py", line 714, in set_cover
File "/usr/lib64/calibre/calibre/db/cache.py", line 62, in call_func_with_lock
return func(*args, **kwargs)
File "/usr/lib64/calibre/calibre/db/cache.py", line 1253, in set_cover
self.backend.set_cover(book_id, path, data)
File "/usr/lib64/calibre/calibre/db/backend.py", line 1456, in set_cover
File "/usr/lib64/calibre/calibre/utils/img.py", line 251, in save_cover_data_to
f.write(image_to_data(img, compression_quality, fmt, compression_quality // 10) if changed else data)
File "/usr/lib64/calibre/calibre/utils/img.py", line 163, in image_to_data
raise ValueError('Failed to export image as ' + fmt + ' with error: ' + w.errorString())
ValueError: Failed to export image as JPEG with error: Unsupported image format
The bug has been closed via the following commit(s):
Author: Zac Medico <firstname.lastname@example.org>
AuthorDate: 2020-07-17 19:48:03 +0000
Commit: Zac Medico <email@example.com>
CommitDate: 2020-07-17 19:52:47 +0000
app-text/calibre: Require qtgui[jpeg]
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Zac Medico <firstname.lastname@example.org>
app-text/calibre/calibre-4.9.1-r3.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)