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

Last change on this file since 42588 was 42464, checked in by obi, 6 years ago

tithek testfix speedup init localhoster

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