12-25-2016, 10:01 AM | #1 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
[Editor Plugin] EpubCheck
This plugin allows you to check books with EPUBCheck 5.x Make sure that you have Java installed on your machine before installing and running this plugin.
To test whether Java is installed on your machine open a command prompt/terminal window and enter the following command: Code:
java -version Credits: Kovid Goyal who helped me with my Qt5 and Calibre API questions and gave me useful pointers. jackie_w helped me with the subprocess code and thiago.eec provided very helpful pointers. Disclaimer: Since I'm not a programmer you might want to save your books before having them checked by this plugin. (The plugin will also automatically create a checkpoint.) Troubleshooting: If you get a WindowsError: [Error 2] unhandled exception message, the Java binary couldn't be found. Installing/updating Java and re-booting your machine should take care of this problem. Settings: If you're an advanced user, you can change several settings by creating an EpubCheck.json file with one or more of the following entries in the Calibre plugins folder (Preferences > Miscellaneous > Open calibre configuraton directory > plugins): Code:
{ "locale" : "xx", "usage" : true, "java_path": "path/to/java/or/java.exe," "is32bit": false, "github": true, "check_interval": 7 }
Please note that if you specify multiple values, each entry (except for the last one) must be terminated by a comma. (If you only add one entry, don't terminate it with a comma.) If you still can't get the plugin to work, download Pagina Epub-Checker (freeware) and use it with the Calibre Open With plugin. Version History Spoiler:
Last edited by Doitsu; 07-15-2023 at 03:58 AM. Reason: New version with EPUBCheck 5.1.0 |
12-25-2016, 11:50 AM | #2 |
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Hi Doitsu,
Thank you for your work Some feedback. I didn't have any problem installing it but when I run it in the Editor it always removes my docked panel (bottom left on my setup) for the standard calibre Check Book. It's easy enough to go back into View to recheck 'Check Book' but I'd rather not have to do that if possible. Running Check Book also puts it back in place. Also EpubCheck automatically docks itself along the whole of the top of the Editor window. It allows itself to be docked elsewhere (I put it alongside 'Check Book') but when it's run it always moves itself back along the top. Is this deliberate? |
Advert | |
|
12-25-2016, 01:48 PM | #3 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Hi jackie_w,
All the issues that you mentioned are actually by design, because I first run Check Book and then EpubCheck, but this can be easily disabled. I attached a new version, which will no longer close the Check Book window, to my first post. The original behavior can be restored by adding the following entry to EpubCheck.json: Code:
{ "close_cb": true } |
12-25-2016, 04:00 PM | #4 |
null operator (he/him)
Posts: 20,994
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@Doitsu - thanks for the Christmas surprise.
I adjusted your thread title to make it consistent with similar plugins. The Notes at the top of the Plugins Index thread describe what you need to do to get your PI included in the Index. Including it in the Index will ensure users get notified when you release a new version. BR |
12-26-2016, 04:58 AM | #5 | ||
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Quote:
Code:
[*][Editor Plugin] EpubCheck Simple EpubCheck wrapper Version: 0.1.1; Released: 12-25-2016; Calibre: 2.70.0; Author: Doitsu; History: Yes; Platforms: Windows, OSX, Linux |
||
Advert | |
|
12-26-2016, 05:57 AM | #6 |
null operator (he/him)
Posts: 20,994
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@Doitsu - it should get copied to here Index of calibre plugins within the next hour or so, and then it will show up in Get New plugins
BR |
12-26-2016, 10:59 AM | #7 | |
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
|
|
05-03-2017, 11:33 AM | #8 | |
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Hi Doitsu,
I'd like to follow-up on a comment you made here, namely: Quote:
At the moment if I click on an item in the EpubCheck error pane all I ever see is as shown in the attached image. Manually going to the location reported in the epubcheck error message is normally enough for me to figure out what epubcheck doesn't like but an automated go-to option would be nice . |
|
05-03-2017, 12:07 PM | #9 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
@jackie_w: There appears to be a bug in the plugin, because the error message should only be displayed, if epubcheck didn't report a file name.
Also file names should be displayed without path information. For an example, have a look at the attached screenshot, which was generated by running the Linux version of the Calibre epubcheck plugin. Most likely the structure of your epub is different from the structure of my test file or it's an OS-specific bug. Can you please test my test file on your Linux/macOS(?) machine? If it works as designed, please PM me a link to the file that caused the bug or another Public Domain file that causes the same bug. Alternatively, saving the epub in Calibre Editor before running the epubcheck plugin might also take care of this problem. Last edited by Doitsu; 05-03-2017 at 12:09 PM. |
05-03-2017, 12:46 PM | #10 |
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Thanks for a speedy reply.
I'm a Windows 10 user. I tried your test broken.epub. I see exactly the same problem as before - see attached image. Perhaps it is a Windows-only problem or possibly something specific in my Windows setup, but I'm not aware of having done anything 'unusual' to my Windows settings. |
05-03-2017, 12:58 PM | #11 |
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
In case it helps I've just run epubcheck.jar 'raw' from a Windows CMD box. This was the output:
Code:
java -jar epubcheck.jar broken.epub Validating using EPUB version 2.0.1 rules. FATAL(RSC-016): broken.epub/OEBPS/Text/Section0001.xhtml(10,29): Fatal Error while parsing file 'The element type "b" must be terminated by the matching end-tag "</b>".'. ERROR(RSC-005): broken.epub/OEBPS/Text/Section0001.xhtml(-1,-1): Error while parsing file 'The element type "b" must be terminated by the matching end-tag "</b>".'. Check finished with errors epubcheck completed |
05-03-2017, 01:56 PM | #12 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Unfortunately, I wasn't able to reproduce this problem on my 64bit Windows 10 machine. Can you please check your Java version?
I got the following results: Code:
java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b15) Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode, sharing) If you installed Calibre on a drive other than C: could you please temporarily install Calibre on your C: drive to test whether this fixes the bug? If it does, I'll have to update the plugin code to search for drives other than C:. |
05-03-2017, 02:51 PM | #13 | ||
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Code:
java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) Quote:
No, I'm a plain old Windows user. I'm not using a Windows 10 VMWare/VirtualBox. In fact I don't think I'd know how to do this. P.S. I know very little about Java other than to run an update when I get a notification. |
||
05-03-2017, 03:39 PM | #14 | ||
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
I looks like my Java version wasn't up-to-date, but even after installing the latest Java version, I couldn't reproduce your bug.
Quote:
Quote:
I'm afraid I can't help you with your problem, since I can't reproduce it. However, since you appear to be a much better Python programmer than me and the plugin code is really very simple, you might be able to locate the problem yourself. Try to comment out the following sections in main.py: 1. lines 154-157 Code:
if iswindows: drive_letter = os.getenv("SystemDrive") line = re.sub(drive_letter, 'C^', line) line = re.sub(drive_letter.lower(), 'C^', line) Code:
if iswindows: filename = os.path.basename(re.sub('C^', drive_letter, filename)) It that doesn't work, uncomment the above sections and insert the following line after line #219 Code:
error_messages.append((filepath, linenumber, err_code, message))
QMessageBox.information(self.gui, "Debug", "filepath: " + str(filepath) + '\n' + "linenumber: " + str(linenumber) + '\n' + "err_code: " + str(err_code) + '\n' + "message: " + str(message))
BTW, I got: Code:
filepath: OEBPS/Text/Section0001.xhtml linenumber: 10 err_code: FATAL(RSC-016) message: Section0001.xhtml Line: 10 Col: 29 FATAL(RSC-016): Fatal Error while parsing file 'The element type "b" must be terminated by the matching end-tag "</b>".'. Code:
filepath: OEBPS/Text/Section0001.xhtml linenumber: None err_code: ERROR(RSC-005) message: Section0001.xhtml ERROR(RSC-005): Error while parsing file 'The element type "b" must be terminated by the matching end-tag "</b>".'. |
||
05-03-2017, 05:27 PM | #15 | ||
Grand Sorcerer
Posts: 6,216
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Quote:
Commenting out those sections didn't help. The contents of the extra QMessageBoxs for the 2 errors are attached below. My output text does seem to be very different from yours. No wonder there are problems. We could use some feedback from another Windows user to see if it's Windows in general or something about my PC. Either way, don't worry as the plugin as-is lets me know what needs fixing. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
epubcheck plugin for Sigil | Doitsu | Plugins | 533 | 10-24-2024 04:32 PM |
Open Metadata Editor from plugin | notbuu | Development | 5 | 10-05-2016 01:10 AM |
Sample Plugin for the Editor | DiapDealer | Editor | 77 | 12-10-2014 08:16 AM |
Editor plugin question | DiapDealer | Development | 2 | 07-28-2014 11:23 PM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 10:53 PM |