Forgot your password?
typodupeerror

Comment The script (Score 1) 550

Here is an example cron entry:
00 14 * * Fri /home/sfral/scripts/record_show 60 TalkOfNation >> /home/sfral/work/radio/log

The script record_show is this:

#!/bin/bash

. ~/.bashrc

if test -z $2; then
echo Use: $0 num_minutes showname
exit
fi

DIR="/share/SharedDocs/Radio"

if test -d $DIR; then
# Share is mounted
DATE=`date +"%F_%I%M%P"`
WAVEFILE="$DIR/$2_$DATE.wav"
MP3FILE="$DIR/$2_$DATE.mp3"

# Capture audio and save in .wav file.
#
echo $DATE -- Capturing $2...
/usr/bin/sox -v 1.0 -c 2 -w -r 44100 -t ossdsp /dev/dsp -t .wav -r 44100 -c 2 $WAVEFILE &
REC_PID=$!
sleep $(($1*60))
kill -2 $REC_PID

# Convert to mp3
#
echo ...Converting $2 to mp3...
nice /usr/local/bin/lame --quiet -h $WAVEFILE $MP3FILE

# Delete wav file.
echo ...Deleting wav file $WAVEFILE
rm -f $WAVEFILE

echo ...Capture complete -- $MP3FILE

else
echo Share not mounted! Aborting.
exit
fi

Slashdot Top Deals

"This isn't brain surgery; it's just television." - David Letterman

Working...