11-12-2015, 12:05 PM | #61 | |
Bibliophagist
Posts: 40,506
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Code:
Original: # However we need a special case for Sigil which has issues with C runtime paths DETACHED_PROCESS = 0x00000008 if external_app_path.lower().endswith('sigil.exe'): Modification: # However we need a special case for Sigil which has issues with C runtime paths DETACHED_PROCESS = 0x00000008 if external_app_path.lower().endswith('ligis.exe'): |
|
11-12-2015, 12:07 PM | #62 |
Bibliophagist
Posts: 40,506
Karma: 156983616
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Yet another option. Thanks for the information.
Last edited by DNSB; 11-12-2015 at 12:11 PM. |
Advert | |
|
12-26-2015, 03:33 PM | #63 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Hey Doitsu,
I've tracked (with some help) my double mimetype issue down to this plugin. The problem stems from you writing a new mimetype file to bk._w.ebook_root (which is the actual Sigil scratch directory). It's fine (while still usually discouraged) to use bk._w.ebook_root for read-only operations, but since you need to create a mimetype file for Epubcheck, you should probably create your own temp directory, copy the book contents there -- bk.copy_book_contents_to(temp_dir) -- and then create your mimetype file. Let me know if there's anything else you need to correct the problem. |
12-26-2015, 03:43 PM | #64 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Hi DiapDealer,
The first version of this plugin actually copied the book to a newly created temp folder using .copy_book_contents_to(temp_dir). When I became aware of bk._w.ebook_root, I changed the code to use the actual temp folder, because I assumed that this would slightly speed up the validation process. I'll change it back to use a separate temp folder. |
12-26-2015, 03:52 PM | #65 | |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
You're right though, it probably did speed things up. It's just that that folder shouldn't have anything written to it by a plugin. That's Sigil's working temp directory. All changes to it should be handled by Sigil once it gets control back from the plugin. Thanks for fixing it! I'll see if there's anything we can do on our end to detect/eliminate extra mimetype files and/or protect the contents of bk._w.ebook_root. Last edited by DiapDealer; 12-26-2015 at 03:54 PM. |
|
Advert | |
|
12-26-2015, 04:20 PM | #66 |
Sigil Developer
Posts: 8,158
Karma: 5450818
Join Date: Nov 2009
Device: many
|
yes, ever directly using any of the bk._w. type routines is really frowned upon. We can live with it for reading if there is a really good reason, but it should never be used for writing. If at all possible, please stick to using the official bookcontainer interface routines as documented in the Sigil Plugin Framework docs. The entire reason for creating the interface was to protect Sigil itself.
Thanks, KevinH |
12-26-2015, 04:33 PM | #67 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
@DiapDealer: I'm sorry that I caused you extra work tracking down the double mimetype issue. From here on onward I shall no longer write to bk._w. |
|
12-26-2015, 05:09 PM | #68 | |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Regardless of whether or not this was a plugin's "fault," I think there's probably some tweaking that could be done to Sigil's zip routines. In my mind, it shouldn't really be possible to create a zip archive that has two files with the same name (but I could be wrong about that). It just seems to me that there should be some alarm bells going off, somewhere, long before an epub with two mimetype files makes it to ADE/RMSDK. Sigil lets it slide (after it already exists); and neither Flightcrew nor Epubcheck (local or online) seems to care about it. It's kind of weird. Oh, well. It least we know what's going on now.. |
|
12-26-2015, 05:40 PM | #69 |
Grand Sorcerer
Posts: 12,750
Karma: 75000002
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
I also saw from the screen shot that one of the mimetype's was stored uncompressed, and one was compressed.
|
12-29-2015, 08:47 AM | #70 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
It might be a bug or something strange on my side, but the plugin disappeared from the list in Sigil. I installed it again and it was there again. I did nothing that might have caused this. Perhaps a side effect from the update checker?
|
12-29-2015, 09:33 AM | #71 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
The update checker code segment is only executed once the plugin runs. I.e. it has nothing to do with Sigil itself. However, if a plugin corrupts/deletes its own plugin.xml file, it might no longer be listed.
The ePubCheck plugin checks its version number using xml.etree.ElementTree, but doesn't write to plugin.xml. I.e., it shouldn't have the capability to modify its plugin.xml file. @KevinH & DiapDealer: Could you please do a "mini code review" of the following version checking segment? Code:
import xml.etree.ElementTree as ET # run plugin version check plugin_xml_path = os.path.abspath(os.path.join(bk._w.plugin_dir, 'EpubCheck', 'plugin.xml')) plugin_version = ET.parse(plugin_xml_path).find('.//version').text In addition to the version check code I also added the following line to plugin.xml: Code:
<autostart>true</autostart> |
12-29-2015, 09:51 AM | #72 | |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I'll try to download the newest version of the plugin and check it out sometime today, just to be sure. |
|
12-29-2015, 10:42 AM | #73 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Perhaps it was just a fluke. I will keep an eye on it though. Thanks for checking anyway.
|
12-29-2015, 11:41 AM | #74 |
Sigil Developer
Posts: 8,158
Karma: 5450818
Join Date: Nov 2009
Device: many
|
IMHO ..using element tree to parse the simple plugin.xml just to get the version is probably overkill in the extreme. You can more easily use regular expressions as I did here:
https://www.mobileread.com/forums/sho...2&postcount=19 See the _version_pattern and related code. KevinH |
12-30-2015, 06:45 AM | #75 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
BTW, if you look at my source code, you'll notice that I implemented pretty much anything else that you suggested. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] PunctuationSmarten Sigil plugin | DiapDealer | Plugins | 138 | 07-11-2023 12:22 PM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 11:11 AM |
Sigil Plugin Index | Thasaidon | Plugins | 0 | 10-04-2014 08:41 AM |
FC and Sigil 0.5.3 ePUBcheck failure | Hitch | Sigil | 32 | 04-17-2012 03:56 AM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 10:53 PM |