![]() |
Quote:
Code:
Original: |
Quote:
|
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. |
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. |
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. |
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 |
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. :) |
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.. :) |
I also saw from the screen shot that one of the mimetype's was stored uncompressed, and one was compressed.
|
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?
|
Quote:
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 ETIn addition to the version check code I also added the following line to plugin.xml: Code:
<autostart>true</autostart> |
Quote:
I'll try to download the newest version of the plugin and check it out sometime today, just to be sure. |
Perhaps it was just a fluke. I will keep an eye on it though. Thanks for checking anyway.
|
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 |
Quote:
BTW, if you look at my source code, you'll notice that I implemented pretty much anything else that you suggested. |
| All times are GMT -4. The time now is 06:06 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.