Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 10-24-2014, 03:34 PM   #1
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 3,612
Karma: 9569308
Join Date: Dec 2010
Device: Kindle PW2
kindlegen plugin for Sigil

[Plugin] KindleGen - Simple KindleGen wrapper

Updated: January 3, 2017
Current Version: "0.4.0"

This plugin is a very simple kindlegen wrapper, which allows you to convert the currently loaded book with kindlegen.

Note that since kindlegen is executed in the background, you'll have to wait a couple of seconds before the messages are being displayed.

Disclaimer: Even though it's unlikely that the plugin will somehow corrupt the epub that you're working on or crash Sigil, you may want to save your ePub in Sigil before running this plugin.

Credits: This plugin uses code originally written by KevinH, nickredding and other KindleUnpack developers.

System requirements

This plugin requires the Kindlegen binary or Kindle Previewer, which comes with KindleGen. If you uncheck the Use Bundled Python option, you'll also need to install Python, bs4, lxml and Pillow.

Linux users will need to download the kindlegen binary from Amazon and unzip it. The same goes for Windows and macOS users who didn't install Kindle Previewer.

Installation

1. Select Manage Plugins from the Plugins menu. Select Use Bundled Python to use the bundled interpreter.
If you haven't updated to Sigil 0.9.0 (or higher) click one of the Auto buttons to detect the path or Set to manually select the Python interpreter path. You also might need to install bs4, Pillow and lxml.
2. Click Add Plugin and select KindleGen_v0.4.0.zip. This will install the kindlegen plugin, which you can select via Plugins > output > KindleGen.

When you run the plugin for the first time you'll need to select the kindlegen location, unless you have installed Kindle Previewer in the default folder. Select either kindlegen.exe (Windows) or kindlegen (OSX, Linux).

Settings

By default the plugin will generate .mobi files using the same parameters as Kindle Previewer (master mobi file, no compression, attached source files).

There are two groups of settings:

1. KindleGen settings that are passed on to the KindleGen binary and allow you to:
  • Prevent KindleGen from attaching the source files.
  • Change the compression factor (0 = no compression, 2 = maximum compression).
  • Display verbose messages.
  • Force Windows-1252 output.
  • Convert .jpg images to to .gif.
  • Change the language used to display KindleGen messages.
2. Postprocessing options that allow you to:
  • Add a fake ASIN number (using DualMetaFix).
  • Split the master mobi file into azw3 and mobi7 components (using KindleUnpack).
  • Generate a thumbnail image for eink Kindles.
  • Change the output folder (default = Desktop).
Note that if you select any of the post-processing options, you can't upload the generated AZW3/MOBI7 files to KDP!

The plugin will also check for the presence of the following recommended guide/landmarks/metadata items:
  • SRL = Start Reading Location
  • TOC = HTML TOC
  • Cover = cover metadata entry
Attached Thumbnails
Click image for larger version

Name:	KindleGen.png
Views:	116
Size:	10.9 KB
ID:	153929  
Attached Files
File Type: zip KindleGen_v0.4.0.zip (20.0 KB, 259 views)

Last edited by Doitsu; 02-06-2017 at 10:23 AM. Reason: Added Kindlegen download links.
Doitsu is offline   Reply With Quote
Advert
Old 10-28-2014, 08:07 AM   #2
KevinH
Wizard
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 2,298
Karma: 678014
Join Date: Nov 2009
Device: many
Hi Doitsu,

Already 19 downloads .... Great Work.

Thank you!

KevinH
KevinH is offline   Reply With Quote
Old 11-05-2015, 01:36 PM   #3
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
I am trying this out on my linux mint 17.1 rebecca x64 system, but unfortunately am getting errors:
================================================== ==
Status: success

Running KindleGen ... please wait

************************************************** ***********
Amazon kindlegen(Linux) V2.9 build 1028-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014
************************************************** ***********

