Page 1 of 1

A command line digital radio solution

Posted: 15 Dec 2009 05:01
by mikehirst
I just wrote myself a command line digital radio script that I thought others might find useful.

Code: Select all

@echo off

rem ============================================================
rem CLRadio.bat
rem command line digital radio
rem mikehirst
rem 10:27 15 December 2009
rem N.B. requires mplayer - http://www.mplayerhq.hu/
rem ============================================================

SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

:menuLOOP
cls
echo.
echo.= CLRadio ===============================================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo.  %%B  %%C
set choice=
echo.&set /p choice=Make a choice or hit ENTER to quit: ||GOTO:EOF
echo.&call:menu_%choice%
GOTO:menuLOOP

::-----------------------------------------------------------
:: menu functions with playlist urls
::-----------------------------------------------------------

:menu_1 Radio 1
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r1.asx
GOTO:EOF

:menu_1x Radio 1Xtra
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r1x.asx
GOTO:EOF

:menu_2 Radio 2
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r2.asx
GOTO:EOF

:menu_3 Radio 3
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r3.asx
GOTO:EOF

:menu_4 Radio 4
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r4.asx
GOTO:EOF

:menu_4lw Radio 4 LW
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r4lw.asx
GOTO:EOF

:menu_5 Radio 5 Live
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r5l.asx
GOTO:EOF

:menu_5se Radio 5 Live Sports Extra
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r5lsp.asx
GOTO:EOF

:menu_6 Radio 6
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r6.asx
GOTO:EOF

:menu_7 Radio 7
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r7.asx
GOTO:EOF

:menu_ws World Service
start cmd /c mplayer -playlist http://www.bbc.co.uk/worldservice/meta/tx/nb/live/www15.ram
GOTO:EOF

:menu_manc Radio Manchester
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/bbcmanchester.asx
GOTO:EOF

:menu_suff Radio Suffolk
start cmd /c mplayer -playlist http://www.bbc.co.uk/radio/listen/live/bbcsuffolk.asx
GOTO:EOF



Best Wishes

Mike

Posted: 22 Dec 2009 01:05
by DosItHelp
mikehirst - very nice the way you made use of the menu loop presented at DosTips. :D

I think you can remove the "cmd /c " in front of each call, the start command should take care of everything.