From 507450d374e733b29bf39ea6119f75983623b203 Mon Sep 17 00:00:00 2001 From: Kamil Bugajski Date: Tue, 28 Aug 2012 11:00:50 +0200 Subject: [PATCH] =?UTF-8?q?switch=20f=C3=BCr=20verschiedene=20bildformat-a?= =?UTF-8?q?usgaben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/generationlib | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/generationlib b/bin/generationlib index bcbae2d..a381d67 100755 --- a/bin/generationlib +++ b/bin/generationlib @@ -10,6 +10,7 @@ Usage: `basename $0` [-h] [-i] [-j nb_jobs] command arg_list -c give the path to the cfg file -i give the path of the svg files without the last / -k chek if the jpg already exist + -b set the background to transparent -s set the sleeptime while there are too many simultanious jobs -j Set number of simultanious jobs. Default is 2 -o directory where the files should be moved to after creation. @@ -21,7 +22,7 @@ Usage: `basename $0` [-h] [-i] [-j nb_jobs] command arg_list function cfg_parser { INI_FILE=$1 SECTION=$2 - eval `sed -n -e "/^\[$SECTION\]/,/^\s*\[/{/^[^;].*\=.*/p;}" < $INI_FILE`>> trr.txt + eval `sed -n -e "/^\[$SECTION\]/,/^\s*\[/{/^[^;].*\=.*/p;}" < $INI_FILE` } function get_filepath { # probiere alle möglichen Kombinationen wo das file stehen könnte je @@ -89,8 +90,8 @@ fi CHECKFILE=0 SLEEPTIME=0.5 BACKGROUND='' - -while getopts "j:i:kc:s:o:hc:bc" OPT; do # "j:" waits for an argument "h" doesnt +FILE_FORMAT='png' +while getopts "j:i:kc:s:o:hc:f:bc" OPT; do # "j:" waits for an argument "h" doesnt case $OPT in h) echo "$USAGE" exit 0 ;; @@ -101,6 +102,7 @@ while getopts "j:i:kc:s:o:hc:bc" OPT; do # "j:" waits for an argument "h" doesnt s) SLEEPTIME=$OPTARG ;; b) BACKGROUND='-background transparent ';; i) INPUT_FILENAME=$OPTARG ;; + f) FILE_FORMAT=$OPTARG ;; *) echo "$USAGE" >&2; exit 1; # Default. esac done @@ -116,13 +118,13 @@ for i in `ls $INPUT_FILE| grep .svg ` do ID=`echo "$i" | sed -e 's/;.*//g'` PIC_NAME=`echo "$i" | sed -e 's/.svg//g'` - FILE_PATH=$INPUT_FILE/$PIC_NAME + FILE_PATH=$INPUT_FILE/$PIC_NAME.$FILE_FORMAT if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ] then echo $PIC_NAME exists else RESIZE="${width}x${height}" - SWITCHES="-density $density $BACKGROUND$INPUT_FILE/$ID -resize $RESIZE $INPUT_FILE/$PIC_NAME.$format" + SWITCHES="-density $density $BACKGROUND$INPUT_FILE/$ID -resize $RESIZE $FILE_PATH" CMDLINE="$CMD $SWITCHES" echo $CMDLINE (echo $ID; $CMDLINE) &