#! /bin/bash
# Script for converting Feeble Files video to ScummVM format
#
# modify the paths below
#
# (c) 2006 ScummVM Team
# (c) 2006 crowley
#
# $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/tools/tags/release-1-2-0/convert_dxa.sh $
#
# $Id: convert_dxa.sh 24943 2006-12-28 18:01:33Z sev $

FFMPEG=ffmpeg
VIDEO_PATH=~/games/Feeble/video
ENCODE_DXA=~/scummvm/tools/encode_dxa
FORMAT=vorbis

cd "$VIDEO_PATH"

for i in *.SMK
do
    in=`basename "$i" .SMK`;
    mv "$i" "$in.smk";
done

for i in *.smk
do
    in=`basename "$i" .smk`;
    if [ ! -f "$in.dxa" ]
    then
	$FFMPEG -i "$i" -f image2 "$in%4d.png";
	$FFMPEG -i "$i" -acodec adpcm_ima_wav "$in.wav";
	$ENCODE_DXA --$FORMAT "$in.smk";
	rm *.png *.wav;
    fi
done
