#!/bin/sh
xmessage -bg lightblue "Comparing new files to existing files" &
oggcheck

for i in `cat /mnt/sda4/compare/files`
do
  oggcheck
done

killall xmessage
cd /mnt/sda4/compare
xmessage -bg lightblue "Converting the .mp3 files to .ogg, please wait..." &
mp32wav
cd /mnt/sda4/compare/mp32wav
wav2ogg
killall xmessage
cd /mnt/sda4/compare/mp32wav/wav2ogg
xmessage -bg lightblue "Updating metadata in ogg files" &
oggdata
killall xmessage

mv *.ogg /mnt/sda4/ogg
mv /mnt/sda4/compare/*.mp3 /mnt/home/root/music
xmessage -bg lightblue "Updating the MPD database" &
mpd --create-db
mpc update
killall xmessage
rm -r /mnt/sda4/compare/mp32wav
cd /mnt/sda4/ogg
./create-playlist
mpc load all
xmessage -bg lightblue -timeout 5 -default okay Transfer of .ogg files is complete
