source: titan/mediathek/localparser_free/giga.sh @ 36952

Last change on this file since 36952 was 36524, checked in by obi, 8 years ago

test

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1#!/bin/bash
2# first sh box parser for titannit mfg obi
3
4SRC=$1
5INPUT=$2
6PAGE=$3
7
8ARCH=`cat /etc/.arch`
9URL=http://www.giga.de
10PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
11NAME=Giga
12
13wgetbin="wget -q -T2"
14TMP=/tmp/parser
15
16rm -rf $TMP > /dev/null 2>&1
17mkdir $TMP > /dev/null 2>&1
18
19if [ "$SRC" = "/mnt/parser" ];then
20        TYPE="$SRC - Shell script"
21elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
22        TYPE="Swap - Shell script"
23elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
24        TYPE="Mnt - Shell script"
25else
26        TYPE="Flash - Shell script"
27fi
28
29init()
30{
31        echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
32}
33
34mainmenu()
35{
36        echo "Category#$SRC $SRC category#http://atemio.dyndns.tv/mediathek/menu/categoty.jpg#categoty.jpg#$NAME#0" > /tmp/tithek/$PARSER.$INPUT.list
37#       echo "Suche#$SRC $SRC suche#http://atemio.dyndns.tv/mediathek/menu/search.jpg#giga.jpg#$NAME#0" >> /tmp/tithek/$PARSER.$INPUT.list
38        echo "/tmp/tithek/$PARSER.$INPUT.list"
39}
40
41category()
42{
43        WATCHLIST="tv/alle-videos"
44
45        if [ ! -e "/tmp/tithek/$PARSER.$INPUT.list" ]; then
46                for ROUND0 in $WATCHLIST; do
47                        tags=""
48                        tagcount=60
49                        i=1
50                        until [ "$i" -gt "$tagcount" ]
51                        do
52                        tags="$tags~"$ROUND0"/page/$i"
53                        TITLE="`echo $ROUND0 | sed 's!/! !g' | sed 's!-! !g'` Page $i"
54                        echo "$TITLE#$SRC $SRC page $ROUND0/page/$i#http://atemio.dyndns.tv/mediathek/menu/page.jpg#page.jpg#$NAME#0" >> /tmp/tithek/$PARSER.$INPUT.list
55                        i=`expr $i + 1`
56                        done
57                done
58        fi
59        echo "/tmp/tithek/$PARSER.$INPUT.list"
60}
61
62page()
63{
64        if [ ! -e "/tmp/tithek/$PARSER.$INPUT.list" ]; then
65                $wgetbin $URL/$PAGE -O $TMP/cache.$PARSER."$filename"."1"
66                cat $TMP/cache.$PARSER."$filename"."1" | tr '\r' ' ' | tr '\n' '\r' | tr '\t' ' ' | sed 's/<section/\n<section/g' | grep '^<section id="content">' | sed 's/<li id="/\n<li id="/g' | grep '^<li id="' | sed 's/&quot;/"/g' >$TMP/cache.$PARSER."$filename"."2"
67               
68                piccount=0
69
70                while read -u 3 ROUND2; do
71                        PIC=`echo $ROUND2 | sed 's/<img /\n<img /g' | grep '^<img ' | cut -d'"' -f2 | cut -d'"' -f1`
72                        URL=`echo $ROUND2 | sed 's/iframe src="/\niframe src="/g' | grep '^iframe src=' | cut -d'"' -f2 | cut -d'?' -f1`
73                        TITLE=`echo $ROUND2 | sed 's/ alt="/\n alt="/g' | grep '^ alt=' | cut -d'"' -f2 | cut -d'"' -f1`
74               
75                        if [ -z "$PIC" ]; then 
76                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
77                        fi
78       
79                        if [ `echo $PIC | grep ".png" | wc -l` -eq 0 ];then
80                                PICEXT=jpg
81                        else
82                                PICEXT=png
83                        fi
84               
85                        TITLE=`echo $TITLE | sed -e 's/ &amp; / und /g' -e 's/&amp;/ und /g' -e "s/&#8217;/'/g" -e 's/&#8211;/-/g' -e 's/&#8230;/.../g' -e 's/&#8220;/"/g' -e 's/&#8221;/"/g' -e "s/&#8216;/'/g" -e 's/#//g'`
86               
87                        if [ ! -z "$TITLE" ] && [ ! -z "$URL" ];then
88                                piccount=`expr $piccount + 1`
89                               
90                                LINE="$TITLE#$URL#$PIC#$PARSER_$piccount.$PICEXT#$NAME#15"
91                                echo "$LINE" >> /tmp/tithek/$PARSER.$INPUT.list
92                        fi
93                done 3<$TMP/cache.$PARSER."$filename"."2"
94                rm $TMP/cache.* > /dev/null 2>&1
95        fi     
96        echo "/tmp/tithek/$PARSER.$INPUT.list"
97}
98
99case $INPUT in
100        init) $INPUT;;
101        mainmenu) $INPUT;;
102        category) $INPUT;;
103        page) $INPUT;;
104esac
105
Note: See TracBrowser for help on using the repository browser.