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 11-01-2019, 06:44 PM   #1336
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 Brett Merkey View Post
On the issue of the fail on deleting images referenced from the styles: Yes, kind of awkward since an image can be deleted but the actual style rule referencing it remains in the CSS. Kind of a smoking gun...
You have the issue somewhat backwards. The main hurdle is in reading CSS files and tracing any relative paths found there to check for existence, which the existing Modify code simply is not designed to do. As I recall, Modify’s parser doesn’t even try to deal with links in that respect; features like XPGT or pagemap removal depend entirely on either file extension or MIME type.

If I recall the image-removal code correctly, it makes a list of image elements by going through the OPF manifest (which means those paths are all relative to the same location) and checking the HTML files (ditto) to hunt for links to them. The spanner in the works, so to speak, is that an HTML file in one folder can reference two or more CSS files from anywhere else, each of which can include style rules that bring in images from elsewhere. That’s at least one new level of complexity, and I’m not sure how to deal with it correctly and completely.

All of that said, two approaches suggest themselves:

1. Make it an official “known issue” and build a wall to block it. At the outset of the routine, scan all CSS files for rules containing url() references which end in image extensions. If any are detected, toss an advisory message and quit without changing anything. (The unpretty routine does something similar in that it scans for PRE elements, as removing whitespace within those can be catastrophic.)

2. As I recall, the existing routine works by building a list of HTML files, scraping those to find links to images, and then checking each image in the manifest against that set to see if any manifest images aren’t referenced. It may be feasible to follow that step by, if any unreferenced images are found, tweaking the parameters for that same routine so that it will similarly scrape stylesheets and compare any references found there to the “unreferenced” list.

Both sound pretty decent at first blush, but there’s a hidden complication in the form of styles specified in the HTML files, either as local stylesheets or inline style declarations… and those get really nasty in a hurry. I would hope nobody would stoop so low as to build a url() reference into an inline style, but it sadly wouldn’t surprise me.

There is, of course, a third option: the status quo. Leave the code as is, a proverbial open manhole with warning tape posted around it, and place the onus on the end user to think before checking the box and enabling the option in the first place.

So, in sum: I’m not averse to the notion of patching, but I don’t want to hand out false senses of security. I would rather continue to note the behavior with a warning while not touching the code than risk tinkering blind and breaking what does work.

Right now, I don’t trust that I have sufficient headspace available to tackle option two. I know that’s not what anyone wants to hear, but it’s far better for me to admit my limitations than break something in the name of foolish pride.
Rev. Bob is offline   Reply With Quote
Old 11-01-2019, 07:30 PM   #1337
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
FWIW, calibre's container class does contain a method (container.iterlinks) which can be utilised to achieve this. The container class is under constant development by Kovid and contains many other methods which make epub manipulation less onerous and more reliable.

If 'Modify Epub' was modernised to use this container class, rather than its homegrown equivalent (which pre-dates the newer official version), then I suspect future plugin maintenance/development would become easier in the long run. Unfortunately that modernisation would probably not be a trivial exercise ... and I'm certainly not volunteering to do it .
jackie_w is offline   Reply With Quote
Advert
Old 11-01-2019, 08:47 PM   #1338
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
Therein, of course, lies the problem.
Rev. Bob is offline   Reply With Quote
Old 11-01-2019, 08:56 PM   #1339
Brett Merkey
Not Quite Dead
Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.Brett Merkey ought to be getting tired of karma fortunes by now.
 
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
Quote:
The main hurdle is in reading CSS files...
I was afraid of that. And you are right, despite being an irrational act for e-books, I can just imagine authors/publishers nesting CSS files like Russian matryoshka dolls that would turn backtracking a path into a nightmare.

Modify ePub already has the best Help file associated of any plug-in I have installed. Perhaps the WARNING in the current file is a bit terse but anyone cautious enough to access the Help (me!) will probably get the implication. Great plug-in as is.

@jackie_w:
Quote:
If 'Modify Epub' was modernised to use this container class...
Oh gawd, have I heard the equivalent siren voice of seduction in half the dev teams I used to work with! As you point out, unless there is some super *new* feature of Modify ePub envisioned that could be combined with the upgrade in tech, it is almost always a recipe for headache or disaster.

