#!/bin/bash
# Copyright (C) 2008 - 2012 vortexbox.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

NOW=`date +'%m/%d/%Y %H:%M:%S'`

sleep 1
if [ ! -d "/hidefstick" ]; then mkdir /hidefstick; ln -s /hidefstick/ /storage/music/flac/hidefstick; fi
/bin/mount -t vfat $1 /hidefstick 2>> /var/log/usbbackup.log
if [ -f "/hidefstick/hidefstick.xml" ]; then
 echo "$NOW - HiDefStick Found." >> /var/log/usbbackup.log
 /usr/bin/mpc stop
 /usr/bin/mpc clear
 /usr/bin/mpc update
 cd /hidefstick
 find . -name *.wav -exec /opt/vortexbox/playfile {} \;
 /usr/bin/mpc play
fi

