janeczku / calibre-web

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

Kindlegen error while command line convertion works #191

Closed simkin closed 7 years ago

simkin commented 7 years ago

For a specific book the Send To Kindle functionality is not working while I am able to convert the book via the command line

image

Logfile:

[2017-05-03 09:48:31,926] {/opt/calibre-web1/cps/helper.py:104} ERROR - make_mobi: kindlegen failed with error while converting book

Command line convert:

root@nas:/opt/calibre-web/vendor# ./kindlegen /dikkert/Server/Books/Library/DavidEddings/ CastleOfWizardry (31252)/ EnchantersEndGame (16352)/ MagiciansGambit (8881)/ PawnofProphecy (16351)/ QueenofSorcery (11754)/ root@nas:/opt/calibre-web/vendor# ./kindlegen /dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame\ (16352)/ cover.jpg metadata.opf The Belgariad 5 Enchanter's End Game - David Eddings.epub root@nas:/opt/calibre-web/vendor# ./kindlegen /dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame\ (16352)/The\ Belgariad\ 5\ Enchanter\'s\ End\ Game\ -\ David\ Eddings.epub


Amazon kindlegen(Linux) V2.9 build 1028-0897292 A command line e-book compiler Copyright Amazon.com and its Affiliates 2014


Info(prcgen):I1047: Added metadata dc:Title "The Belgariad 5: Enchanter's End Game" Info(prcgen):I1047: Added metadata dc:Date "2011-03-18T20:36:44+00:00" Info(prcgen):I1047: Added metadata dc:Creator "David Eddings" Info(prcgen):I1047: Added metadata dc:Contributor "calibre (0.7.54) [http://calibre-ebook.com]" Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported. Info(prcgen):I1052: Kindle support cover images but does not support cover HTML. Hence using the cover image specified and suppressing cover HTML in content. URL: /tmp/mobi-FZjfrl/titlepage.xhtml Info(prcgen):I1002: Parsing files 0000015 Info(prcgen):I1015: Building PRC file Info(prcgen):I1006: Resolving hyperlinks Info(prcgen):I1008: Resolving start reading location Info(prcgen):I1049: Building table of content URL: /tmp/mobi-FZjfrl/toc.ncx Warning(prcgen):W14019: Cover is too small : /tmp/mobi-FZjfrl/cover.jpeg Info(pagemap):I8000: No Page map found in the book Info(prcgen):I1045: Computing UNICODE ranges used in the book Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E] Info(prcgen):I1017: Building PRC file, record count: 0000240 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 48.75% Info(prcgen):I1040: The document identifier is: "The_Belgaria-nters_End_Game" Info(prcgen):I1041: The file format version is V6 Info(prcgen):I1031: Saving PRC file Info(prcgen):I1033: PRC built with WARNINGS! Info(prcgen):I1016: Building enhanced PRC file Info(prcgen):I1007: Resolving mediaidlinks Info(prcgen):I1011: Writing mediaidlinks Info(prcgen):I1009: Resolving guide items Info(prcgen):I1017: Building PRC file, record count: 0000225 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 51.46% Info(prcgen):I1041: The file format version is V8 Info(prcgen):I1032: PRC built successfully Info(prcgen):I15000: Approximate Standard Mobi Deliverable file size : 0000559KB Info(prcgen):I15001: Approximate KF8 Deliverable file size : 0000559KB Info(prcgen):I1037: Mobi file built with WARNINGS!

Linked Libraries:

Program library Installed Version Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2] Kindlegen Amazon kindlegen(Linux) V2.9 build 1028-0897292 ImageMagick ImageMagick 6.8.9-9 Q16 x86_64 2016-11-26 http://www.imagemagick.org PyPDF2 v1.26.0 Babel v1.3 SqlAlchemy v0.8.3 Flask v0.12 Flask Login v0.4.0 Flask Principal v0.4.0 Tornado web server v4.1 ISO639 Languages v0.4.5 Requests v2.13.0 SQlite v3.16.2 Pysqlite v2.8.3

OzzieIsaacs commented 7 years ago

Could you please set the log level of calibre web to DEBUG (admin -> configuration section), and then do the conversion with calibre-web again, it should than give more output and we can see whats going wrong.

Thanks a lot

simkin commented 7 years ago

