博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

睡前要抱抱

   mash.cublog.cn
关于作者  
mystérieux

我的分类  




[Bash脚本] 选台与播放
mms源在观看过程中会出现中断退出的现象,有时候是因为网络不通畅,有时候是节目本身的问题,比如, 日本索尼音乐台 mms://morrich.gekimedia.net/MainStream500, 一首歌唱完之后就会退出, 可以用循环语句实现退出后的重新连接,并用trap来捕捉Ctrl-C的停止信号。

#!/bin/bash

function play () {
    while :
    do
        mplayer -fs $go
        trap 'exit 1' 2
    done
}

clear
echo -n "          "
echo -e '\E[47;44m'"\033[1mMy Favourite TV Channels List\033[0m"
echo; echo
echo -e "\033[1mChoose one of the following channels:\033[0m"
echo "(Enter only the first letter of name.)"
echo
echo -en '\E[1;34m'"\033[1mO\033[0m"
echo "lympics-cctv"
echo -en '\E[1;35m'"\033[1mN\033[0m"
echo "ews-cctv"
echo -en '\E[1;32m'"\033[1mE\033[0m"
echo "du-cctv10"

read tv
case "$tv" in
    "O" | "o" )
        go="mms://live.cctv.com/live15"
        ;;
    "N" | "n" )
        go="mms://live.cctv.com/livenews"
        ;;
    "E" | "e" )
        go="mms://live.cctv.com/live20"
        ;;
    *)
        echo
        echo "Not yet in database."
        exit 0
        ;;
esac
echo
play

 发表于: 2007-12-31,修改于: 2008-05-17 04:34 已浏览314次,有评论0条 推荐 投诉

  网友评论

  发表评论



Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们
页面生成时间:5.2048

京ICP证041476号