Info:I9006ption: -c1: Standard DOC compression
Info:I9014ption: -verbose: Verbose output
Info(prcgen):I1047: Added metadata dc:Title ""Sweet Young Things""
Info(prcgen):I1047: Added metadata dcate "2015-11-03"
Info(prcgen):I1047: Added metadata dc:Creator "Kristine Kathryn Rusch"
Info(prcgen):I1047: Added metadata dc:Contributor "calibre (1.25.0) [http://calibre-ebook.com]"
Info(prcgen):I1047: Added metadata dc:Source "Free Fiction Monday 2014/11/17"
Info(prcgen):I1052: Kindle support cover images but does not support cover HTML. Hence using the cover image specified and suppressing cover HTML in content. URL: /OEBPS/Text/cover.xhtml
Info(prcgen):I1002: Parsing files 0000001
Info(prcgen):I1003: Parsing file URL: part0000_split_002.html
Info(cssparser):I10004: @rules other than @import, @charset and @font-face are not supported.
Info(prcgen):I1015: Building PRC file
Info(prcgen):I1006: Resolving hyperlinks
Info(prcgen):I1010: Writing hyperlinks
Info(prcgen):I1049: Building table of content URL: /OEBPS/toc.ncx
Error(prcgen):E24010: Hyperlink not resolved in toc (One possible reason can be that the link points to a tag with style display:none):/OEBPS/Text/titlepage.xhtml#
Error(prcgen):E24001: The table of content could not be built.
Info(prcgen):I1016: Building enhanced PRC file
Info(prcgen):I1007: Resolving mediaidlinks
Info(prcgen):I1011: Writing mediaidlinks
Info(prcgen):I1009: Resolving guide items
Info(prcgen):I1038: MOBI file could not be generated because of errors!

Kindlegen failed.

Please click OK to close the Plugin Runner window.

================================================== ==

What do I need to do to get this working?

Dave
dhdurgee is offline   Reply With Quote
Old 11-05-2015, 01:54 PM   #4
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 78,108
Karma: 68364797
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Air 2, iPhone 6
The error seems pretty clear; there's an invalid hyperlink in the TOC.
HarryT is offline   Reply With Quote
Old 11-05-2015, 03:33 PM   #5
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
Quote:
Originally Posted by HarryT View Post
The error seems pretty clear; there's an invalid hyperlink in the TOC.
I never created a TOC for this epub. It is a short-story and as such a TOC is unnecessary. All I really want in this epub is the cover and the text.

I ran the validator and get the following errors:

OEBPS/Text/titlepage.xhtml N/A This OPS document is reachable but not present in the OPF <spine>. "Reachable" means that a reference of some kind that points to this resource exists in the epub.

OEBPS/Text/titlepage.xhtml N/A This resource is reachable but not present in the OPF <manifest>. "Reachable" means that a reference of some kind that points to this resource exists in the epub.

OEBPS/toc.ncx 17 This <content> element's "src" attribute value is "Text/titlepage.xhtml", but that file does not exist.

I don't see a way to remove the TOC or to modify the OPF anywhere.

I was able to use ebook-convert from calibre to create a .mobi from this file, so I am surprised that kindlegen has problems with it.

Dave
dhdurgee is offline   Reply With Quote
Advert
Old 11-05-2015, 03:36 PM   #6
HarryT
eBook Enthusiast
HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.HarryT ought to be getting tired of karma fortunes by now.
 
HarryT's Avatar
 
Posts: 78,108
Karma: 68364797
Join Date: Nov 2006
Location: UK
Device: Kindle Voyage, iPad Air 2, iPhone 6
All those errors seem to be saying the same thing: that you're referencing a file called "titlepage.xhtml", but the file doesn't exist.
HarryT is offline   Reply With Quote
Old 11-05-2015, 03:38 PM   #7
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,148
Karma: 82980001
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
calibre is a better piece of software than kindlegen -- and you're surprised to hear that?
eschwartz is offline   Reply With Quote
Old 11-05-2015, 03:39 PM   #8
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
Quote:
Originally Posted by HarryT View Post
All those errors seem to be saying the same thing: that you're referencing a file called "titlepage.xhtml", but the file doesn't exist.
Correct, a file that is not needed for a short story does not exist. How can I change whatever needs to be changed to remove these references to an unnecessary file?

