#!/bin/bash## Copyright (C) 2006 Marios Andreopoulos - mrsaccess# Distributed under the terms of the GNU General Public License v2# ### mtv is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.# See the GNU General Public License for more details.### Version notice:# There aren't any known bugs in this script.###system_encoding="utf8"prog_name="mtv"prog_version="0.1"release_name="The truth is out there."fullprog="${prog_name}-${prog_version}"DaTe=`date +%Y-%m-%d`i_am=`whoami`rawdata=/tmp/$i_am-mtv1list1=/tmp/$i_am-mtv2list2=/tmp/$i_am-mtv3list3=/tmp/$i_am-mtv4#Setting some color codesGR=$'\x1b[1;32m'RED=$'\x1b[31m'REDB=$'\x1b[31;1m'TQ=$'\x1b[36;1m'TQB=$'\x1b[36;1;5m'YL=$'\x1b[33;1m'NC=$'\x1b[0m'version_info(){cat <<END ${prog_name}, version ${prog_version} codename ${TQB}$release_name${NC} Copyright (C) 2006 Marios Andreopoulos - mrsaccess 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 PressEND}tvguide(){echo -e "Φόρτωση προγράμματος από το in.gr.\n\n"ls $rawdata >/dev/null 2>&1if ((`echo $?`!=0)); then echo hi > $rawdatafiif [ `head -n1 $rawdata` != "$DaTe" ]; then echo hi echo $DaTe > $rawdata wget -O - "http://www.in.gr/TV/results.asp?dtmDate=$DaTe"|iconv -f iso-8859-7 -t $system_encoding >> $rawdataficleargrep ChannelID $rawdata|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/ \2/'|grep -E -n "[0-9A-Za-zα-ωΑ-Ω]"number_of_channels=`grep ChannelID $rawdata|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/ \2/'|grep -E -n "[0-9A-Za-zα-ωΑ-Ω]"|wc -l`echo -en "\nΕπιλέξτε κανάλι και πιέστε ENTER: ";read -s -n3 channel_numberchannel_number=`echo $channel_number|sed -e 's/^[0]*//'`if [[ "$channel_number" -lt "1" ]]; then echo -e "\n\nΛάθος κανάλι."; exit; fiif [[ "$channel_number" -gt "$number_of_channels" ]]; then echo -e "\n\nΛάθος κανάλι."; exit; fiChannel=`grep ChannelID $rawdata|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/\1/'|sed -n ${channel_number}p`clearecho -e "Το πρόγραμμα του καναλιού `grep ChannelID $rawdata|grep -vE "class|size"|sort -u|sed -e 's/.*ChannelID=\(.*\)">\(.*\)<\/a.*/\2/'|sed -n ${channel_number}p` για τις $DaTe:"grep -v class $rawdata|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 1~8p|sed 's/[\t]*//' > $list1grep -v class $rawdata|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 2~8p|sed 's/[\t]*//' > $list2grep -v class $rawdata|grep -C3 "ID=$Channel"|sed -e 's/<td>\(.*\)<\/td>/\1/'|sed -e 's/<a \(.*\)">\(.*\)<\/a>/\2/'|sed -n 6~8p|sed 's/[\t]*//' > $list3for ((i=1; i<=`cat $list1|wc -l`; i++)); do echo -e "`sed -n ${i}p $list1`\t`sed -n ${i}p $list2`\t\t\t\t\t\t\t`sed -n ${i}p $list3`"; donerm -f $list1 $list2 $list3}for ((i=$OPTIND; i<=$#; ++i)); do case ${!i} in -v | --version ) version_info; exit;; -h | --help ) help_info; exit;; * ) echo -e " Sorry, $prog_name was called with unknown argument(s).\n Try again without any arguments. ;)"; exit;; esacdonetvguide