Δημοσιεύτηκε: 23 Μαρ 2009, 16:11
από ftso
Αυτός είναι ο κώδικας του ProTV...
Το γραφικό δημιουργείτε με το zenity το οποίο είναι είναι αρκετά καλό και απλό για την εμφάνιση παραθυρικού...

Κώδικας: Επιλογή όλων
#!/bin/bash
#proTV is a bash script that shows the tv program of various Greek channels.

#Depends on:zenity

#Copyright (C) 2008 Dimitris Diamantis (aka ftso)
#This is free software. You may redistribute copies of it under the terms of
#the GNU General Public License <http://www.gnu.org/licenses/GPL.html>
#There is NO WARRANTY, to the extent permitted by law.

#in.gr webiste is copyright of Lambrakis Press

while [ 1 ];
do
system_encoding="utf8"
i_am=`whoami`

test1=/tmp/$i_am-mtv1
test2=/tmp/$i_am-mtv21
tes1=/tmp/$i_am-mtv2
tes2=/tmp/$i_am-mtv3
tes3=/tmp/$i_am-mtv4
tes4=/tmp/$i_am-mtv5

rm -f $test1 $tes1 $tes2 $tes3 $tes4 $test2
touch $test1 $tes1 $tes2 $tes3 $tes4 $test2

pdate=$(zenity --calendar --text "Διαλέξτε μέρα" --title "Date" --date-format=%Y-%m-%d);
if [ $? != 0 ]; then exit 0; fi

ping -c 1 www.google.gr
if [ $? != 0 ]; then
zenity --error --title="Error" --text="Connection Problem!"
exit 0;
fi

wget -O - "http://www.in.gr/TV/results.asp?dtmDate=$pdate" 2>&1 > $test2 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --width=300 --height=100 --progress --auto-close --title="Downloading Tv program from in.gr..." --text="Downloading Tv program from in.gr..."
if [ $? != 0 ]; then
rm -f $test1 $tes1 $tes2 $tes3 $tes4 $test2
exit 0;
fi
cat $test2 | iconv -f iso-8859-7 -t $system_encoding > $test1


zn=$(grep ChannelID $test1|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/ \2/'|grep -E -n "[0-9A-Za-zα-ωΑ-Ω]"|awk '{print "FALSE " $1$2$3$4}')

input=$(zenity --title="Channels" --text="Επιλογή καναλιού" --list --radiolist --height=430 --width=295 --column "#" --column "Κανάλι" $zn --separator=" ")
if [ $? != 0 ]; then
rm -f $test1 $tes1 $tes2 $tes3 $tes4 $test2
exit 0;
fi

cn=$(echo $input | awk 'BEGIN { FS=":" } ; {print $1}')
cn1=$(echo $input | awk 'BEGIN { FS=":" } ; {print $2}')

Channel=`grep ChannelID $test1|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/\1/'|sed -n ${cn}p`


grep -v class $test1|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 1~8p|sed 's/[\t]*//' > $tes1
grep -v class $test1|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 2~8p|sed 's/[\t]*//' > $tes2
grep -v class $test1|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 6~8p|sed 's/[\t]*//' > $tes3

for ((i=1; i<=`cat $tes1 | wc -l`; i++));
do echo -e "`sed -n ${i}p $tes1`\t`sed -n ${i}p $tes2`\t\t\t\t\t\t\t`sed -n ${i}p $tes3`" >> $tes4 ; done
cat $tes4 | zenity --title="TV Program" --text="Το πρόγραμμα του καναλιού $cn1 για τις $pdate" --list --width 680 --height=380 --column="Ώρα" --column="Τίτλος" --column="Είδος" --separator=" "
if [ $? != 0 ]; then
rm -f $test1 $tes1 $tes2 $tes3 $tes4 $test2
exit 0;
fi
done



Λεπτομέρειες εδώ viewtopic.php?f=6&t=123&p=676#p676