{"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

Requirements<\/strong><\/h4>\n

There are 2 main binaries that this script requires. They are : mplayer and ffmpeg.<\/p>\n

Usage<\/strong><\/h4>\n

[root@server]# \/root\/scripts\/radio-ripper.sh –help
\nUsage: radio-ripper [URL] [LENGTH] [FILENAME]<\/strong><\/p>\n

Script<\/strong><\/h4>\n

#!\/bin\/bash<\/p>\n

#### ASSIGN PATH ####
\nPATH=\/usr\/kerberos\/sbin:\/usr\/kerberos\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/sbin:\/bin:\/usr\/sbin:\/usr\/bin<\/p>\n

#### ASSIGN VARIABLES ####
\nMPLAYER=\/usr\/bin\/mplayer
\nFFMPEG=\/usr\/bin\/ffmpeg
\nDATE=`date +%Y%m%d`
\nDIR=\/root\/downloads\/radioshows<\/p>\n

#### CHECK FOR BINARIES ####
\nif [ ! -x “${MPLAYER}” ]; then
\necho Error : unable to excute “${MPLAYER}”
\nfi
\nif [ ! -x “${FFMPEG}” ]; then
\necho Error : unable to excute “${FFMPEG}”
\nfi<\/p>\n

#### CHECK FOR ARGUMENTS ####
\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

#### DOWNLOAD WMA ####
\n“${MPLAYER}” -playlist $1 -dumpstream -dumpfile “${DIR}”\/$3-“${DATE}.wma” & sleep “${2}”m ; kill $!<\/p>\n

#### CONVERT TO MP3 ####
\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":"

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":"\nStream ripper bash script - Fir3net<\/title>\n<meta name=\"description\" content=\"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\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stream ripper bash script - Fir3net\" \/>\n<meta property=\"og:description\" content=\"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\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\" \/>\n<meta property=\"og:site_name\" content=\"Fir3net\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-12T19:14:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-31T17:12:10+00:00\" \/>\n<meta name=\"author\" content=\"Rick Donato\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rick Donato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\"},\"author\":{\"name\":\"Rick Donato\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\"},\"headline\":\"Stream ripper bash script\",\"datePublished\":\"2011-09-12T19:14:31+00:00\",\"dateModified\":\"2021-07-31T17:12:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\"},\"wordCount\":215,\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"articleSection\":[\"Shell Scripting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\",\"url\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\",\"name\":\"Stream ripper bash script - Fir3net\",\"isPartOf\":{\"@id\":\"https:\/\/www.fir3net.com\/#website\"},\"datePublished\":\"2011-09-12T19:14:31+00:00\",\"dateModified\":\"2021-07-31T17:12:10+00:00\",\"description\":\"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\",\"breadcrumb\":{\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.fir3net.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming\",\"item\":\"https:\/\/www.fir3net.com\/programming\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Shell Scripting\",\"item\":\"https:\/\/www.fir3net.com\/programming\/shell-scripting\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Stream ripper bash script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.fir3net.com\/#website\",\"url\":\"https:\/\/www.fir3net.com\/\",\"name\":\"Fir3net\",\"description\":\"Keeping you in the know\",\"publisher\":{\"@id\":\"https:\/\/www.fir3net.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.fir3net.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.fir3net.com\/#organization\",\"name\":\"Fir3net\",\"url\":\"https:\/\/www.fir3net.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"contentUrl\":\"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png\",\"width\":390,\"height\":88,\"caption\":\"Fir3net\"},\"image\":{\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037\",\"name\":\"Rick Donato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g\",\"caption\":\"Rick Donato\"},\"description\":\"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stream ripper bash script - Fir3net","description":"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","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html","og_locale":"en_US","og_type":"article","og_title":"Stream ripper bash script - Fir3net","og_description":"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","og_url":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html","og_site_name":"Fir3net","article_published_time":"2011-09-12T19:14:31+00:00","article_modified_time":"2021-07-31T17:12:10+00:00","author":"Rick Donato","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rick Donato","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#article","isPartOf":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html"},"author":{"name":"Rick Donato","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037"},"headline":"Stream ripper bash script","datePublished":"2011-09-12T19:14:31+00:00","dateModified":"2021-07-31T17:12:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html"},"wordCount":215,"publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"articleSection":["Shell Scripting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html","url":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html","name":"Stream ripper bash script - Fir3net","isPartOf":{"@id":"https:\/\/www.fir3net.com\/#website"},"datePublished":"2011-09-12T19:14:31+00:00","dateModified":"2021-07-31T17:12:10+00:00","description":"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","breadcrumb":{"@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.fir3net.com\/Programming\/Shell-Scripting\/stream-ripper-bash-script.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fir3net.com\/"},{"@type":"ListItem","position":2,"name":"Programming","item":"https:\/\/www.fir3net.com\/programming"},{"@type":"ListItem","position":3,"name":"Shell Scripting","item":"https:\/\/www.fir3net.com\/programming\/shell-scripting"},{"@type":"ListItem","position":4,"name":"Stream ripper bash script"}]},{"@type":"WebSite","@id":"https:\/\/www.fir3net.com\/#website","url":"https:\/\/www.fir3net.com\/","name":"Fir3net","description":"Keeping you in the know","publisher":{"@id":"https:\/\/www.fir3net.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.fir3net.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.fir3net.com\/#organization","name":"Fir3net","url":"https:\/\/www.fir3net.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","contentUrl":"https:\/\/www.fir3net.com\/wp-content\/uploads\/Fir3net-Background-Logo-compressed.png","width":390,"height":88,"caption":"Fir3net"},"image":{"@id":"https:\/\/www.fir3net.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/ab35009601b7687ee1c5310be6038037","name":"Rick Donato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.fir3net.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d75d69a54c0ca3b32c24c3a9703b623c?s=96&d=mm&r=g","caption":"Rick Donato"},"description":"Rick Donato is a Network Automation Architect\/Evangelist and the founder of Packet Coders."}]}},"_links":{"self":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/588"}],"collection":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/comments?post=588"}],"version-history":[{"count":0,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/posts\/588\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/media?parent=588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/categories?post=588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fir3net.com\/wp-json\/wp\/v2\/tags?post=588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}