11-01-2019, 06:44 PM | #1336 | |
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
|
Quote:
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. |
|
11-01-2019, 07:30 PM | #1337 |
Grand Sorcerer
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 . |
Advert | |
|
11-01-2019, 08:47 PM | #1338 |
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
|
Therein, of course, lies the problem.
|
11-01-2019, 08:56 PM | #1339 | ||
Not Quite Dead
Posts: 194
Karma: 654170
Join Date: Jul 2015
Device: Paperwhite 4; Galaxy Tab
|
Quote:
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:
Last edited by Brett Merkey; 11-01-2019 at 09:02 PM. |
||
11-30-2019, 04:55 PM | #1340 |
Running with scissors
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.
|
Advert | |
|
11-30-2019, 05:47 PM | #1341 | |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
|
|
11-30-2019, 05:50 PM | #1342 | |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
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. |
|
11-30-2019, 10:33 PM | #1343 | ||
Running with scissors
Posts: 1,552
Karma: 14325282
Join Date: Nov 2019
Device: none
|
Quote:
Quote:
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. |
||
12-21-2019, 05:38 AM | #1344 |
Connoisseur
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? |
12-21-2019, 10:34 AM | #1345 | |
Resident Curmudgeon
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:
|
|
12-21-2019, 12:51 PM | #1346 |
Connoisseur
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.
|
12-21-2019, 01:06 PM | #1347 |
Well trained by Cats
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) |
12-21-2019, 03:13 PM | #1348 | |
Resident Curmudgeon
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:
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. |
|
12-21-2019, 04:34 PM | #1349 |
null operator (he/him)
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 |
12-21-2019, 10:38 PM | #1350 | |
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:
And doing a quick test, with dummy input, I got further than you did. Install the plugin and they try again |
|
Tags |
modify epub |
|
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 |