Dave
dhdurgee is offline   Reply With Quote
Old 11-05-2015, 03:40 PM   #9
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,148
Karma: 82980001
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Regenerate your Toc.ncx (semantic ToC) -- or manually edit it -- to get rid of the reference to that nonexistent file...

Last edited by eschwartz; 11-05-2015 at 04:02 PM. Reason: typo
eschwartz is offline   Reply With Quote
Old 11-05-2015, 03:48 PM   #10
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
Quote:
Originally Posted by eschwartz View Post
Regenerate you Toc.ncx (semantic ToC) -- or manually edit it -- to get rid of the reference to that nonexistent file...
Duh! Somehow I never expected it to be that easy. I was able to use kindlegen without problems after doing as you suggested.

The .mobi kindlegen made is substantially larger than the one ebook-convert made, over twice the size. Perhaps I need to tweak the kindlegen.ini settings to deal with this. I have both a K3 WiFi and a KT2, so I need a file that both can read, so I would appreciate some pointers.

Dave
dhdurgee is offline   Reply With Quote
Old 11-05-2015, 04:02 PM   #11
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,148
Karma: 82980001
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
kindlegen is creating a dual-MOBI.
I assume you mean it is bigger than a dual-MOBI that calibre creates. (Rather than being bigger than a standalone AZW3 which is just duh. )



Try using the undocumented
Code:
-dont_append_source
switch to kindlegen -- by default it creates a MOBI that has both mobi7 && KF8... and also the original source files, because reasons.
For kindlegen.ini that would be the "donotaddsource = False True" mentioned in the OP.

...

Also consider creating the standalone AZW3 and MOBI, and sideloading each one as and when needed.
Unless you intend to use Amazon PDOCs of course.

Last edited by eschwartz; 11-05-2015 at 04:07 PM.
eschwartz is offline   Reply With Quote
Old 11-05-2015, 04:31 PM   #12
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
Quote:
Originally Posted by eschwartz View Post
kindlegen is creating a dual-MOBI.
I assume you mean it is bigger than a dual-MOBI that calibre creates. (Rather than being bigger than a standalone AZW3 which is just duh. )



Try using the undocumented
Code:
-dont_append_source
switch to kindlegen -- by default it creates a MOBI that has both mobi7 && KF8... and also the original source files, because reasons.
For kindlegen.ini that would be the "donotaddsource = False True" mentioned in the OP.

...

Also consider creating the standalone AZW3 and MOBI, and sideloading each one as and when needed.
Unless you intend to use Amazon PDOCs of course.
I changed the donotaddsource and azw3_only settings and now I get a .mobi file smaller than that generated by ebook-convert and a .azw3 file that is larger. I will confirm that these look good on my kindles and then will start using the plugin.

On a related topic, is there a way to improve the file name created? I left the mobi_file setting blank, so it used the title as a starting point. As this was a short story, the title was in double-quotes which were translated to underscores. The embedded blanks in the title were kept in the file name. My preference in this matter is to elide the double-quotes and translate the embedded spaces to underscores in the file name. It would be nice if this could be automated by the plug-in. I also normally convert embedded apostrophes to hyphens in the file name. I imagine a more general translate table might be needed for foreign languages titles to file names.

At this point I will simply rename the files manually, but it would be nice to automate it.

Dave

Last edited by dhdurgee; 11-05-2015 at 04:32 PM. Reason: fix typo
dhdurgee is offline   Reply With Quote
Old 11-05-2015, 04:42 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,148
Karma: 82980001
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
I don't know, doesn't sound like it.


