![]() |
#61 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,714
Karma: 152906060
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'): |
|
![]() |
![]() |
![]() |
#62 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 38,714
Karma: 152906060
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 11:11 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#63 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
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. |
![]() |
![]() |
![]() |
#64 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
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. |
![]() |
![]() |
![]() |
#65 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
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 02:54 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#66 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,981
Karma: 5449552
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 |
![]() |
![]() |
![]() |
#67 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
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. ![]() |
|
![]() |
![]() |
![]() |
#68 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
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.. ![]() |
|
![]() |
![]() |
![]() |
#69 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,545
Karma: 74358018
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.
|
![]() |
![]() |
![]() |
#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?
|
![]() |
![]() |
![]() |
#71 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
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> |
![]() |
![]() |
![]() |
#72 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 27,798
Karma: 198099188
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. |
|
![]() |
![]() |
![]() |
#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.
|
![]() |
![]() |
![]() |
#74 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,981
Karma: 5449552
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 |
![]() |
![]() |
![]() |
#75 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,634
Karma: 23190435
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. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] PunctuationSmarten Sigil plugin | DiapDealer | Plugins | 138 | 07-11-2023 11:22 AM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 10:11 AM |
Sigil Plugin Index | Thasaidon | Plugins | 0 | 10-04-2014 07:41 AM |
FC and Sigil 0.5.3 ePUBcheck failure | Hitch | Sigil | 32 | 04-17-2012 02:56 AM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 09:53 PM |