![]() |
#256 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Ok, thx Kovid. I've since found a few bits in the conversion pipeline which actually do affect covers such as "Clean" and "MergeMetadata" in the structure section. That calibre_raster_cover stuff just was very weird though, because it does quite a complex piece of work to generate it all in the input plugin and then it gets thrown away by Clean.
I'll keep plugging away to see what else turns up. Since I know I can't reuse much of that code anyway its going to be a case of writing my own logic but just trying to find as many of the edge cases to handle that calibre has built up over the years. And fingers crossed I avoid some of the problems that exit in the current conversion handling that result in orphaned TOC cover entries or pages containing only a broken cover link... well eventually, anyway. |
![]() |
![]() |
![]() |
#257 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,397
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
IIRC calibre_raster_cover has its type set to cover, which Clean will not throwaway. MergeMetadata will throw it away if the user specifies a cover as a command line option, since that cover obviously takes precedence over the cover from the input plugin.
|
![]() |
![]() |
![]() |
#258 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Ahhh, maybe that's the secret then - the conversion dialog is doing the equivalent of the command line option of passing in a cover. I hadn't yet dissected Clean/Merge Metadata in detail, I just saw that they both "did stuff" related to the cover entries and that the calibre_raster_cover is "gone" by the time it hits the end of that structural section.
|
![]() |
![]() |
![]() |
#259 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@JSWolf - you have been hovering near my Ignore List for a long time. Stop trolling and hijacking threads with your personal tirades, no-one gives a crap about this except you, and it has absolutely nothing to do with this plugin, which will as I said earlier on this thread inherit your calibre default setting.
If you post again on this subject on this thread I am going to use my power as an administrator to delete all your posts from it. Or at least move them into a "JSWolf's bitching" thread. Stop spamming. |
![]() |
![]() |
![]() |
#260 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
I see that the calibre code when it does a conversion discards all of the guide reference entries which are of the "other." type. So if there are thumbnail images of various sizes etc they are all discarded.
e.g. after conversion, the following three will be removed Code:
<guide> <reference href="Images/sand_9781101140536_msr_cvi_r1.jpg" title="Cover" type="other.ms-coverimage-standard" /> <reference href="Images/sand_9781101140536_msr_cvt_r1.jpg" title="ThumbImageStandard" type="other.ms-thumbimage-standard" /> <reference href="Images/sand_9781101140536_msr_ppl_r1.jpg" title="PPCThumbnailImage" type="other.ms-thumbimage" /> Code:
<guide> <reference href="Text/titlepage.xhtml" title="Cover" type="cover" /> |
![]() |
![]() |
![]() |
#261 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,397
Karma: 27756918
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
All the other.* entries are removed for sanity. They serve no purpose (are a legacy from LIT files) and just complicate everything down the line.
|
![]() |
![]() |
![]() |
#262 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,798
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I've never seen a need for a thumbnail image for ePub and for the Kindle. When I see them, I do remove them as all they do is make the eBook larger for no reason.
|
![]() |
![]() |
![]() |
#263 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Beta for next version - insert/replace & delete covers
Alrighty then... after an absolutely horrific number of hours of trawling through thousands of lines of calibre conversion pipeline code and rewriting to the specific needs of this plugin, here at last is a feature that has been "on the list" since the plugin was first incepted - the ability to insert/replace covers for an ePub (without doing a conversion obviously). Yay...
And while I was at it I also added a "Remove existing cover" option, for those of you who had converted text files or whatever and want to rip out the calibre generated covers without reconverting. You will need calibre 0.8.53 to install this beta, because the plugin needs a fix in the calibre code Kovid kindly sorted for me. However you really should be upgrading to this release anyways - in recent weeks Kovid has made a number of important fixes/changes to the ePub conversions which address some of the problems it used to have - mucho thanks! The plugin has various ways of attempting to identify a cover page, removing what it can safely for it, inserting a new cover page (respecting your default options for whether to use SVG or not), rescaling the cover image if required, updating any TOC entry and setting all the appropriate internal manifest data including the device specific workarounds that calibre's conversion pipeline does. I've also rewritten a few of the other features (removing unused image files and remove broken covers) and quite a number of bits of the core in order to do the job "properly". So if you spot any other features broken, please yell. Likewise it would be great to hear from any Mac OS/Unix users to verify these features still work for them since I can only test it on Windows... Needless to say make sure you have a backup of your ePub before trialling the new features in this beta phase in case you hit a combination I haven't tested yet. If you have a problem, just PM me a link to the ePub in its *before* state so I can easily replicate it. Thanks for the help with testing... Last edited by kiwidude; 06-01-2012 at 02:07 PM. Reason: DO NOT DOWNLOAD THIS ZIP - sending code to home |
![]() |
![]() |
![]() |
#264 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,798
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I'll test this new cover modification with iBooks and see if it allows for the cover to be shown.
Here is what works just in case this doesn't. Quote:
|
|
![]() |
![]() |
![]() |
#265 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
New beta uploaded above - thx to JimmXinu for spotting the jackets functionality got "broke".
@JSWolf - first I have seen of that particular post, but in theory it should do what you want I think... except the content id is going to have a slightly different value (one of the calibre conversion workarounds I replicated to make it "cover", not "cover-image"). |
![]() |
![]() |
![]() |
#266 |
Occassional Beta Tester
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 284
Karma: 3516
Join Date: Nov 2010
Location: Hungary
Device: none
|
Hi Kiwidude,
I just tried the new feature on Linux, and got this error: Here is the error message: Code:
calibre, version 0.8.53 HIBA: Modify ePub failed: No ePub files were updated Modify ePubs Logfile for book ID 245 (Three Warriors (Mariah's version) / Mariah) 245 Modifying: /tmp/calibre_0.8.53_tmp_dWcgQt/__4YUp_modify_epub/245.epub Insert or replace cover ...Looking for guide cover reference ...Looking for meta cover ...Looking for other.ms-* guide references to clean out ...Writing new cover image and titlepage html New cover image written to: cover.jpeg New titlepage html written to: titlepage.xhtml ...Updating manifest and TOC for the new cover Manifest item added: titlepage.xhtml (titlepage) Manifest item added: cover.jpeg (cover) Meta item inserted: cover:cover Spine item inserted: titlepage at pos: 0 Three Warriors (Mariah's version) - ERROR: Traceback (most recent call last): File "calibre_plugins.modify_epub.modify", line 69, in process_book File "calibre_plugins.modify_epub.modify", line 180, in _process_book File "calibre_plugins.modify_epub.modify", line 649, in _insert_replace_cover File "calibre_plugins.modify_epub.covers", line 57, in insert_or_replace_cover File "calibre_plugins.modify_epub.covers", line 367, in _add_new_cover_to_manifest File "calibre_plugins.modify_epub.container", line 459, in add_to_guide IndexError: list index out of range ePub not changed after 0.15 seconds |
![]() |
![]() |
![]() |
#267 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@Firedancer885 - I would need to look at the epub to confirm, but it looks to me like the .opf file inside your epub does not have a <guide> element in it. Any chance you could either PM me a link to the epub, or else use the Tweak epub feature, grab the contents of the .opf file inside it and post them in a spoiler on this thread?
Not having a <guide> entry while "unusual" is probably not illegal as far as an epub specification is concerned, so I will need to add some code to add it to the .opf manifest before trying to add the cover reference inside it. However I would like to confirm that is indeed the case in your situation. |
![]() |
![]() |
![]() |
#268 |
Occassional Beta Tester
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 284
Karma: 3516
Join Date: Nov 2010
Location: Hungary
Device: none
|
I use the Fanfictiondownloader plugin to grab new fanfiction and update the ones already in my library. I'll try the plugin on another of them and see what happens.
Yup, I tried 3 different stories grabbed with FFDL from 2 different sites, all give the same error. The ones not downloaded with FFDL I could modify without a problem. I think the problem is with the FFDL template. Spoiler:
|
![]() |
![]() |
![]() |
#269 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Thx Firedancer - I can see from that opf file that indeed it is missing a <guide> reference as I thought. As to why the ePubs don't have that, not knowing anything about FFDL as I don't use it I couldn't say, perhaps if JimmXinu spots this he can comment.
Certainly my plugin should cope better with this situation regardless, I've already made the fix which I will post soon, got something else I want to look into first. |
![]() |
![]() |
![]() |
#270 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,731
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
New beta version
This contains a few small fixes - download from the previous post here.
It should now handle epubs without a <guide> element in the opf manifest (as per FFDL it seems) and now also won't fail if you happen to tick the "Rewrite CSS" option at the same time. Please let me know here how you are getting on with it - particularly as I said previously Mac OS or Linux users as I am relying on you to test the changes there. How about JSWolf - does the ePub now work with iBooks as you posted about? |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any web-to-epub plugin for internet browser? | bthoven | ePub | 7 | 07-10-2011 05:14 AM |
[Old Thread] Reading epub on viewer inexplicably changes the time stamp of epub | greenapple | Library Management | 20 | 03-19-2011 10:18 PM |
Easy way to modify thread subscription emails in bulk? | snipenekkid | Feedback | 11 | 02-06-2011 03:47 AM |
Another plugin dev question | DiapDealer | Plugins | 2 | 12-11-2010 01:46 PM |
Epub plugin dev | DiapDealer | Plugins | 15 | 11-12-2010 09:36 AM |