View Single Post
Old 12-08-2022, 11:53 PM   #9
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,143
Karma: 169815798
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by tn4w View Post
Ensuring it is not broken is just enough. Sometimes downloads are incomplete due to various reasons, and the image files get broken and unable to load. Checking if an image is not broken doesn't seem to be that complicated (see).

When the user explicitly specifies an image, it is not necessary to check whether the cover is the real one or not because the user already knows it is the legitimate one. The reason the user wants to specify it in the first place is because Calibre occasionally assigns the wrong cover or fails to set a cover.

When downloading the specified image fails, do the normal cover finding task like it does when the --cover option is not set.

Then it must be so for the end users. Then why do you ask them to write code for such a complicated task? Most end users are even unfamiliar with coding.

1. Check the response header like shown in this post.
2. Download the image.
3. Check if it is not broken.
4-a. Add it to Calibre with the book.
4-b. If it is broken or the given URL is not available, do the normal adding book task without the --cover option.
It would appear that instead of pointing the cover image to a URL instead of a file, you now want to download the file and use imghdr to verify the file. Sadly, that would still leave issues with some cover images I've seen returned by searches. Nothing like using a 1800x2700 file which was created by re-sizing a 120x80 image for that fuzzy effect. Perhaps finding that the web site where the cover image was found has a nasty habit of watermarking the downloads.

I didn't ask you to write the code. I asked you for a flow diagram or flowchart which is a lot simpler task. Ask any programmer whom has been handed one. I thought this might get you to think about what you are actually asking for.

The best way at the moment to do a decent job of verifying a cover image is to use the mark one eyeball. In which case, downloading the image and pointing calibre at that file would make more sense than copying the URL.
DNSB is offline   Reply With Quote