Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 676664 - app-text/calibre does not show cover images and can't obtain them
Summary: app-text/calibre does not show cover images and can't obtain them
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Ian Stakenvicius (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-28 21:15 UTC by Paweł Ciechomski
Modified: 2020-07-17 19:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Point no 1 and 2 (2019-01-28-221245_201x287_scrot.png,45.84 KB, image/png)
2019-01-28 21:15 UTC, Paweł Ciechomski
Details
Log from built in cover lookup tool (file_676664.txt,11.05 KB, text/plain)
2019-01-28 21:17 UTC, Paweł Ciechomski
Details
emerge --info (file_676664.txt,5.73 KB, text/plain)
2019-01-28 21:18 UTC, Paweł Ciechomski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paweł Ciechomski 2019-01-28 21:15:35 UTC
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.
Comment 1 Paweł Ciechomski 2019-01-28 21:17:11 UTC
Created attachment 563142 [details]
Log from built in cover lookup tool
Comment 2 Paweł Ciechomski 2019-01-28 21:18:11 UTC
Created attachment 563144 [details]
emerge --info
Comment 3 Paweł Ciechomski 2019-02-02 09:01:54 UTC
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
Comment 4 Nick Pelepchan 2020-07-17 19:02:49 UTC
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.

Details:
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')
Python 3.7.8
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
    widget.commit(self.db, self.book_id)
  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
    self.new_api.set_cover({book_id:data})
  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
    save_cover_data_to(data, path)
  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
Comment 5 Larry the Git Cow gentoo-dev 2020-07-17 19:52:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=108b5f0b6207ccf5bb485c95e16869829f4422a0

commit 108b5f0b6207ccf5bb485c95e16869829f4422a0
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-07-17 19:48:03 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-07-17 19:52:47 +0000

    app-text/calibre: Require qtgui[jpeg]
    
    Closes: https://bugs.gentoo.org/676664
    Package-Manager: Portage-2.3.103, Repoman-2.3.23
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 app-text/calibre/calibre-4.9.1-r3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)