Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-03-2014, 12:38 PM   #601
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Just looked at source of this PI and I think you could hi-jack the smarten-punctuation function, in modify.py - line 497 calls the smarten routine for each of the raw html files, so if you called a 'span-trim' function instead, that should manage it.

Edit: Backup your existing PI, and any testing epubs beforehand.

Last edited by Perkin; 04-03-2014 at 12:43 PM.
Perkin is offline   Reply With Quote
Old 04-03-2014, 12:52 PM   #602
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
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
Quote:
Originally Posted by Perkin View Post
Just looked at source of this PI and I think you could hi-jack the smarten-punctuation function, in modify.py - line 497 calls the smarten routine for each of the raw html files, so if you called a 'span-trim' function instead, that should manage it.

Edit: Backup your existing PI, and any testing epubs beforehand.
I'm not seeing that file...where did you find it?
Rev. Bob is offline   Reply With Quote
Advert
Old 04-03-2014, 01:27 PM   #603
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Inside the 'modify epub.zip' - the actual plugin.

Unzip
Edit/modify.
re-zip.
Test
repeat
Perkin is offline   Reply With Quote
Old 04-03-2014, 01:49 PM   #604
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
@Rev. Bob
This is a modified 'modify epub' plugin that contains the changes.
Please note that I haven't tested it as I haven't got a file that needs modifying.
Backup your original 'modify epub.zip', then replace with this version.
run the modify epub plugin on required file ONLY with 'smarten punctuation' option set, it will do the strip-spans instead.

Check output.

When needed, restore original plugin.

N.B. THIS IS A MODIFIED VERSION OF THE PLUGIN, DO NOT USE UNLESS YOU HAVE READ THE THREAD AND SEEN WHAT THIS DOES.
Attached Files
File Type: zip Modify ePub.zip (73.1 KB, 220 views)
Perkin is offline   Reply With Quote
Old 04-03-2014, 02:20 PM   #605
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
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
Quote:
Originally Posted by Perkin View Post
Inside the 'modify epub.zip' - the actual plugin.
...which I can't bloody find.

Yes, I know there's a copy of the ZIP in the first post of this thread. I'm saying that I installed it through Calibre's interface, and I can't find where Calibre stashed it. Obviously it's installed, but for the life of me I can't see where it's installed.
Rev. Bob is offline   Reply With Quote
Advert
Old 04-03-2014, 02:25 PM   #606
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Rev. Bob View Post
...which I can't bloody find.

Yes, I know there's a copy of the ZIP in the first post of this thread. I'm saying that I installed it through Calibre's interface, and I can't find where Calibre stashed it. Obviously it's installed, but for the life of me I can't see where it's installed.
Preferences ==> Advanced ==> Miscellaneous

Open calibre configuration directory.

But I'd assume the copy at the beginning of this thread works just as well.
eschwartz is offline   Reply With Quote
Old 04-03-2014, 02:33 PM   #607
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
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
Quote:
Originally Posted by eschwartz View Post
Preferences ==> Advanced ==> Miscellaneous

Open calibre configuration directory.
No wonder I couldn't find it - why the hell is it in AppData/Roaming?

And as for why I was hunting for the installed version - I'd kinda like to be able to strip spans and smarten punctuation at the same time, should a book need it, so I'd prefer to find a way to expand the feature set. Maybe I can, now that I know where everything is...
Rev. Bob is offline   Reply With Quote
Old 04-03-2014, 02:53 PM   #608
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Rev. Bob View Post
No wonder I couldn't find it - why the hell is it in AppData/Roaming?

And as for why I was hunting for the installed version - I'd kinda like to be able to strip spans and smarten punctuation at the same time, should a book need it, so I'd prefer to find a way to expand the feature set. Maybe I can, now that I know where everything is...
Where else would it be? Roaming IIRC is for most appdata besides for caches, to facilitate network domains in business usage.

Also, if you load the (modified) plugin through preferences, it should overwrite/update the current copy. So you could d/l from this thread, update/modify, and reinstall.
eschwartz is offline   Reply With Quote
Old 04-03-2014, 03:02 PM   #609
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Quote:
Originally Posted by Rev. Bob View Post
No wonder I couldn't find it - why the hell is it in AppData/Roaming?
It likes to stretch it's legs once in a while

You would need to add another option to the options pane, and then duplicate the smarten option function code, rewriting to do the strip spans instead.

Can you test to see if that stripping works?

Then we'll see about adding the extra option and associated code.
Perkin is offline   Reply With Quote
Old 04-03-2014, 04:14 PM   #610
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,583
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Rev. Bob View Post
No wonder I couldn't find it - why the hell is it in AppData/Roaming?
Because that's where optional PI's and most other configurable data is stored - keeps the install location (Program Files) pristine - some config data is kept in library databases

