moved from screen to tmux
[tvweb.git] / bin / tv
blobd23dd1b6b9f23606bff63cb9992b63bbc4674106
1 #!/bin/bash
3 # mplayer parametres
4 #prms="-stereo 1 -vf pp=lb -cache 2048"
5 prms="--extraintf ncurses --play-and-exit --video-filter=deinterlace --deinterlace-mode=blend -f"
6 conf="$HOME/bin/tv.conf"
8 # shows all available channels
9 function show_channels() {
10 for a in `grep -v "#" $conf | cut -d":" -f1`; do
11 echo -n "$a, "
12 done
13 echo
16 # some usage informations
17 function show_help() {
18 echo "Usage: `basename $0` <param> [nocache|nostereo]"
19 echo
20 echo "<param> is one of:"
21 echo " <channel> is parsed from $conf, now is one of"
22 show_channels
23 echo " usage, help show this help screen"
24 echo " listchannels, lschan list available channels"
25 echo
26 echo "Have fun..."
29 # look for config file
30 if [ ! -f "$conf" ]; then
31 echo "Could not find config file, should be $conf."
32 exit 1
35 # check params
36 if [ $# -eq 0 ]; then
37 echo "Not enough parameters"
38 show_help
39 exit 1
42 # some custom actions
43 case $1 in
44 usage|help)
45 show_help
46 exit 0
48 listchannels|lschan)
49 show_channels
50 exit 0
52 esac
55 # get the station
56 gettv=`grep "$1:" $conf`
57 if [ "$gettv" ]; then
58 addr=`echo "$gettv" | grep -v "#" | cut -d":" -f2-`
59 else
60 echo "$1 :: unknown channel"
61 addr=$1
64 # check for cache param
65 case $2 in
66 nocache)
67 cache=""
69 nostereo)
70 prms=""
72 esac
74 # let's play
75 #echo "Running: mplayer ${addr/@/} $params"
76 #mplayer ${addr} $params
77 echo "Running: cvlc $prms ${addr}"
78 cvlc $prms "${addr}"