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
-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) &