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

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# Render script.
4c79b5
#
4c79b5
4c79b5
# Define export id
4c79b5
ID='CENTOSARTWORK'
4c79b5
4c79b5
# Make first argument required
4c79b5
if [ ! "$1" ]; then
4c79b5
    echo ' You need to specifiy the version you want to render as first argument.'
4c79b5
    echo ' Syntax: ./render.sh version language filename';
4c79b5
    exit;
4c79b5
fi
4c79b5
4c79b5
# Define SVG template directory
4c79b5
SVG=svg
4c79b5
4c79b5
# Define translation's base directory
4c79b5
TXT=../../../../../../trunk/Translations/Promo/Release
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
# Apply Language Filter
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 VERSION in `echo "$1"`; do
4c79b5
4c79b5
    # Define major version value
4c79b5
    MAJORV=`echo $VERSION | sed -e 's/\.[0-9]//'`
4c79b5
4c79b5
    # Look for languages
4c79b5
    for LANGUAGE in $TXTDIRS; do
4c79b5
4c79b5
        # Apply file name filter
4c79b5
        if [ $3 ];then
4c79b5
            TXTFILES=`ls $TXT/$LANGUAGE | egrep $3`
4c79b5
        else
4c79b5
            TXTFILES=`ls $TXT/$LANGUAGE`
4c79b5
        fi
4c79b5
4c79b5
        # Define image directory  
4c79b5
        IMG=img/$LANGUAGE
4c79b5
        if [ ! -d $IMG ];then
4c79b5
            mkdir $IMG;
4c79b5
        fi
4c79b5
4c79b5
        # Look for filenames 
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=release.svg
4c79b5
4c79b5
            # Define image file name
4c79b5
            IMGFILE=$IMG/release-$VERSION.png
4c79b5
4c79b5
            # Do translation and lefticon insertion
4c79b5
            sed -e "s!=BGFILE=!$BGFILE!" \
4c79b5
    	        -f $TRANSLATION \
4c79b5
    	        -e "s!=MAJORV=!$MAJORV!" \
4c79b5
    	        -e "s!=VERSION=!$VERSION!" \
4c79b5
                $SVG/$TEMPLATE > $TEMPLATE
4c79b5
4c79b5
            # Render image.
4c79b5
            inkscape $TEMPLATE --export-id=$ID --export-png=$IMGFILE; 
4c79b5
4c79b5
            # Remove temporal file
4c79b5
            rm $TEMPLATE
4c79b5
4c79b5
        done
4c79b5
    done
4c79b5
done