If you want to put config data elsewhere then see CALIBRE_CONFIG_DIRECTORY at http://manual.calibre-ebook.com/cust...ment-variables

BR

Last edited by BetterRed; 04-03-2014 at 04:24 PM.
BetterRed is offline   Reply With Quote
Old 04-03-2014, 04:35 PM   #611
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
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
Quote:
Originally Posted by eschwartz View Post
Where else would it be? Roaming IIRC is for most appdata besides for caches, to facilitate network domains in business usage.
Hardly the case here...

Quote:
Originally Posted by Perkin View Post
You would need to add another option to the options pane, and then duplicate the smarten option function code, rewriting to do the strip spans instead.
Way ahead of ya; I've pretty much got that done, but I'm running some test cases to fine-tune things. Mods so far:

- remove_drm_meta_tags now removes the trailing newline as well, so the Adobe line completely goes away instead of leaving a blank line.
- "Smartify punctuation" routine restored.
- New code renamed "strip_spans" and available through the --strip_spans command line option.
- strip_spans expanded to remove "rights.xml" and "kobo.js" - both remnants of the Kobo DRM scheme - from the book and manifest.
- strip_spans expanded to remove the koboSpan CSS rule and references to kobo.js from the (X)HTML files.
- Basic documentation for the new code added to the HTML file.
- Version number bumped to 1.3.10 to avoid any confusion, although 1.3.9b would be more accurate.

In short, strip_spans is now more like a "deKoboify" routine that also happens to remove SPAN elements that have no attributes. I'm almost tempted to split it properly, into strip_spans and dekobo, but I don't really see the point. (Any opinions either way?)

If anyone wants to try to poke holes in the code, the current version is attached. I think I've got it properly bulletproofed, but testing is more than welcome.

EDIT: Code revised after further testing.
Attached Files
File Type: zip Modify ePub - stripspans.zip (150.5 KB, 190 views)

Last edited by Rev. Bob; 04-03-2014 at 06:26 PM.
Rev. Bob is offline   Reply With Quote
Old 04-03-2014, 04:37 PM   #612
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
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
Quote:
Originally Posted by BetterRed View Post
Because that's where optional PI's and most other configurable data is stored - keeps the install location (Program Files) pristine - some config data is kept in library databases
I was wondering why it was in Roaming as opposed to, say, Local (where I looked first).
Rev. Bob is offline   Reply With Quote
Old 04-03-2014, 04:39 PM   #613
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 655
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
Quote:
Originally Posted by Rev. Bob View Post
In short, strip_spans is now more like a "deKoboify" routine that also happens to remove SPAN elements that have no attributes. I'm almost tempted to split it properly, into strip_spans and dekobo, but I don't really see the point. (Any opinions either way?)
I'd have them separate, somebody may want to keep the kobo stuff, yet remove the empty spans.
I don't know who, but you never know, there's bound to be someone.
Perkin is offline   Reply With Quote
Old 04-03-2014, 05:11 PM   #614
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,583
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Rev. Bob View Post
I was wondering why it was in Roaming as opposed to, say, Local (where I looked first).
See http://windows.microsoft.com/en-us/w...appdata-folder

Like many things in Windows, Roaming is also about corporate environments. That's a major source of revenue for MS, corporates pay annual support/license fees, which in part at least, subsidize things like the 13 years of free upgrades for XP that consumers enjoy(ed).

BR
BetterRed is offline   Reply With Quote
Old 04-03-2014, 05:39 PM   #615
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Rev. Bob View Post
I was wondering why it was in Roaming as opposed to, say, Local (where I looked first).
Quote:
Originally Posted by BetterRed View Post
See http://windows.microsoft.com/en-us/w...appdata-folder

Like many things in Windows, Roaming is also about corporate environments. That's a major source of revenue for MS, corporates pay annual support/license fees, which in part at least, subsidize things like the 13 years of free upgrades for XP that consumers enjoy(ed).

BR
Like I thought. Basically, even though AppData really should just have, well, app data, MS set up a system to segregate data depending on whether it should be synced from computer to computer (for busines users who tend to use networked login domains). This save the trouble of syncing Local\ data which has no compelling need (like the cache) to save on network usage.
Important stuff goes into the Roaming folder, including al config-type data.

And since it is default, it happens even if you don't use a network domain.
eschwartz is offline   Reply With Quote
Reply

Tags
modify epub


Forum Jump

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


All times are GMT -4. The time now is 08:38 AM.


MobileRead.com is a privately owned, operated and funded community.