03-04-2013, 04:38 AM | #406 | |
Tech appreciator
Posts: 23
Karma: 10
Join Date: Jul 2012
Device: Onyx Boox Kepler Pro (wow I love this reader!)
|
Quote:
While it sounds like there may be some improvement to Sigil when it looks for well formed opf, I gather I could solve the immediate problem and still be able to use the Update metadata selection if I simply turn on the Calibre feature you mention. So, thanks for that! |
|
03-04-2013, 07:23 AM | #407 |
Sigil & calibre developer
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
Kiwidude sent me the two files to look at. Here is what EPUBCheck Says:
So the Modify Plugin is stripping the dc:identifier which is means the OPF is now invalid. Sigil is detecting this and fixing the OPF. However, it does appear that Sigil's correction needs a bit of work since it should use the spine, manifest and any individual metadata elements when it creates the new (correct) OPF. Where the date issue came from I don't know because I don't get that with EPUBCheck... |
Advert | |
|
03-04-2013, 10:23 AM | #408 |
Resident Curmudgeon
Posts: 73,894
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
delete post
|
03-04-2013, 12:18 PM | #409 |
Junior Member
Posts: 3
Karma: 10
Join Date: Mar 2013
Device: iPad /
|
XPGT parsing "bug"
In doing a "modify ePub" of a batch of books to remove known artifacts and pro-actively remove margins from Adobe .xpgt files, I had several books "fail" when looking at the log file.
The "root cause" is that the epub's I was processing had empty (zero length/zero size) .xpgt files. This *only* causes a problem when a user of Modify ePub selects several different options (like removing iTunes files or OS artifact files) AND remove margins. In that case the processing will fail. What really should happen is everything else "goes like normal" but the margins aren't removed (since there aren't any.) So maybe change the code to check for a zero length file and "skip it" if it is empty. The error message in the log was: File "calibre_plugins.modify_epub.modify", line 72, in process_book File "calibre_plugins.modify_epub.modify", line 142, in _process_book File "calibre_plugins.modify_epub.modify", line 313, in _zero_xpgt_margins File "calibre_plugins.modify_epub.container", line 229, in get_parsed_etree ParseError: Failed to parse: ops/styles/page-template.xpgt with error: None ePub not changed after 1.52 seconds From a feature question standpoint - is there a way to remove .xpgt files only if they are empty? I suppose it doesn't really matter if they exist if they are empty, but just curious. |
03-04-2013, 01:27 PM | #410 |
Resident Curmudgeon
Posts: 73,894
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
What it looks like is that the Modify ePub sees that there is a page-template.xpgt file and also expects there to be an entry for it in the OPF. So it failed because there was a page-template file but no entry in the OPF. It has nothing to do with the size/contents of the page-template file.
|
Advert | |
|
03-04-2013, 01:41 PM | #411 |
Junior Member
Posts: 3
Karma: 10
Join Date: Mar 2013
Device: iPad /
|
@JSWolf - respectfully disagree. From the OPF (of a copy that never went through Modify ePub):
Code:
<item id="pt" href="page-template.xpgt" media-type="application/vnd.adobe.page-template+xml" /> So, removing margins of an xpgt fails when the xpgt is in the OPF but the file is zero length. |
03-04-2013, 02:00 PM | #412 | |
Resident Curmudgeon
Posts: 73,894
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
But, I did misread the error message. But if you are removing the margins, set the plugin to delete the file. It's not needed. |
|
03-04-2013, 02:11 PM | #413 | |
Junior Member
Posts: 3
Karma: 10
Join Date: Mar 2013
Device: iPad /
|
Quote:
The code should still not error on an XML file that's empty. |
|
03-04-2013, 02:14 PM | #414 | |
Resident Curmudgeon
Posts: 73,894
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
But if you do remove margins and the page-template is empty, it should be deleted (IMHO). |
|
03-04-2013, 08:13 PM | #415 | |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
Firstly, Sigil does need to handle these ePubs better so as to not just silently generate a "random" (alphabetical) opf and muck up the book. The guys are working on that one which is brilliant. Secondly it seems to be that with the combination of settings Barb B chose, the dc:identifier node is completely missing from the resulting ePub. I need to look into what caused that to happen. Thirdly, the calibre save to disk logic (which is what update metadata calls) is producing an invalid identifier node. The original book goes from this: Code:
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="PrimaryID" version="2.0"> ... <dc:identifier id="PrimaryID" opf:scheme="ISBN">978-0-440-42334-8</dc:identifier> Code:
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="PrimaryID" version="2.0"> ... <dc:identifier opf:scheme="calibre">7f516111-8b74-4a4a-bf8c-79742d3bec9c</dc:identifier> |
|
03-04-2013, 11:00 PM | #416 |
creator of calibre
Posts: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@kiwidude: The metadata object you are passing to set_metadata probably has mi.uuid != None or mi.application_id != None. Dont do that if you dont want to change the book uuid.
Last edited by kovidgoyal; 03-04-2013 at 11:06 PM. |
03-05-2013, 12:32 AM | #417 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@Kovid, thx I will check into that.
However I am specifically using the example of adding the book to calibre and then just doing save to disk on it, not using the Modify ePub plugin at all? Those steps are what produces the identifier with the missing id attribute? And I *think* (testing my memory here) that this only occurred when I turned off "get metadata from file contents" when adding the book to calibre just before the save to disk. With the "get metadata" option turned on, save to disk worked ok (or at least the book opened in Sigil ok, which I assume to mean the id was present). But I would need to recheck that - certainly what I described above is what happens with get metadata turned off... |
03-05-2013, 12:59 AM | #418 |
creator of calibre
Posts: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
03-07-2013, 10:55 PM | #419 |
Plugin Developer
Posts: 6,307
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
@kiwidude,
FYI, if you're not following it, we discovered in this thread that the CLI instructions you included in the zip for Modify ePub are out of date. (I'd also suggest adding CRs to the line ends in the readme.txt and example.cmd files since Windoze notepad still inexplicably continues to ignore unix style newlines.) |
03-16-2013, 04:12 PM | #420 |
Tech appreciator
Posts: 23
Karma: 10
Join Date: Jul 2012
Device: Onyx Boox Kepler Pro (wow I love this reader!)
|
@Kiwidude,
How hard would it be to add an option that performs a regex search/replace in the opf, to get rid of the 'linear="no"' instructions from the spine? I'm doing it manually now using linear="[a-z]*" as my find value, and it would be ever so handy to get it in the same pass with all the other great stuff this plugin does. Do you think it fits conceptually with the overall intent of the tool? Last edited by Barb-B; 03-29-2013 at 02:36 AM. |
Tags |
modify epub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Quality Check | kiwidude | Plugins | 1184 | 04-17-2024 06:17 PM |
[GUI Plugin] Open With | kiwidude | Plugins | 403 | 04-01-2024 08:39 AM |
[GUI Plugin] Manage Series | kiwidude | Plugins | 166 | 02-13-2024 11:31 AM |
Modify ePub plugin dev thread | kiwidude | Development | 346 | 09-02-2013 05:14 PM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |