53 lines
990 B
Bash
Executable file
53 lines
990 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# This scripts resizes all the previews
|
|
# into _files so they can be uploaded
|
|
# to a CDN delivering package previews
|
|
|
|
DECL="$1"
|
|
DECL_IMG=$(basename "$1" | cut -d '.' -f 1)
|
|
DECLDIR=$(dirname "$DECL")
|
|
TYPE=$(dirname "$DECLDIR")
|
|
TYPE=$(basename "$TYPE")
|
|
GAMEDIR=$(basename "$DECLDIR")
|
|
NAME=$(grep packageInfo "$DECL" | awk '{ print $2 }')
|
|
GPREFIX=$GAMEDIR
|
|
|
|
if [ $TYPE = Addons ]
|
|
then
|
|
PREFIX="addon"
|
|
fi
|
|
|
|
if [ $TYPE = Maps ]
|
|
then
|
|
PREFIX="map"
|
|
fi
|
|
|
|
if [ $TYPE = Mods ]
|
|
then
|
|
PREFIX="mod"
|
|
fi
|
|
|
|
if [ $TYPE = Campaigns ]
|
|
then
|
|
PREFIX="campaign"
|
|
fi
|
|
|
|
if [ $TYPE = Patches ]
|
|
then
|
|
PREFIX="patch"
|
|
fi
|
|
|
|
PKGNAME=$(echo "$GPREFIX"-"$PREFIX"-"$NAME" | awk '{print tolower($0)}')
|
|
|
|
if [ -f "$DECLDIR/$DECL_IMG.png" ]
|
|
then
|
|
convert -resize 128x128\! "$DECLDIR/$DECL_IMG.png" ./_files/$PKGNAME.jpg
|
|
echo "resized to ./_files/$PKGNAME.jpg"
|
|
fi
|
|
|
|
if [ -f "$DECLDIR/$DECL_IMG.jpg" ]
|
|
then
|
|
convert -resize 128x128\! "$DECLDIR/$DECL_IMG.jpg" ./_files/$PKGNAME.jpg
|
|
echo "resized to ./_files/$PKGNAME.jpg"
|
|
fi
|