I usually use calibre's metadata template language for that. In calibre.
eschwartz is offline   Reply With Quote
Old 11-05-2015, 06:09 PM   #14
Doitsu
Wizard
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 3,612
Karma: 9569308
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by dhdurgee View Post
I was able to use ebook-convert from calibre to create a .mobi from this file, so I am surprised that kindlegen has problems with it.
Calibre has extremely robust conversion settings that allow users to convert invalid ePubs to invalid Mobi files. These files can be opened with Kindles and Kindle apps, but some links/styles might not work.
You may want to make sure that all books that you want to convert with KindleGen pass ePubCheck and/or FlightCrew, because books that fail validation usually also fail KindleGen. Also note that azw3 and mobi7 files generated by this plugin can't be used for KDP uploads.

If you want to convert multiple epubs you're better off using Calibre.

Quote:
Originally Posted by dhdurgee View Post
On a related topic, is there a way to improve the file name created? [...] My preference in this matter is to elide the double-quotes and translate the embedded spaces to underscores in the file name.
If you're familiar with regular expressions, you can change the generated file name by editing line #285 in plugin.py.

Code:
            title = re.sub('[/|\?|<|>|\\\\|:|\*|\||"|\^]+', '_', dc_title.group(1))
You could also press F8 in Sigil and modify the title before running the KindleGen plugin. (You don't have to save the ePub after the change; the plugin will always use the current version of the files as they're displayed in Sigil.)
Doitsu is offline   Reply With Quote
Old 11-06-2015, 11:33 AM   #15
dhdurgee
Addict
dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.dhdurgee ought to be getting tired of karma fortunes by now.
 
Posts: 318
Karma: 421466
Join Date: Jun 2010
Device: K3W, KT2
Quote:
Originally Posted by Doitsu View Post
Calibre has extremely robust conversion settings that allow users to convert invalid ePubs to invalid Mobi files. These files can be opened with Kindles and Kindle apps, but some links/styles might not work.
You may want to make sure that all books that you want to convert with KindleGen pass ePubCheck and/or FlightCrew, because books that fail validation usually also fail KindleGen. Also note that azw3 and mobi7 files generated by this plugin can't be used for KDP uploads.

If you want to convert multiple epubs you're better off using Calibre.



If you're familiar with regular expressions, you can change the generated file name by editing line #285 in plugin.py.

Code:
            title = re.sub('[/|\?|<|>|\\\\|:|\*|\||"|\^]+', '_', dc_title.group(1))
You could also press F8 in Sigil and modify the title before running the KindleGen plugin. (You don't have to save the ePub after the change; the plugin will always use the current version of the files as they're displayed in Sigil.)
Thank you for the pointer to the appropriate code. I have tweaked it a bit to suit my preferences as follows:;

Code:
            # replace unwanted characters in book title
            title = re.sub('[/|\?|<|>|\\\\|:|\*|\||"|\^|\'|\s]+', '_', dc_title.group(1))
            title = title.strip("_")
I edited the comment to be a little more accurate, added the apostrophe and white space to the list to be replaced with underscores and stripped leading/trailing underscores to deal with titles in quotes.

There might even be a few more unwanted characters that ought to be added to the replacement list that could cause problems in a file name. I will see if I run into any and add them as I encounter them.

The white space is a preference of mine to avoid the need of quoting filenames or using escape codes while entering file names. I find the underscores an acceptable replacement avoiding that problem.

Dave
dhdurgee is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] KindleImport Sigil plugin DiapDealer Plugins 137 03-23-2017 05:44 PM
[Plugin] PunctuationSmarten Sigil plugin DiapDealer Plugins 60 01-28-2017 05:36 PM
epubcheck plugin for Sigil Doitsu Plugins 131 01-17-2017 12:06 AM
font change sigil to mobi with kindlegen wyatt650 Sigil 4 09-05-2013 10:49 AM
Sigil to Kindlegen -- No Table of Contents paul-b Sigil 70 05-03-2012 04:57 PM


All times are GMT -4. The time now is 09:25 PM.


MobileRead.com is a privately owned, operated and funded community.