|
自己的小练习,
只为图省事,
很简陋,
请指教。:thank
谢谢!
- #!/bin/sh
- # this is a test to play some online media with mplayer
- # written by aaccdd<waxyxgn@hotmail.com>
- # any comment or modification would be appreciated
- # define play_bbc : play bbc online news
- play_bbc()
- {
- play_ram() # play ram stream
- {
- wget "http://stream.servstream.com/ViewWeb/BBCTechnology/Event/BBC_World_Service.asx" -O $HOME/.live
- mplayer -playlist $HOME/.live
- rm $HOME/.live
- }
-
- play_mms() # play mms stream
- {
- wget "http://www.bbc.co.uk/worldservice/ram/live_news.ram" -O $HOME/.live
- mplayer -playlist $HOME/.live
- rm $HOME/.live
- }
- echo
- echo " Which type would you prefer, ram or mms?"
- echo
- read choice
- case $choice
- in
- ram) play_ram;;
- mms) play_mms;;
- esac
- }
- # define play_cnn: play cnn online news
- play_cnn()
- {
- echo
- echo " Which would you prefer, ram or mms?"
- echo
- read type
- case $type
- in
- ram) mplayer mms://live.stream.aol.com/cnn_webcast4_high;;
- mms) mplayer rtsp://live1.stream.aol.com/farm/*/encoder/cnn_webcast4_high;;
- esac
- }
- # define play_cctv: play cctv online channel
- play_cctv()
- {
- # change the number following live to get access to different channel
- # 1-news 2-economy 3-english
- echo
- echo " You can choose 1-news, 2-economy, 3-english"
- echo
- read channel
- case $channel
- in
- 1) mplayer mms://winmedia.cctv.com.cn/live1;;
- 2) mplayer mms://winmedia.cctv.com.cn/live2;;
- 3) mplayer mms://winmedia.cctv.com.cn/live3;;
- esac
- }
- # define play_btv: play btv online channel
- play_btv()
- {
-
- wget "http://211.144.23.6/program_list.asp?chan_name=%B1%B1%BE%A9%D0%C2%CE%C5#" -O $HOME/.live
- grep rtsp $HOME/.live | cut -d "(" -f2 | cut -d "," -f1 | tr -d "'" >$HOME/.live
- mplayer -playlist $HOME/.live
- rm $HOME/.live
- }
- # define play_cri: play cri online news, musics
- play_cri()
- {
- wget [url]http://live.cri.com.cn/fm915.ram[/url] -O $HOME/.live
- mplayer -playlist $HOME/.live
- }
- echo "============================================================"
- echo "= ="
- echo "= You should install MPlayer first to use this script ="
- echo "= ="
- echo "= Testing ...... ="
- echo "= ="
- echo "============================================================"
- echo
- which mplayer 1>/dev/null 2>&1
- case $?
- in
- 0) echo " OK, you have MPlayer installed. Go on";;
- *) echo " Sorry, you don't have Mplayer installed. Quit";break;;
- esac
- echo
- echo "============================================================"
- echo "= ="
- echo "= The Online Media to choose include: ="
- echo "= ="
- echo "= bbc: BBC online news, including ram and mms stream ="
- echo "= cnn: CNN online news, including ram and mms stream ="
- echo "= cctv: CCTV online channel, including channel 1-3 ="
- echo "= btv: BTV online channel ="
- echo "= cri: CRI online news, musics ="
- echo "= ="
- echo "============================================================"
- echo
- echo " Please type your choise, quit for exit"
- echo
- read choise
- echo
- case $choise
- in
- bbc) echo " You have chosen to play bbc online";echo;play_bbc;;
- cnn) echo " You have chosen to play cnn online";echo;play_cnn;;
- cctv) echo " You have chosen to play cctv online";echo;play_cctv;;
- btv) echo " You have chosen to play btv online";echo;play_btv;;
- cri) echo " You have chosen to play cri online";echo;play_cri;;
- quit) break;;
- esac
复制代码 |
|