cbds.sh
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
cbds.sh [2010/11/11 17:19] – removed 151.21.208.159 | cbds.sh [2010/11/11 18:46] (current) – old revision restored 92.195.13.77 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== cbds.sh ====== | ||
+ | This simple script creates a .cbds file from a given directory of images to be used with [[http:// | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | TO="/ | ||
+ | |||
+ | usage=" | ||
+ | |||
+ | $0 [OPTIONS] < | ||
+ | |||
+ | OPTIONS: | ||
+ | |||
+ | -h print this help and exit | ||
+ | -m Manga style right-to-left reading | ||
+ | -t < | ||
+ | -a < | ||
+ | -c < | ||
+ | |||
+ | USAGE: | ||
+ | |||
+ | Call the script with an directory of image files. They need to be | ||
+ | sorted in the correct order. The output file should have an .cbds | ||
+ | extension. | ||
+ | "; | ||
+ | |||
+ | ltr=1; | ||
+ | title="" | ||
+ | author="" | ||
+ | credit="" | ||
+ | |||
+ | #parse options | ||
+ | while getopts ": | ||
+ | do | ||
+ | case $Option in | ||
+ | h) echo " | ||
+ | exit ;; | ||
+ | m) ltr=0 ;; | ||
+ | t) title=$OPTARG;; | ||
+ | a) author=$OPTARG;; | ||
+ | c) credit=$OPTARG;; | ||
+ | esac | ||
+ | done | ||
+ | shift $(($OPTIND - 1)) | ||
+ | |||
+ | FROM=$1 | ||
+ | OUT=$2 | ||
+ | |||
+ | if [ ! -d " | ||
+ | echo " | ||
+ | exit | ||
+ | fi | ||
+ | |||
+ | if [ -z " | ||
+ | echo " | ||
+ | exit | ||
+ | fi | ||
+ | |||
+ | if [ -z " | ||
+ | title=`basename " | ||
+ | fi | ||
+ | |||
+ | # clear and create tempdir: | ||
+ | rm -rf $TO | ||
+ | mkdir -p $TO | ||
+ | |||
+ | # create needed dirs | ||
+ | mkdir -p $TO/IMAGE | ||
+ | mkdir -p $TO/NAME | ||
+ | mkdir -p $TO/SMALL_N | ||
+ | mkdir -p $TO/SMALL_R | ||
+ | mkdir -p $TO/THMB_N | ||
+ | mkdir -p $TO/THMB_R | ||
+ | |||
+ | # convert images | ||
+ | num=0 | ||
+ | for img in `ls -1 $FROM/ | ||
+ | do | ||
+ | num=$((num + 1)) | ||
+ | |||
+ | img=`basename " | ||
+ | |||
+ | convert -scale " | ||
+ | convert -scale 256x192 " | ||
+ | convert -rotate 90 -scale 256x192 " | ||
+ | convert -scale 62x46 " | ||
+ | convert -rotate 90 -scale 62x46 " | ||
+ | echo " | ||
+ | echo $num $img; | ||
+ | done | ||
+ | |||
+ | echo "; ComicBookDS ini file | ||
+ | CbCredits1 = $title | ||
+ | CbCredits2 = $author | ||
+ | CbCredits3 = $credit | ||
+ | LeftToRight = $ltr | ||
+ | NbPages = $num | ||
+ | Version = 200 | ||
+ | iHeight = 1400 | ||
+ | iQuality = 90 | ||
+ | iSize = 860000 | ||
+ | iWidth = 700 | ||
+ | oHeight = 192 | ||
+ | oQuality = 90 | ||
+ | oSize = 0 | ||
+ | oWidth = 256 | ||
+ | thHeight = 46 | ||
+ | thQuality = 90 | ||
+ | thSize = 0 | ||
+ | thWidth = 62 | ||
+ | " > $TO/ | ||
+ | |||
+ | (cd $TO && zip -r - *) > $OUT | ||
+ | |||
+ | # clear tempdir: | ||
+ | rm -rf $TO | ||
+ | </ |
cbds.sh.txt · Last modified: 2010/11/11 18:46 by 92.195.13.77