Any to Mobi: convert to old MOBI format to force left text alignment.

This commit is contained in:
Artem Sapegin 2013-02-12 00:21:36 +04:00
parent 77d1dc9db8
commit 060cc46a96

18
bin/anytomobi Normal file → Executable file
View File

@ -22,22 +22,16 @@ function convert_file() {
local infilename=$(basename "$1")
local outfilename="${infilename%.*}.mobi"
if [[ "$intype" == "mobi" || "$intype" == "pdf" ]]; then
# Just copy MOBI and PDF files to destination directory
if [[ "$intype" == "pdf" ]]; then
# Just copy PDF files to destination directory
if [[ "$outdir" != "." ]]; then
cp "$infile" "$outdir/"
fi
return
elif [[ "$intype" == "epub" ]]; then
kindlegen "$infile" -o "$outfilename"
# kindlegen cant save file to other directory, so we should move it
if [[ "$outdir" != "." ]]; then
mv "${infile%.*}.mobi" "$outdir/"
fi
else
ebook-convert "$infile" "$outdir/$outfilename" --output-profile=kindle_pw --mobi-file-type=new \
--mobi-ignore-margins --mobi-keep-original-images \
--no-inline-toc --no-inline-fb2-toc --remove-paragraph-spacing \
# Convert any other format (MOBI too) to old MOBI format to force left text alignment
ebook-convert "$infile" "$outdir/$outfilename" --output-profile=kindle_pw --mobi-file-type=old \
--mobi-ignore-margins --mobi-keep-original-images --no-inline-toc --remove-paragraph-spacing \
--change-justification=left --keep-ligatures --smarten-punctuation --pretty-print
fi
@ -64,6 +58,6 @@ if [[ -f "$1" ]]; then
elif [[ -d "$1" ]]; then
convert_dir "$1"
else
echo "Usage: anytomobi <file or folder> [destination folder]"
echo "Usage: `basename $0` <file or folder> [destination folder]"
exit 1
fi