Created .bat files for Windows (Linux and OSX users look at page 1 to find a bash script that does the same

) to automatically hyphenate (soft-hyphens) an epub file, then convert it to .azw3, then remove special characters from the filename, then move it to Dropbox\Books\
Just drag/drop an .epub onto the booksync2drop.bat file to start the process.
Prerequisites:
Calibre
with the Calibre Plugin "Modify ePub" installed
Python (tested with version 2.7)
https://www.python.org/downloads/windows/
lxml (version has to fit the python install above (!), f.e. 2.7 - also 32 or 64 bit has to fit as well)
https://pypi.python.org/pypi/lxml/3.3.5#downloads
kindle-hyphens (just download the repo as a .zip file and unzip it to C:\kindle-hyphens\ Attention! The folder path is not optional. Please copy the .zips contents (the individual files - not the files nested in another folder) to C:\kindle-hyphens\ and no where else.)
https://github.com/dmalinovsky/kindle-hyphens
-
In the kindle-hyphens folder, create a subfolder named
out
(and don't navigate into it for the time being..

)
Then create a bat file in the kindle-hyphens folder (important!), name it rename.bat (important!) and copy the following text into it (using a text editor):
Code:
@echo off
setlocal EnableDelayedExpansion
set preserve=abcdefghijklmnopqrstuvwxyz 1234567890
for %%a in (%0\..\out\*.azw3) do (
set "filename=%%~Na"
call :RemoveChars filename newFilename=
if "!newFilename!" neq "%%~Na" ren "%%a" "!newFilename!%%~Xa"
)
goto :EOF
:RemoveChars filename newFilename=
set %2=
:nextChar
set "char=!%1:~0,1!"
if "!preserve:%char%=!" neq "%preserve%" set "%2=!%2!%char%"
set "%1=!%1:~1!"
if defined %1 goto nextChar
exit /B
Save the file.
Then create a .bat file in a folder of your choice (f.e on the Desktop). This will become your drag/drop target for the .epub. Rename it to booksync2drop.bat and copy the following text into it (using a text editor):
Code:
@echo off
:ask
echo Is this an english epub?
set INPUT=
set /P INPUT=Type y/n: %=%
If /I "%INPUT%"=="y" goto yes
If /I "%INPUT%"=="n" goto no
:yes
goto english
:no
goto other
:english
start /wait ebook-meta %1 --language en
start /wait calibre-debug -e "C:\kindle-hyphens\main.py" %1 "%~n1_temp.epub"
start /wait ebook-convert "%~n1_temp.epub" "%~n1.azw3" --change-justification justify
goto fin
:other
start /wait calibre-debug -e "C:\kindle-hyphens\main.py" %1 "%~n1_temp.epub"
start /wait ebook-convert "%~n1_temp.epub" "%~n1.azw3" --change-justification justify
goto fin
:fin
del "%~n1_temp.epub"
move "%~n1.azw3" "C:\kindle-hyphens\out\%~n1.azw3"
call "C:\kindle-hyphens\rename.bat"
move "C:\kindle-hyphens\out\*.azw3" "%HOMEPATH%\Dropbox\Books\"
echo Script has finished.
echo The .azw3 should now be in the Dropbox\Books\ folder.
pause
exit
Save the file.
Create a folder named
Books
in your Dropbox folder.
Make sure your Dropbox folder resides in \Users\USERNAME\Dropbox\ (the .bat script expects it there, if it isn't you have to change/rewrite the script) - and you are good to go.
Drag an .epub file onto the booksync2drop.bat to start.
Also - if you want to, you could change the default (fallback) language in the kindle-hyphens main.py to english (en) or german (de), or any other language supported by kindle-hyphens (the default is russian (ru)) - if you do so, it is recommended that you use Notepad++ (
https://notepad-plus-plus.org/) to do it, in case there are whitespace formating issues (Windows doesn't like unix whitespaces - but this editor can handle it.).
and you can rewrite the booksync2drop.bat to ask if the book you are converting is german (or any other language supported by kindle-hyphens) and force the script to set a german language tag, before kindle-hyphens gets fed the .epub
By default I am forcing an english language tag here - but the script was originally written with english set as the fallback language in the main.py and a different language that could be set at the yes/no prompt - in mind. So effectively you could make it work for two languages. (Don't forget to change the start /wait ebook-meta %1 --language en line to the language of your choice if you want to go that route...

)
You can then point the Dropbox client on the Kindle to sync the /Books/ folder - and voila, hyphenated azw3s on your Kindle in seconds.