Friday, September 17, 2010

MY alarm clock

#!/bin/sh

#random: od -d -N2 -An /dev/urandom | sed -e 's/[[:space:]]*\([[:digit:]]*\)/\1/
#mpg123 -Z -n `perl -e 'print rand()*time()%2000'` -k `perl -e 'print rand()*time()%2000'` -@ fullplist.txt >& PLAYED/played_`date +%d%h_%H_%M`
export LINES=`wc -l <>

while [ yes ]
do
export NEXT=`let R1=$((RANDOM % LINES)); head -n $R1 fullplist.txt|tail -n 1`
export R1=$((RANDOM%2000));
export R2=$((RANDOM%2000));
echo Playing $R1 $R2 of $NEXT >> PLAYED/played_`date +%d%h_%H_%M`
mpg123 -n $R1 -k $R2 "$NEXT"

done

No comments: