10-01-2011, 02:47 PM | #196 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
I'm saying that unless you do not use the Save to disk/Send to device function, your cover is going to (most of the time) get overwritten in your ePubs anyway when it ends up on your device/folder. So using this plugin to try to just update the metadata but not the cover is "futile" if your intent is to 100% guarantee that when the ePub is exported from calibre it still has your original large cover that is embedded. The only way I know of to ensure the cover remains at its large size, is to extract the cover from the ePub and make it your calibre cover. In which case using the update metadata command of the plugin is going to not negatively impact your cover at all since it will replace it with the same one.
|
10-01-2011, 06:32 PM | #197 | |
Addict
Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
Quote:
In my opinion there is a big advantage if you should provide the option as separated functions. You've created a plugin that can change parts of the content of an epub without editing other files. E.g. if I use the calibre explode and repack function, or use sigil, they all change additional files. e.g. files not in the opf are removed. This is not always what you want. In my case, I often want to change just some info. E.g. a lot of files do have the author swapped (ln, fn) or have the language set to UND (or worse, EN while it's not). In that case, this is the only info I want to update. At this moment I unpack the file, change the data in the opf and repack the file (not with use of calibre because of the additional changes). In my opinion it would be great to skip this part and just use the plugin to update the data. imaginary workflow: Import epub in calibre (including available metadata) Edit metadata in metadata window (e.g. swap ln, fn and change lang) Update metadata using the plugin (cover is not touched). This way, I keep most of the original data and only change some info or add some info (lang, pubdate, ....) While I do not need to convert the file, there are no other changes made, it is the fastest way I can think of to update or change some metadata without loosing or changing other files. I was thinking this was one of the main purposes of this plugin (But it seems not to be, I'll have to hack it ). |
|
Advert | |
|
10-02-2011, 08:37 AM | #198 |
Addict
Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
FYI, I made an export of a subset of ebooks in my library.
These are the stats of 7072 epub-files. Maybe you can find some interesting info in it. A very curious one was the pdf file I found in one of the books. The file is manifested on a original epub. content of the pdf: the book cover (to print a paper cover to wrap around a hard-cover book). Including the offset information for the printing office. Curious because this book is sold as e-book this way. Another curious thing was the fact of empty folders and empty files. So, no request this time, just some stats you can maybe use to add extra clean-up functions or just to exclude some files of being removed. The examined files all where cleaned first by using the plugin. That's why e.g. no itunes files are shown. The xpgt files shown are files located in epubs with a bad opf-files causing the plugin to skip this epub while cleaning. Spoiler:
Edit 1: the <none> is the mimetype file. As you can see, some books have more than one opf file. Edit 2: While I did a recursive scan, all zips and rars possible inside epubs are extracted also so they are not shown here, there content is. Edit 3: Distribution of filesize Spoiler:
Last edited by drMerry; 10-02-2011 at 08:42 AM. Reason: extra info |
10-16-2011, 04:53 PM | #199 |
Séduisant
Posts: 4,706
Karma: 2107018
Join Date: Jan 2010
Location: Texas, USA
Device: Boox Note Air2+; Kobo Libra2; Kindle Scribe, Oasis3; iPad Mini6
|
Pardon my ignorance. Where can I find the plugin that's being referenced in this thread? Thank you.
Duh...never mind. Last edited by SCION; 10-16-2011 at 04:58 PM. |
10-16-2011, 08:05 PM | #200 | |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
|
|
Advert | |
|
10-22-2011, 12:40 PM | #201 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
This plugin is now officially released and can be found at this thread in the plugins forum.
|
05-02-2012, 11:29 AM | #202 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
@agama and @paulfiera...
I've got a new version of Quality Check (ready to test) and Modify ePub (in progress) as per the screenshots below... yell if you spot anything obvious I have forgotten. I am intentionally not removing @font-face stuff at this point but if they are replaceable with a regex (rather than requiring css/html parsing) I will add support for it. Perhaps one of the css gurus out there may care to comment on whether some simple regex like "@font\-face\s+{[^}]+?}" would cover sufficient use-cases or not... The other thing I want to investigate is cover insertion at some point though I have no doubt there are gremlins in there. I have seen people mention ePubFixer as something they use currently - is its approach recommended? I could steal ideas from that, but the brief read of its website said it produces svg covers, and I vaguely recall Kovid saying something about those and calibre having options not to produce them which presumably are for a reason... Any chance Kovid or someone who knows about these things could enlighten me with some hints? Idolse "kind of" volunteered to add support for this feature a very long time ago but he seems to have been distracted by other things. |
05-02-2012, 01:17 PM | #203 |
Addict
Posts: 378
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: Kobo Aura ONE, Kobo Libra H20
|
kiwidude: thanks, thanks and thanks
Just being able to identify which epubs have inline font declarations it's a huge time saver. I can take it from there and edit these epubs in Sigil and remove the inline font declarations. Right now I'm opening every single epub in Sigil and checking for inline font declarations. When you take into account that this is a 4.000+ epubs library, well...I'd probably have to quit my day time job to be able to finish this quest in my lifetime Regarding covers: I'd just want to put my 2 cents. More info here. Many, many thanks, again. |
05-02-2012, 01:22 PM | #204 | |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
@kiwidude: Cover insertion is possible, (and you dont need to use SVG) provided you are willing to take the chance that your epub will end up with two, possibly duplicated, covers, in the case where the cover in the original file is not identified correctly. Or the case where the first html file is identified as the cover, but it contains non cover content which will get deleted. EPUB files in the wild are mess. |
|
05-02-2012, 01:31 PM | #205 | |
Addict
Posts: 378
Karma: 3102
Join Date: Dec 2010
Location: EU
Device: Kobo Aura ONE, Kobo Libra H20
|
Quote:
I may be wrong, but when you have only one css applied to an epub, all these declarations apply to every html/xhtml file. Unless, of course, you have inline declarations, which will have higher specificity. I'm aware that there can be several css files in a epub - especially in omnibus editions - and that several font declarations may apply to the different titles contained in an epub. But...when those fonts no longer exist because they have been removed before the conversion, wouldn't it make sense to remove the declarations altogether? Last edited by paulfiera; 05-02-2012 at 02:06 PM. |
|
05-02-2012, 02:20 PM | #206 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
All rules in the css are scoped inside selectors, which means they apply only to the elements matched by the selectors. @font-face rules do not have selectors.
Certainly, however, it just isn't worth the effort. There are all sorts of redundancies in the markup of a typical book. This is just one example. I reserve my cleanup efforts to the cases where the cleanup makes some measurable impact on the performance of the resulting epub. But, that's not to say that I will refuse a patch for it. |
05-02-2012, 03:58 PM | #207 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
I'm still wrapping my head around the font-face in every file thing . So you are saying calibre does it because they "could" be different in each file, since each html file "might" link to a different css file in the original? But in the situation where you have a single css file, and the font-face declarations are contained within it, there is no need to replicate them into the html files, is that correct?
The case where I particularly notice it is when I edit in Sigil. And I have to scroll through hundreds of lines of font declarations just to get to the content (since code view is the only view worth doing most things in Sigil). So I end up writing a regex to blitz the whole inline style section across the epub (which is usually fine unless someone had edited the epub previously in Sigil and used inline styles from its horrible sgc-x Tidy crap). As for the covers, thx for the info Kovid. I wasn't sure if there was some special reason why epubFixer goes the SVG route. If I can avoid that (I don't really know the "why" of SVG in an epub) then all the better. So as I understand it the potential issues are: - always inserting a cover will sometimes duplicate an existing cover. - choosing to replace an existing cover is not good sometimes either, since as you say some epubs mark a content page as the cover. - handling various issues of naming conflicts of a titlepage html, cover.jpg, manifest ids etc - setting the guide to point to the new cover I've certainly seen the impact of calibre's conversions sometimes blitzing content due to poorly defined covers in the original. And the missing image question mark icons from the standard logic getting tripped up. And often an extra blank page if you enable the "remove extra cover" option. There ain't no magic beans with this. I guess the question is what do people want the plugin to do about it. Should the plugin just be completely "dumb" and offer a number of options, like "Replace existing cover" and "Insert cover", leaving it to the user to decide. Or should it try to make an effort to make an "intelligent" guess. For instance... - If a cover is defined in the guide, look for any text inside body html tags. If any text is found, treat the page as *not* being a replacable cover page, and insert a new cover instead. If no text is found, replace the content of that page with a new titlepage like the calibre one. - If no cover is defined, always insert a new titlepage. There might be duplicates from the original not defining the first page as a "cover", but tough luck. Any thoughts welcomed... |
05-02-2012, 09:09 PM | #208 | ||
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Quote:
|
||
05-02-2012, 11:35 PM | #209 | |||
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Also, as a quick and dirty fix, you can convert the epub to kf8 and then convert the kf8 back to epub. (KF8 requires all inline style info to be extracted into stylesheets, so calibre does it automatically in that case. Quote:
Quote:
|
|||
05-03-2012, 03:17 AM | #210 |
Calibre Plugins Developer
Posts: 4,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Thx Kovid. What I am finding for the particular books that I am converting (like rtf files that I export to filtered html and then convert) is that there only ever was one "stylesheet" in the first place. Since I personally don't use metadata jackets, and the calibre cover page only has an image on it I'm trying to figure out if there is any reason for the font-face declarations to be replicated in that scenario? They really are a pain in Sigil, if there could be a conversion option somewhere to turn that off it would be wonderful...
|
|
Similar Threads | ||||
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 |