#!/bin/bash # bbc live radio script # # [The "BSD licence"] # Copyright (c) 2007 Jan Breuer # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # code name url #----------------------------------------------------------------------------------------------------- bbc=( "r1" "BBC Radio 1 - The best new music" "radio1/live/r1_dsat_g2.ra" "r2" "BBC Radio 2 - Music & Entertainment" "radio2/live/r2_dsat_g2.ra" "r3" "BBC Radio 3 - Classical, Jazz, World, Arts, Drama" "radio3/live/r3_dsat_g2.ra" "r4" "BBC Radio 4 - Intelligent speech" "radio4/live/r4_dsat_g2.ra" "r5" "BBC Radio 5 - Live news - live sport" "radio5/live/r5_dsat_g2.ra" "r6" "BBC 6 music" "6music/live/6music_dsat_g2.ra" "r7" "BBC Radio 7" "bbc7/live/bbc7_dsat_g2.ra" "1x" "BBC 1Extra" "1xtra/live/1xtra_dsat_g2.ra" "news" "BBC world service" "worldservice/livenews_v8.ra" ) # number of stations let bbc_count=${#bbc[@]}-1 # number of rows in table table_rows=3 # BBC live stream base url bbc_live_base_url="rtsp://rmlive.bbc.co.uk/bbc-rbs/rmlive/ev7/live24/" # for each column for station in `seq 0 $table_rows ${bbc_count}`; do # if the station is one what we want if [ "${bbc[$station]}" = "$1" ]; then # play station url echo Playing: ${bbc[$station+1]}; echo -e -n "\033]0;${bbc[$station+1]}\007" echo "=====================================================" echo mplayer -cache 100 ${bbc_live_base_url}${bbc[$station+2]} # everything is ok, so exit and don't print help exit fi done # cannot find station code # print usage echo "bbc [channel]" for station in `seq 0 $table_rows ${bbc_count}`; do echo -e "\t${bbc[$station]} - ${bbc[$station+1]}" done