Summary: Debug states that file could not be found. When using that same path copied from debug log to manual convert the book, procedure succeeds.

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# tail -f /opt/calibre-web/calibre-web.log

[2017-05-04 08:47:39,667] {/opt/calibre-web1/cps/helper.py:120} DEBUG - reply: retcode (221); Msg: 2.0.0 nas.vault13.eu closing connection [2017-05-04 08:49:31,717] {/opt/calibre-web1/cps/helper.py:91} DEBUG - [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - Amazon kindlegen(Linux) V2.9 build 1028-0897292 [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - A command line e-book compiler [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - Copyright Amazon.com and its Affiliates 2014 [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:91} DEBUG - Error(kindlegen):E30005: Could not find file "/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)/The Belgariad 5_ Enchanter's End Game - David Eddings.epub" [2017-05-04 08:49:31,718] {/opt/calibre-web1/cps/helper.py:104} ERROR - make_mobi: kindlegen failed with error while converting book

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# ls -altr total 533

-rw-r--r-- 1 calibre users 71779 Jul 19 2016 cover.jpg -rw-r--r-- 1 calibre users 346682 Jul 19 2016 The Belgariad 5_ Enchanter's End Game - David Eddings.epub -rw-r--r-- 1 calibre users 1181 Jul 19 2016 metadata.opf drwxr-sr-x 7 calibre users 7 Apr 22 17:38 .. drwxr-sr-x 2 calibre users 5 May 4 08:46 .

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# /opt/calibre-web/vendor/kindlegen "/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)/The Belgariad 5_ Enchanter's End Game - David Eddings.epub"


Amazon kindlegen(Linux) V2.9 build 1028-0897292 A command line e-book compiler Copyright Amazon.com and its Affiliates 2014


Info(prcgen):I1047: Added metadata dc:Title "The Belgariad 5: Enchanter's End Game" Info(prcgen):I1047: Added metadata dc:Date "2011-03-18T20:36:44+00:00" Info(prcgen):I1047: Added metadata dc:Creator "David Eddings" Info(prcgen):I1047: Added metadata dc:Contributor "calibre (0.7.54) [http://calibre-ebook.com]" Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported. Info(prcgen):I1052: Kindle support cover images but does not support cover HTML. Hence using the cover image specified and suppressing cover HTML in content. URL: /tmp/mobi-Q8Xoi0/titlepage.xhtml Info(prcgen):I1002: Parsing files 0000015 Info(prcgen):I1015: Building PRC file Info(prcgen):I1006: Resolving hyperlinks Info(prcgen):I1008: Resolving start reading location Info(prcgen):I1049: Building table of content URL: /tmp/mobi-Q8Xoi0/toc.ncx Warning(prcgen):W14019: Cover is too small : /tmp/mobi-Q8Xoi0/cover.jpeg Info(pagemap):I8000: No Page map found in the book Info(prcgen):I1045: Computing UNICODE ranges used in the book Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E] Info(prcgen):I1017: Building PRC file, record count: 0000240 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 48.75% Info(prcgen):I1040: The document identifier is: "The_Belgaria-nters_End_Game" Info(prcgen):I1041: The file format version is V6 Info(prcgen):I1031: Saving PRC file Info(prcgen):I1033: PRC built with WARNINGS! Info(prcgen):I1016: Building enhanced PRC file Info(prcgen):I1007: Resolving mediaidlinks Info(prcgen):I1011: Writing mediaidlinks Info(prcgen):I1009: Resolving guide items Info(prcgen):I1017: Building PRC file, record count: 0000225 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 51.46% Info(prcgen):I1041: The file format version is V8 Info(prcgen):I1032: PRC built successfully Info(prcgen):I15000: Approximate Standard Mobi Deliverable file size : 0000559KB Info(prcgen):I15001: Approximate KF8 Deliverable file size : 0000559KB Info(prcgen):I1037: Mobi file built with WARNINGS!

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# ls -altr

total 1952 -rw-r--r-- 1 calibre users 71779 Jul 19 2016 cover.jpg -rw-r--r-- 1 calibre users 346682 Jul 19 2016 The Belgariad 5 Enchanter's End Game - David Eddings.epub -rw-r--r-- 1 calibre users 1181 Jul 19 2016 metadata.opf drwxr-sr-x 7 calibre users 7 Apr 22 17:38 .. -rw-r--r-- 1 root users 1427398 May 4 08:54 The Belgariad 5 Enchanter's End Game - David Eddings.mobi drwxr-sr-x 2 calibre users 6 May 4 08:54 .

OzzieIsaacs commented 7 years ago

Strange. Is "calibre" the user also running calibre-web or does it run as "root"?

OzzieIsaacs commented 7 years ago

You wrote: "For a specific book the Send To Kindle functionality...". Does this mean other books are working?

simkin commented 7 years ago

It is indeed only working for books for which a .mobi file already exists :/ I missed that. calibre-web is runned under 'calibre' user indeed (the root ownership is because I ran the conversion under root.

Running the command as 'calibre;' works as well

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# sudo -u calibre /opt/calibre-web/vendor/kindlegen "/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)/The Belgariad 5_ Enchanter's End Game - David Eddings.epub"


Amazon kindlegen(Linux) V2.9 build 1028-0897292 A command line e-book compiler Copyright Amazon.com and its Affiliates 2014


Info(prcgen):I1047: Added metadata dc:Title "The Belgariad 5: Enchanter's End Game" Info(prcgen):I1047: Added metadata dc:Date "2011-03-18T20:36:44+00:00" Info(prcgen):I1047: Added metadata dc:Creator "David Eddings" Info(prcgen):I1047: Added metadata dc:Contributor "calibre (0.7.54) [http://calibre-ebook.com]" Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported. Info(prcgen):I1052: Kindle support cover images but does not support cover HTML. Hence using the cover image specified and suppressing cover HTML in content. URL: /tmp/mobi-GVTSnc/titlepage.xhtml Info(prcgen):I1002: Parsing files 0000015 Info(prcgen):I1015: Building PRC file Info(prcgen):I1006: Resolving hyperlinks Info(prcgen):I1008: Resolving start reading location Info(prcgen):I1049: Building table of content URL: /tmp/mobi-GVTSnc/toc.ncx Warning(prcgen):W14019: Cover is too small : /tmp/mobi-GVTSnc/cover.jpeg Info(pagemap):I8000: No Page map found in the book Info(prcgen):I1045: Computing UNICODE ranges used in the book Info(prcgen):I1046: Found UNICODE range: Basic Latin [20..7E] Info(prcgen):I1017: Building PRC file, record count: 0000240 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 48.75% Info(prcgen):I1040: The document identifier is: "The_Belgaria-nters_End_Game" Info(prcgen):I1041: The file format version is V6 Info(prcgen):I1031: Saving PRC file Info(prcgen):I1033: PRC built with WARNINGS! Info(prcgen):I1016: Building enhanced PRC file Info(prcgen):I1007: Resolving mediaidlinks Info(prcgen):I1011: Writing mediaidlinks Info(prcgen):I1009: Resolving guide items Info(prcgen):I1017: Building PRC file, record count: 0000225 Info(prcgen):I1039: Final stats - text compressed to (in % of original size): 51.46% Info(prcgen):I1041: The file format version is V8 Info(prcgen):I1032: PRC built successfully Info(prcgen):I15000: Approximate Standard Mobi Deliverable file size : 0000559KB Info(prcgen):I15001: Approximate KF8 Deliverable file size : 0000559KB Info(prcgen):I1037: Mobi file built with WARNINGS!

root@nas:/dikkert/Server/Books/Library/DavidEddings/EnchantersEndGame (16352)# ls -altrh total 2.0M

-rw-r--r-- 1 calibre users 71K Jul 19 2016 cover.jpg -rw-r--r-- 1 calibre users 339K Jul 19 2016 The Belgariad 5 Enchanter's End Game - David Eddings.epub -rw-r--r-- 1 calibre users 1.2K Jul 19 2016 metadata.opf drwxr-sr-x 7 calibre users 7 Apr 22 17:38 .. -rw-r--r-- 1 calibre users 1.4M May 4 09:29 The Belgariad 5 Enchanter's End Game - David Eddings.mobi drwxr-sr-x 2 calibre users 6 May 4 09:29 .

OzzieIsaacs commented 7 years ago

With the latest commit it should now work again

simkin commented 7 years ago

Confirmed fixed, thanks mate!

ps: currently it still fails if no language is defined, perhaps you like to inform the user the language needs to be set before trying to sent to kindle? not sure if you can check on that

Error(prcgen):E23006: Language not recognized in metadata. The dc:Language field is mandatory. Aborting.