RM to mp3 script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Ok forsome reason this script will not convert the rm stream to an mp3
if it runs in the cron.
Can someone point me in the right direction on how to fix this.

The script is as follows:

------------------------------------------------
#!/bin/bash

DATE=`date +%A`
SHOWNAME=$1
TSPLIT=$4
ALBUM=$2
DIR="/usr/local/bin/bbc_radio1"
RECORDINGPATH=${DIR}/
WEBDIR=/var/www/bbc/
DURATION=$3
DURATION=`expr $DURATION \* 60`
ATTIME=`expr $3 + 5`
BITRATE="64"
HISTORY=${WEBDIR}/history.log

_record() {
echo "--------------------------" >> $HISTORY
echo "Start REC:" `date` >> $HISTORY
echo " Recording" $SHOWNAME >> $HISTORY
echo " Length:" `expr $DURATION / 60 ` "minutes" >> $HISTORY

cd ${RECORDINGPATH}
mplayer -dumpstream "-playlist"
http://www.bbc.co.uk/radio1/realaudio/media/r1live.ram -dumpfile
${RECORDINGPATH}${SHOWNAME}.dump -vc dummy -vo null &
 MPLAYPROCESS=$!
 echo $MPLAYPROCESS > /tmp/radio1.pid
echo " PID:" $MPLAYPROCESS >> $HISTORY
Kill process when show finished.
at now + $ATTIME minutes <<EOF
 kill -9 $MPLAYPROCESS
EOF
 sleep $DURATION && echo "sleep finsihed" >> $HISTORY
kill -9 $MPLAYPROCESS && echo "PID Killed" >> $HISTORY
echo "Stop REC:" `date` >> $HISTORY
ls -lh ${RECORDINGPATH}${SHOWNAME}.dump  | awk ' { print "Showname: "
$8 " Size: "$5 } ' >> $HISTORY
}

_convert() {
# convert stream to mp3 format
echo "Converting Stream to MP3" `date` >> $HISTORY
# ffmpeg -i "$RECORDINGPATH$SHOWNAME".dump -f wav - | lame - -b
$BITRATE $WEBDIR/${DATE}_"$SHOWNAME".mp3
#mencoder "$RECORDINGPATH$SHOWNAME".dump -ovc frameno -oac mp3lame -of
rawaudio -lameopts cbr:br=40 -o $WEBDIR/${DATE}_"$SHOWNAME".mp3
ffmpeg -i "$RECORDINGPATH$SHOWNAME".dump -ab $BITRATE
$WEBDIR/${DATE}_"$SHOWNAME".mp3 > /tmp/convert.dbg && echo "Conversion
done" >> $HISTORY

ls -lh $WEBDIR | grep ${DATE}_"$SHOWNAME".mp3  | awk ' { print
"Showname: " $8 " Size: "$5 } '>> $HISTORY
echo "--------------------------" >> $HISTORY
}

_id3tag() {
mp3info -d ${WEBDIR}/${DATE}/*.mp3
mp3info -a $ALBUM -l $SHOWNAME -t $SHOWNAME ${WEBDIR}/${DATE}/*.mp3
echo "ID3tag set"
}

_splitmp3() {
echo ${TSPLIT}
mp3splt -f -t "${TSPLIT}".0 -a ${WEBDIR}${DATE}_"${SHOWNAME}".mp3 >> $HISTORY
}

_cleanup() {
#Cleanup Files
 mkdir -p $WEBDIR
 rm -v "$RECORDINGPATH$SHOWNAME".dump
}

_record

_convert

#_splitmp3
#_id3tag

#_cleanup
--------------------------------------------

I dont want to convert to a wav then mp3 as the files sizes will be
huge for the wav.

I run the script as:
xx xx * * * script.sh Show1 BBC 15 5

I understand parts of the script don't work yet but its the conversion
I am focusing on.
you can see I have tried some other variations of the conversion all
fail to work.
It only converts for a small time before stopping.

Thanks

-- 

email: pnward@xxxxxxxxxxxxxx
website: http://www.pward.co.uk
MSN: pob2000is@xxxxxxxxxxx
Skype: paul.n.ward

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux