Import Amazon Kindlebooks into Sigil
** NOTE: this plugin periodically checks for updated versions by connecting to github (where the source is maintained). Read the full post for more details **
If you're using Sigil v0.9.0 or later on OSX or Windows, all dependencies should already be met so long as you're using the bundled Python interpreter (default).
Linux users will have to make sure that the Tk or PyQt5 graphical python module (or PySide6 starting with Sigil 2.0) is present if it's not already. On Debian-based flavors this can be done with "sudo apt-get install python3-tk (or python3-pyqt5 or pip3 install PySide6)" for Python 3.5+. On Arch distributions it can be done with pacman -S tk and/or pacman -S python-pyqt5 and/or pacman -S pyside6).
*Note: Do not rename any Sigil plugin zip files before attempting to install them *
This plugin will work with either Python 3.5+.
The absolute minimum version of Sigil required is v0.8.3 (Python must be installed separately prior to v0.9.0)
In addition to being able to unpack/open the KF8 sections of files, it also takes a pretty serious stab at opening the older style mobi-only files (thanks to KevinH for contributions/suggestions on that front).
Also, if the original source package is a part of the file (think kindlegen output) and the original source is an epub, then the plugin will open that instead of using the unpacked version.
* Please note that there's some atrociously bad markup in many older mobi files (even retail ones), so while the plugin tries its best to whip that markup into some semblance of validity, it's still in your best interest to allow Sigil to correct any issues it may detect upon first opening. *
Configurable preferences (available after first run in the plugin's corresponding json prefs file) are:
As of v0.80.3
- azw3_epub_version : a string value that determines whether KF8 books will be imported as epub version 2.0 or epub version 3.0. Defaults to "2" but can be changed manually to "3". Changing this value to "3" will probably cause you nothing but misery before Sigil v0.9.3. NOTE: mobi7 formatted books will be unaffected by this preference. They will always be opened as v2.0 epubs. Use the ePub3-itizer plugin if you want those older mobis as ePub3s.
- use_hd_images : a true or false (boolean) value (defaults to true). If HD versions of images are present in KF8 books, use those in the resulting epub instead of their lo-rez counterparts.
- use_src_from_dual_mobi : a true or false (boolean) value (defaults to true). If the source package is included in the dual-format kindlegen output (and the source is an epub), open that source epub instead of unpacking the KF8 binary. Use false to always unpack.
added in v0.80.6
- asin_for_kindlegen_plugin: a true or false (boolean) value (defaults to false). Create a dc:identifier tag from the KindleUnpack metadata that the kindlegen Sigil plugin can then use to force the KF8 portion of a kindlegen-produced, dual-format mobi to have an ASIN.
- preserve_kindleunpack_meta: a true or false (boolean) value (defaults to false). KindleUnpack (the core of the KindleImport Plugin) creates a lot of reference metadata that is commented out in the OPF file it creates. Starting with Sigil 0.8.9XX, these comments will not survive when opened with Sigil. Setting this value to "true" will cause this section to be uncommented, so that the metadata tags exist in the OPF file's metadata section in Sigil. It will be up to the users to keep/delete the values they want/don't want.
For those who don't know where to find the plugin's json preferences file, the easiest way is to open the Sigil Preferences location from within Sigil. This can be achieved by 'Edit->Preferences' (or F5) and looking for the "Open Preferences Location' button in the bottom-left portion of the Sigil Preferences dialog. After clicking that button, you open the 'plugins_prefs' folder, and then the 'KindleImport' folder. There you should find a file named 'KindleImport.json', which is the one you want. If that file is missing, you probably haven't used the plugin yet. It needs to be run once before the file will be created.
KindleImport's code is hosted/maintained
on Github.
This plugin's update checker will only try to check for updates after at least 12 hours has elapsed since its last check. The plugin will only notify you about updates once for each new version released.
Changes
Spoiler:
v0.80.3
- Updated to the latest developer version of the underlying KindleUnpack engine to incorporate a few bug fixes/improvements.
- Utilize the autostart/autoclose plugin features (preparing for their availability in Sigil v0.9.3)
- If using the bundled Python Interpreter (or if cssutils is installed), the css in a mobi7 import will be "pretty-printed."
- The addition of three configurable preference variables to fine-tune behavior.
v0.80.4- faulty version
v0.80.5
- Add an update checker
v0.80.6
- Fixed an issue where NCX files were being truncated whenever incorrect ampersands made their way into a navItem's text element (thanks dhdurgee for helping track it down).
- Added configurable boolean preferences "asin_for_kindlegen_plugin" and "preserve_kindleunpack_meta".
v0.80.7
- Add support for PyQt5 QFileDialog (available in Sigil v0.9.8). Cosmetic only.
v0.80.8
- Make sure an EPUB3-compliant AMAZON identifier is created when preference "asin_for_kindlegen_plugin" is set to "true", and "azw3_epub_version" is set to "3" (when importing azw3s).
v0.80.9
- Update to use latest upstream KindleUnpack commits.
v0.82.1
- Update to use latest upstream KindleUnpack commits
- Add support for dark mode in Sigil 1.1 (PyQt5)
v0.83.0
- update to use latest upstream KindleUnpack core (which fixes a mobiheader issue in some magazines)
- fix so latest version can still run on Sigil versions earlier than 1.3.0
- keep unmanifested cover thumbnail image from being included when converting an old-style mobi to epub
- added icon for Sigil's plugin shortcut toolbar
v0.83.1
- update to work with both Qt5 and Qt6
v0.83.6
- pull in latest KindleUnpack changes
- pull in upstream plugin_utils changes to work with Qt6.5.2 and Python 3.11.3 for Sigil 2.0
v0.83.7
- pull in upstream changes to work with Python 3.13+