#!/bin/bash
#
# Post download processor to convert a video into a format that can be played on handheld devices.
#
LOG=$HOME/.gpodder.log
date >> $LOG
EXT=${GPODDER_EPISODE_FILENAME##*.}
OUTFILE=$HOME/Desktop/`basename ${GPODDER_EPISODE_URL%.*}`.avi

if [ "$EXT" == "mp4" ] || [ "$EXT" == "mov" ]; then
	echo "Converting $GPODDER_EPISODE_FILENAME to $OUTFILE" >> $LOG
	convert_video_iaudio-x5 $GPODDER_EPISODE_FILENAME $OUTFILE >> $LOG 2>&1
	echo "Finished converting" >> $LOG
	exit 0
fi
