From 060cc46a9652995358bb8f9eabbe894c10969664 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Tue, 12 Feb 2013 00:21:36 +0400 Subject: [PATCH] Any to Mobi: convert to old MOBI format to force left text alignment. --- bin/anytomobi | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) mode change 100644 => 100755 bin/anytomobi diff --git a/bin/anytomobi b/bin/anytomobi old mode 100644 new mode 100755 index 08c57aa..65a73d9 --- a/bin/anytomobi +++ b/bin/anytomobi @@ -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 can’t 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 [destination folder]" + echo "Usage: `basename $0` [destination folder]" exit 1 fi