#!/bin/bash
##############################################################################
#
# Copyright (C) 2014 - 2016 x-odos GmbH
#
###############################################################################

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

sleep 1
if [ ! -d "/hidefstick" ]; then mkdir /hidefstick; ln -s /hidefstick/ /storage/music/Local/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/x-stream/playfile {} \;
 /usr/bin/mpc play
fi