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