#!/bin/sh

# Seerai is a program for showing some television streams
# from the Italian national broadcasting company Rai-TV.
# Presently only some channels are available; in particular
# it is not possible to see channels using the "Smoothstreaming"
# technology by Microsoft, i.e. Rai1, Rai2, Rai3 and others.
# The real address of the stream is decrypted using the
# railease.py script by Stefano Sanfilippo, released under the GPL
# license.
# See also:
# http://code.google.com/p/railease/
#
# Icon courtesy of http://www.iconarchive.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Authors:
# 	Ernesto de Bernardis <maemo@debernardis.it>


until [ "$fine" = "1" ]; do

    chan=`zenity --height=1000 --list \
          --title="Choose RAI channel - press Cancel to exit " \
          --column="Channel name" \
            "RaiNews" \
            "Rai4" \
            "RaiGulp" \
            "RaiSport1" \
            "RaiScuola"  \
            "RaiStoria"  \
            "RaiExtra"  \
            "RaiPremium" \
            "RaiYoYo"    \
            "RaiMovie"   \
            "RaiMed"     \
            "EuroNews"`   

echo $chan

if [ "$chan" != "" ]; then 
  
stream=`python /usr/bin/railease.py $chan`

echo $stream

      /opt/kmplayer/bin/kmplayer "$stream"
      #mplayer -cache 4000 -softvol -softvol-max 1000 -fs $stream

  else
 
      fine="1"

fi

done
