#
# VLC startup script for Nokia 770, http streaming mode, no UI, kill existing processes
#
# ttolvane 28-Nov-2005, modified by Jari Tenhunen 2006-01-16
#

PREFIX=
#if [ -e /home/user/vlc_url.txt ]; then
# URL=`cat /home/user/vlc_url.txt`
#else
# echo "no url file (/home/user/vlc_url.txt) inserted" > /tmp/vlc_startup.log
# exit 1
#fi
URL=
echo Setting parameters > /tmp/vlc_startup.log
LD_LIBRARY_PATH=$PREFIX/usr/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
export LD_PRELOAD=/usr/lib/libosso-ic-preload.so
echo Killing existing vlc processes >> /tmp/vlc_startup.log
# why can't we do a 'killall -6 vlc'?
killall -6 vlc >>/tmp/vlc_startup.log
#ps -u user | grep vlc | grep -v vlc_startup | awk '{ print "kill -6 "$1 }' | tee /tmp/vlc_kill.sh 2>> /tmp/vlc_startup.log
#if [ -e /tmp/vlc_kill.sh ] ; then
#echo Killing processes >> /tmp/vlc_startup.log
#chmod 750 /tmp/vlc_kill.sh
#/tmp/vlc_kill.sh
#sleep 1
#rm /tmp/vlc_kill.sh
#fi
echo Starting VLC >> /tmp/vlc_startup.log
$PREFIX/usr/bin/vlc --no-fpu --volume 500 -I dummy $URL $* 2> /tmp/vlc.log &
VLC_PID=$!
# if the application is not started using dbus, it inherits a higher priority (-1) from af/task navigator
# => sound gets garbled
renice 0 $VLC_PID
wait $VLC_PID
echo VLC terminated >> /tmp/vlc_startup.log
