Blame Identity/Themes/Motifs/Mettle/Promo/Poster/render.sh

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# Render script
4c79b5
4c79b5
# Define export id
4c79b5
ID='CENTOSARTWORK'
4c79b5
4c79b5
# Make first argument required
4c79b5
if [ ! "$1" ]; then
4c79b5
    echo ' Syntax Error!. See the README file for more information.';
4c79b5
    exit;
4c79b5
fi
4c79b5
4c79b5
# Define SVG template directory
4c79b5
SVG=svg
4c79b5
4c79b5
# Define absolute path for the background file. Relative path is not
4c79b5
# allowed. Inkscape needs an absolute path as reference to the
4c79b5
# background image. That is the absolute path we build here.
4c79b5
MYPATH=`pwd`
4c79b5
BGFILE=../../../../../../trunk/Themes/Mettle/Wallpapers/img
4c79b5
cd $BGFILE
4c79b5
BGFILE=`pwd`/wallpaper-fog.png
4c79b5
cd $MYPATH
4c79b5
4c79b5
# Define Translation directory
4c79b5
TXT=../../../../../../trunk/Translations/Promo/Poster
4c79b5
4c79b5
# Look for versions
4c79b5
for VERSION in `echo $1`;do
4c79b5
4c79b5
    # Define languages
4c79b5
    if [ $2 ];then
4c79b5
        TXTDIRS=`ls $TXT/ | egrep $2`
4c79b5
    else
4c79b5
        TXTDIRS=`ls $TXT/`
4c79b5
    fi
4c79b5
4c79b5
    # Look for translations
4c79b5
    for LANGUAGE in $TXTDIRS; do
4c79b5
    
4c79b5
        # Define Image directory
4c79b5
        IMG=img/$VERSION/$LANGUAGE
4c79b5
        if [ ! -d $IMG ];then
4c79b5
            mkdir -p $IMG
4c79b5
        fi
4c79b5
4c79b5
        # Define translation file names
4c79b5
        if [ $3 ];then
4c79b5
            TXTFILES=`ls $TXT/$LANGUAGE | egrep $3`
4c79b5
        else
4c79b5
            TXTFILES=`ls $TXT/$LANGUAGE`
4c79b5
        fi
4c79b5
4c79b5
        # Look for files
4c79b5
        for FILE in $TXTFILES; do
4c79b5
4c79b5
            # Define translation file name
4c79b5
            TRANSLATION=$TXT/$LANGUAGE/$FILE
4c79b5
4c79b5
            # Define svg template file name
4c79b5
            TEMPLATE=poster.svg
4c79b5
4c79b5
            # Define image file name
4c79b5
            IMAGE=$IMG/`echo $FILE | sed -r 's!\.sed$!.png!'`
4c79b5
4c79b5
            # Translation
4c79b5
            sed -e "s!=BGFILE=!$BGFILE!" \
4c79b5
        	    -f $TRANSLATION \
4c79b5
        	    -e "s!=VERSION=!$VERSION!" \
4c79b5
                $SVG/$TEMPLATE > $TEMPLATE
4c79b5
4c79b5
            # Rendering
4c79b5
            inkscape $TEMPLATE --export-id=$ID --export-png=$IMAGE; 
4c79b5
4c79b5
            # Remove temporal file
4c79b5
            rm $TEMPLATE
4c79b5
4c79b5
        done
4c79b5
    done
4c79b5
done