switch für verschiedene bildformat-ausgaben

This commit is contained in:
Kamil Bugajski
2012-08-28 11:00:50 +02:00
parent aaef4177f9
commit 507450d374
+7 -5
View File
@@ -10,6 +10,7 @@ Usage: `basename $0` [-h] [-i] [-j nb_jobs] command arg_list
-c give the path to the cfg file -c give the path to the cfg file
-i give the path of the svg files without the last / -i give the path of the svg files without the last /
-k chek if the jpg already exist -k chek if the jpg already exist
-b set the background to transparent
-s set the sleeptime while there are too many simultanious jobs -s set the sleeptime while there are too many simultanious jobs
-j Set number of simultanious jobs. Default is 2 -j Set number of simultanious jobs. Default is 2
-o directory where the files should be moved to after creation. -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 { function cfg_parser {
INI_FILE=$1 INI_FILE=$1
SECTION=$2 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 { function get_filepath {
# probiere alle möglichen Kombinationen wo das file stehen könnte je # probiere alle möglichen Kombinationen wo das file stehen könnte je
@@ -89,8 +90,8 @@ fi
CHECKFILE=0 CHECKFILE=0
SLEEPTIME=0.5 SLEEPTIME=0.5
BACKGROUND='' BACKGROUND=''
FILE_FORMAT='png'
while getopts "j:i:kc:s:o:hc:bc" OPT; do # "j:" waits for an argument "h" doesnt while getopts "j:i:kc:s:o:hc:f:bc" OPT; do # "j:" waits for an argument "h" doesnt
case $OPT in case $OPT in
h) echo "$USAGE" h) echo "$USAGE"
exit 0 ;; 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 ;; s) SLEEPTIME=$OPTARG ;;
b) BACKGROUND='-background transparent ';; b) BACKGROUND='-background transparent ';;
i) INPUT_FILENAME=$OPTARG ;; i) INPUT_FILENAME=$OPTARG ;;
f) FILE_FORMAT=$OPTARG ;;
*) echo "$USAGE" >&2; exit 1; # Default. *) echo "$USAGE" >&2; exit 1; # Default.
esac esac
done done
@@ -116,13 +118,13 @@ for i in `ls $INPUT_FILE| grep .svg `
do do
ID=`echo "$i" | sed -e 's/;.*//g'` ID=`echo "$i" | sed -e 's/;.*//g'`
PIC_NAME=`echo "$i" | sed -e 's/.svg//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 ] if [ -s $FILE_PATH ] && [ $CHECKFILE -eq 1 ]
then then
echo $PIC_NAME exists echo $PIC_NAME exists
else else
RESIZE="${width}x${height}" 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" CMDLINE="$CMD $SWITCHES"
echo $CMDLINE echo $CMDLINE
(echo $ID; $CMDLINE) & (echo $ID; $CMDLINE) &