Last edited by Brett Merkey; 11-01-2019 at 09:02 PM.
Brett Merkey is offline   Reply With Quote
Old 11-30-2019, 04:55 PM   #1340
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Enhancement request: when an epub 3 has a nav.xhtml could Modify ePub generate the epub 2 toc.ncx from it? Sigil has this in its Tools>Epub 3 Tools menu. I keep getting epub 3 books that don't have a toc.ncx and I'd like to be able to simply click a button in calibre to fix that rather than having to open them in Sigil. (Typically I've already cleaned up/fixed their CSS in Sigil but forgot to generate the toc.ncx.) The kobo doesn't display a TOC when there isn't a toc.ncx.
hobnail is offline   Reply With Quote
Advert
Old 11-30-2019, 05:47 PM   #1341
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
Quote:
Originally Posted by hobnail View Post
Enhancement request: when an epub 3 has a nav.xhtml could Modify ePub generate the epub 2 toc.ncx from it? Sigil has this in its Tools>Epub 3 Tools menu. I keep getting epub 3 books that don't have a toc.ncx and I'd like to be able to simply click a button in calibre to fix that rather than having to open them in Sigil. (Typically I've already cleaned up/fixed their CSS in Sigil but forgot to generate the toc.ncx.) The kobo doesn't display a TOC when there isn't a toc.ncx.
This is not a bulk epub solution but simply opening/saving the TOC in the calibre TOC Editor will automatically create (or update) an NCX which matches the NAV in an epub3.
jackie_w is offline   Reply With Quote
Old 11-30-2019, 05:50 PM   #1342
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Quote:
Originally Posted by hobnail View Post
Enhancement request: when an epub 3 has a nav.xhtml could Modify ePub generate the epub 2 toc.ncx from it? Sigil has this in its Tools>Epub 3 Tools menu. I keep getting epub 3 books that don't have a toc.ncx and I'd like to be able to simply click a button in calibre to fix that rather than having to open them in Sigil. (Typically I've already cleaned up/fixed their CSS in Sigil but forgot to generate the toc.ncx.) The kobo doesn't display a TOC when there isn't a toc.ncx.
You can create the toc.ncx file with calibre editor.
Go to Tools > Table of Contents > Edit Table of Contents. Then, just click OK.
A toc.ncx file will be created matching the nav.xhtml file.

You can do this also from the main window, without even opening the book. Select the book you want the toc.ncx file created for, and press K on the keyboard. The TOC edit tool will open. Just click OK. Done.
thiago.eec is offline   Reply With Quote
Old 11-30-2019, 10:33 PM   #1343
hobnail
Running with scissors
hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.hobnail ought to be getting tired of karma fortunes by now.
 
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
Quote:
Originally Posted by jackie_w View Post
This is not a bulk epub solution but simply opening/saving the TOC in the calibre TOC Editor will automatically create (or update) an NCX which matches the NAV in an epub3.
Quote:
Originally Posted by thiago.eec View Post
You can create the toc.ncx file with calibre editor. Go to Tools > Table of Contents > Edit Table of Contents. Then, just click OK. A toc.ncx file will be created matching the nav.xhtml file.

You can do this also from the main window, without even opening the book. Select the book you want the toc.ncx file created for, and press K on the keyboard. The TOC edit tool will open. Just click OK. Done.

Thanks. That's what I didn't get from my previous question about a plugin that would do it. I didn't ask my question the same way then. From their answers I was assuming that I had to click on one of the buttons on the right but I wanted to keep the TOC that Sigil had created.
hobnail is offline   Reply With Quote
Old 12-21-2019, 05:38 AM   #1344
gogu1904
Connoisseur
gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.
 
Posts: 80
Karma: 2112464
Join Date: May 2019
Device: Kobo Aura One LE
Hello,

I run Calibre portable on windows, with Modify EPub installed. I run the command line script to remove covers from epubs via

calibre-debug me.py "file.epub" -- --remove_cover

And I get the error

ImportError: No module named modify_epub.dialogs

Please advice, what am I doing wrong?
gogu1904 is offline   Reply With Quote
Old 12-21-2019, 10:34 AM   #1345
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,938
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by gogu1904 View Post
Hello,

I run Calibre portable on windows, with Modify EPub installed. I run the command line script to remove covers from epubs via

calibre-debug me.py "file.epub" -- --remove_cover

And I get the error

ImportError: No module named modify_epub.dialogs

Please advice, what am I doing wrong?
Removing the cover?
JSWolf is offline   Reply With Quote
Old 12-21-2019, 12:51 PM   #1346
gogu1904
Connoisseur
gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.gogu1904 ought to be getting tired of karma fortunes by now.
 
Posts: 80
Karma: 2112464
Join Date: May 2019
Device: Kobo Aura One LE
Yes, indeed. I want to read books not watch covers. But that is beside the point. Possibly, the version of the me.py file included in the first post is too old for the current setup of Calibre.
gogu1904 is offline   Reply With Quote
Old 12-21-2019, 01:06 PM   #1347
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,792
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Calibre has evolved and the Plugin code (for many) has tried to keep up, so it is not unreasonable for OLD code to fail.

as to 'Watch covers"...
Sorry, but they only show when selecting or first opening a book. so why? I am not using my 2010 Astak which only had 1G of SD card space (with room for more books than I could read in MONTHS) any more.
My 4G deviced have almost 100 books (with covers) and are not half full. (True, I use the Resize Cover PI and make mine 450x680 for a 600x800 display since Photo Quality is not something Eink needs)
theducks is offline   Reply With Quote
Old 12-21-2019, 03:13 PM   #1348
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,938
Karma: 128903250
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by gogu1904 View Post
Yes, indeed. I want to read books not watch covers. But that is beside the point. Possibly, the version of the me.py file included in the first post is too old for the current setup of Calibre.
Try removing the cover with Modify ePub using the Calibre GUI and see if it works. If it doesn't work, you can report that as well.

When you read eBooks, you do not watch the cover. The coer does not get in the way and the cover is needed for thumbnails depending on what you are using to read eBooks.

Also, try again from the command line but make sure you are running Calibre 4.6.

Last edited by JSWolf; 12-21-2019 at 03:19 PM.
JSWolf is offline   Reply With Quote
Old 12-21-2019, 04:34 PM   #1349
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,565
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Removing the cover from epub's with Modify works through the GUI.

I read a lot of 'papers' from academia, government, etc that don't have covers, so I use Modify to remove the 'false' covers I create - I use colour variants of one of the built-in cover templates to differentiate top level subjects.

And the calibre viewer no longer creates false covers for coverless EPUBs - open the EPUB and start reading the text.

BR
BetterRed is offline   Reply With Quote
Old 12-21-2019, 10:38 PM   #1350
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by gogu1904 View Post
Yes, indeed. I want to read books not watch covers. But that is beside the point. Possibly, the version of the me.py file included in the first post is too old for the current setup of Calibre.
It should work. But, have you actually installed the plugin? The error suggests that you haven't.

And doing a quick test, with dummy input, I got further than you did. Install the plugin and they try again
davidfor 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 07:32 AM.


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