janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
12.79k stars 1.35k forks source link

Cover Image Becomes Deep Fried After Fetching Metadata #2564

Open StrangeRanger opened 2 years ago

StrangeRanger commented 2 years ago

Describe the bug/problem For some reason, after collecting the metadata for the pdf/book in question and saving it, the cover image almost appears to be deep fried.

To Reproduce Steps to reproduce the behavior:

  1. Upload a book
  2. Collect book metadata (ensuring the chosen piece has a cover image)
  3. Save
  4. See the cover image slightly more deep fried in comparison to what had been retrieved prior to saving the metadata.

Logfile

[2022-10-06 15:04:46,708]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Operating%20Systems_%20Three%20Easy%20Pieces%20Remzi%20H.%20Arpaci-Dusseau&as_vis=0&as_sdt=0,33
[2022-10-06 15:05:04,523]  INFO {cps.helper:554} Moving title: /var/www/calibre.randomserver.xyz/gallery/Unknown/Operating Systems_ Three Easy Pieces - Remzi H. Arpaci-Dusseau (52) into existing: /var/www/calibre.randomserver.xyz/gallery/Remzi H. Arpaci-Dusseau/Operating Systems (52)
[2022-10-06 15:05:04,532] ERROR {cps.helper:584} Error in rename file in path [Errno 2] No such file or directory: '/var/www/calibre.randomserver.xyz/gallery/Remzi H. Arpaci-Dusseau/Operating Systems (52)/Operating Systems_ Three Easy Pieces - Rem - Unknown.pdf'
[2022-10-06 15:18:13,271]  WARN {cps.uploader:232} Cannot extract cover image, using default: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/572
[2022-10-06 15:18:13,271]  WARN {cps.uploader:233} On Windows this error could be caused by missing ghostscript
[2022-10-06 15:18:25,097]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Operating%20Systems_%20Three%20Easy%20Pieces%20Remzi%20H.%20Arpaci-Dusseau&as_vis=0&as_sdt=0,33
[2022-10-06 15:19:03,117]  INFO {cps.ub:891} Book 53 archive bit toggled
[2022-10-06 15:19:05,848]  INFO {cps.ub:891} Book 53 archive bit toggled
[2022-10-06 15:19:09,331] ERROR {cps.helper:383} Deleting book 53 from database only, book path in database not valid: Unknown/Operating Systems_ Three Easy Pieces - Remzi H. Arpaci-Dusseau (53)
[2022-10-06 15:19:31,720]  WARN {cps.uploader:232} Cannot extract cover image, using default: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/572
[2022-10-06 15:19:31,721]  WARN {cps.uploader:233} On Windows this error could be caused by missing ghostscript
[2022-10-06 15:19:34,552]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Operating%20Systems_%20Three%20Easy%20Pieces%20Remzi%20H.%20Arpaci-Dusseau&as_vis=0&as_sdt=0,33
[2022-10-06 15:26:34,662]  INFO {cps.web:1159} Serving book: Operating Systems - Remzi H. Arpaci-Dusseau
[2022-10-06 15:30:42,841]  INFO {cps.helper:925} Downloading file: /var/www/calibre.randomserver.xyz/gallery/Sanjay Patel/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond (44)/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond - Sanjay Patel.pdf
[2022-10-06 15:31:29,440]  INFO {cps.helper:925} Downloading file: /var/www/calibre.randomserver.xyz/gallery/Sanjay Patel/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond (44)/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond - Sanjay Patel.pdf
[2022-10-06 15:33:03,181]  WARN {cps.uploader:232} Cannot extract cover image, using default: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/572
[2022-10-06 15:33:03,181]  WARN {cps.uploader:233} On Windows this error could be caused by missing ghostscript
[2022-10-06 15:33:06,804]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Operating%20Systems_%20Three%20Easy%20Pieces%20Remzi%20H.%20Arpaci-Dusseau&as_vis=0&as_sdt=0,33
[2022-10-06 15:33:15,688]  INFO {cps.helper:925} Downloading file: /var/www/calibre.randomserver.xyz/gallery/Sanjay Patel/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond (44)/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond - Sanjay Patel.pdf
[2022-10-06 15:33:17,244]  INFO {cps.helper:925} Downloading file: /var/www/calibre.randomserver.xyz/gallery/Sanjay Patel/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond (44)/Loose Leaf for Introduction to Computing Systems_ From Bits & Gates to C & Beyond - Sanjay Patel.pdf
[2022-10-06 15:36:15,229]  INFO {cps.web:1159} Serving book: Operating Systems - Remzi H. Arpaci-Dusseau
[2022-10-06 15:36:38,527]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Absolute%20OpenBSD%252C%202nd%20Edition&as_vis=0&as_sdt=0,33
[2022-10-06 15:40:51,416]  INFO {scholarly:95} Getting https://scholar.google.com/scholar?hl=en&q=Absolute%20OpenBSD%252C%202nd%20Edition&as_vis=0&as_sdt=0,33

Expected behavior The cover image looks the way it does before saving metadata

Screenshots

Screen Shot 2022-10-06 at 3 41 02 PM Screen Shot 2022-10-06 at 3 41 17 PM

Environment (please complete the following information):

naclander commented 1 year ago

I have the same problem running Calibre-Web version: 0.6.19 on Arch Linux.

I'm wondering if this line is the culprit: https://github.com/janeczku/calibre-web/blob/master/cps/cover.py#L38

JManch commented 6 months ago

Deleting these two lines fixes it for me. https://github.com/janeczku/calibre-web/blob/fcc95bd8953c0b1c00c7af1dfd2f3bb3b3c9dbd0/cps/helper.py#L920 https://github.com/janeczku/calibre-web/blob/fcc95bd8953c0b1c00c7af1dfd2f3bb3b3c9dbd0/cps/cover.py#L38