{"id":588,"date":"2011-09-12T19:14:31","date_gmt":"2011-09-12T19:14:31","guid":{"rendered":"https:\/\/fir3netwp.gmsrrpobkbd.com\/2011\/09\/12\/stream-ripper-bash-script\/"},"modified":"2021-07-31T17:12:10","modified_gmt":"2021-07-31T17:12:10","slug":"stream-ripper-bash-script","status":"publish","type":"post","link":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html","title":{"rendered":"Stream ripper bash script"},"content":{"rendered":"
This bash script allows you to download an audio stream via ASX (Advanced Stream Redirector) for a defined time period. The downloaded file (wma) is then converted to mp3.
\nThis provides the ability to schedule and download your favourite radio shows for later listening.<\/p>\n
There are 2 main binaries that this script requires. They are : mplayer and ffmpeg.<\/p>\n
[root@server]# \/root\/scripts\/radio-ripper.sh –help #!\/bin\/bash<\/p>\n #### ASSIGN PATH #### #### ASSIGN VARIABLES #### #### CHECK FOR BINARIES #### #### CHECK FOR ARGUMENTS #### #### DOWNLOAD WMA #### #### CONVERT TO MP3 #### This bash script allows you to download an audio stream via ASX (Advanced Stream Redirector) for a defined time period. The downloaded file (wma) is then converted to mp3. This provides the ability to schedule and download your favourite radio shows for later listening. Requirements There are 2 main binaries that this script requires. They … Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"yoast_head":"\n
\nUsage: radio-ripper [URL] [LENGTH] [FILENAME]<\/strong><\/p>\nScript<\/strong><\/h4>\n
\nPATH=\/usr\/kerberos\/sbin:\/usr\/kerberos\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin<\/p>\n
\nMPLAYER=\/usr\/bin\/mplayer
\nFFMPEG=\/usr\/bin\/ffmpeg
\nDATE=`date +%Y%m%d`
\nDIR=\/root\/downloads\/radioshows<\/p>\n
\nif [ ! -x “${MPLAYER}” ]; then
\necho Error : unable to excute “${MPLAYER}”
\nfi
\nif [ ! -x “${FFMPEG}” ]; then
\necho Error : unable to excute “${FFMPEG}”
\nfi<\/p>\n
\nif [ -z “${1}” -o -z “${2}” -o -z “${3}” ]; then
\necho “Usage: radio-ripper [URL] [LENGTH] [FILENAME]”;
\necho
\necho “Example:”
\necho “radio-ripper 90 DJ-123”;
\nexit
\nfi<\/p>\n
\n“${MPLAYER}” -playlist $1 -dumpstream -dumpfile “${DIR}”\/$3-“${DATE}.wma” & sleep “${2}”m ; kill $!<\/p>\n
\n“${FFMPEG}” -i “${DIR}”\/”${3}”-“${DATE}.wma” -ab 128k -f mp3 “${DIR}”\/”${3}”-“${DATE}.mp3”
\nif [ $? = 0 ] ; then
\nrm -f “${DIR}”\/”${3}”-“${DATE}.wma”
\nelse
\necho Error : unable to convert to mp3
\nfi<\/p>\n","protected":false},"excerpt":{"rendered":"