03-16-2017, 12:31 PM | #1 |
Voracious reader
Posts: 56
Karma: 14644
Join Date: Oct 2009
Device: Kobo Aura One, Sony PRS T2, iPhone 6, Cybook Orizon, Cybook Gen3
|
how to automatize routine modifications to epubs?
I'm always performing the same fixes to my epubs before reading them, and I was wondering if there's a way to automatize all the work (or at least part of it).
The operations I normally do manually within calibre's editor are: — "beautify" all the files (this is needed mainly for the searches&replaces to work properly) — fix the ellipsis in all text files — remove line-height and text-alignment: justify in all the css — set all non-zero values for text-indent to 1em — some other stuff very similar to the previous points I already have a bunch of saved searches, but given that all these operations don't require discretion, is there a plugin or a smarter way to manage all this? Thanks |
03-16-2017, 01:47 PM | #2 |
Guru
Posts: 631
Karma: 7544080
Join Date: Apr 2013
Location: Berlin
Device: PRS 350, Kobo Aura
|
I changed the modifyEpub plugin for similar things. If you know a little bit of python, this is quite easy.
|
03-16-2017, 02:33 PM | #3 |
Voracious reader
Posts: 56
Karma: 14644
Join Date: Oct 2009
Device: Kobo Aura One, Sony PRS T2, iPhone 6, Cybook Orizon, Cybook Gen3
|
|
03-16-2017, 10:40 PM | #4 | |
Grand Sorcerer
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Something you can do is to put all the searches a group and run the group. That still means you need to open the book in the editor, but it reduces the steps involved. A thought would be to find someone to write a plugin that can execute saved searches on a set of books without opening the books in the editor. I have no idea if there is support in the calibre framework to do this, so I don't know how possible it is. If you are lucky, just this suggestion will prompt someone to do it. I'm just hoping I can resist the urge. |
|
03-17-2017, 12:39 AM | #5 | |
Guru
Posts: 769
Karma: 6528026
Join Date: Sep 2012
Device: Kobo Elipsa
|
Quote:
|
|
03-17-2017, 02:33 AM | #6 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can use the Look & Feel->Transform styles tool to accomplish the CSS changes automatically during a conversion. And the Search & Replace tool to do the ellipses also in the conversion dialog.
The transform Styles tool is also available in the editor. |
03-17-2017, 11:46 AM | #7 |
Voracious reader
Posts: 56
Karma: 14644
Join Date: Oct 2009
Device: Kobo Aura One, Sony PRS T2, iPhone 6, Cybook Orizon, Cybook Gen3
|
I hadn't thought about doing a conversion from epub to epub. It doesn't automatize everything but it can fix a good amount of issues beforehand. Thank you Kovid
|
03-26-2017, 06:56 AM | #8 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
Along similar lines, is it possible for a user to modify/replace the code that Calibre uses to generate the titlepage.xhtml file when converting a Kindle book to EPUB?
I'm currently handling this by storing my preferred code in a snippet so I can replace the stock XHTML with relative ease, but that still means opening every book in the editor, one by one by one. I'm looking for a way to automate the process. |
03-26-2017, 11:19 AM | #9 | |
Well trained by Cats
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
those take precedence |
|
03-26-2017, 11:23 AM | #10 |
Well trained by Cats
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
BTW those (titlepage and jacket) will also be used when 'sending to device', so no pressing need to convert/edit
|
03-26-2017, 06:59 PM | #11 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
|
03-26-2017, 08:51 PM | #12 |
Well trained by Cats
Posts: 29,809
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
03-27-2017, 10:44 AM | #13 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
The Polish feature, by the look of it, has nothing to do with what I'm after. I don't know why this is such a hard concept to communicate.
I don't want to make a new cover image - based on metadata or anything else. I don't want to add a new HTML page or jacket to the book. I don't want to have to repeat some process for every book, one at a time, as a manual step. I simply want to replace the standard XHTML code that Calibre uses in the first place when it generates a cover page. I want to change that default page's formula so that whenever I convert a Kindle book to EPUB, Calibre will use my HTML instead of whatever it's using now. By definition, that page has to be stored somewhere in Calibre. I just want to know where. This shouldn't involve using a plugin - just learning the location of an existing file or script. Unless, that is, the XHTML in question is hardcoded into a combiled binary, such that changing it would require recompiling the software... which would be a weird choice. |
03-27-2017, 10:58 AM | #14 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
|
03-28-2017, 04:07 AM | #15 |
Wizard
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
|
I am unfortunately not running from source; depending on the machine, I'm running either a Portable build or the Win64 compile. Any idea what file that module ends up in?
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Automatic routine when sending book to device (Kobo) | Doonge | Development | 4 | 11-14-2014 08:20 PM |
What’s your “image rehab” routine? | GrannyGrump | Workshop | 58 | 11-23-2013 03:01 AM |
help with some modifications | moller | Kindle Developer's Corner | 3 | 10-12-2012 02:31 PM |
Different Send to Device routine based on the library. | iatheia | Library Management | 10 | 01-24-2012 12:06 PM |
iLiad Registry modifications | Martijn | iRex Developer's Corner | 7 | 03-27-2008 05:37 PM |