#!/bin/sh
# Script Interface to amp song player
# That makes amp behaviour similar to the mpg123's.
# Licensed Under the GPL ver 2.0 and above.
# Written by hip0


n=0;
dir="$1";
trap inter INT; 

inter () {
n=$(($n +1));
out_func;
}

out_func () {
amp "${array[$n]}";
}

addr_song () {
f=0;
for i in `ls -1 $dir | sed -e "s/ /##/g"`; do
f=$(($f + 1));
array[$f]="\"$i\"";
cur_song=`echo $dir/${array[$f]} | sed -e "s/##/ /g"`;
echo; echo "Playing $cur_song ...";
eval amp "$cur_song" 2>/dev/null; 
done
}

main () {
addr_song;
#out_func;
}

main;
