source: titan/mediathek/localparser_secret/streamlive.sh @ 37154

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

test global file

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1
2#!/bin/sh
3# first sh box parser for titannit mfg obi
4
5SRC=$1
6INPUT=$2
7FROM=$3
8PAGE=$4
9
10FILENAME=`echo $PAGE | tr '/' '.'`
11FILENAME=`echo $FILENAME | tr '&' '.'`
12
13if [ -z "$PAGE" ]; then
14        FILENAME=none
15fi
16
17URL=www.streamlive.to
18PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
19NAME=StreamLive
20
21mkdir $TMP > /dev/null 2>&1
22
23if [ `echo $SRC | grep ^"/mnt/parser" | wc -l` -gt 0 ];then
24        TYPE="$SRC - Shell script"
25elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
26        TYPE="Swap - Shell script"
27elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
28        TYPE="Mnt - Shell script"
29else
30        TYPE="Flash - Shell script"
31fi
32
33init()
34{
35        if [ "$ARCH" != "sh4" ] || [ -e /etc/.beta ];then
36                rm -f /mnt/network/cookies > /dev/null 2>&1
37                rm -rf $TMP > /dev/null 2>&1
38                echo "$NAME ($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
39        fi
40}
41
42mainmenu()
43{
44        echo "Category#$SRC $SRC category#http://atemio.dyndns.tv/mediathek/menu/categoty.jpg#categoty.jpg#$NAME#0" > $TMP/$PARSER.$INPUT.list
45        echo "$TMP/$PARSER.$INPUT.list"
46}
47
48category()
49{
50        if [ ! -e "/tmp/tithek/$PARSER.$INPUT.list" ]; then
51                tagcount=60
52                i=1
53                until [ "$i" -gt "$tagcount" ]
54                do
55                TITLE="Page $i"
56                echo "$TITLE#$SRC $SRC page category '?p=$i&q=&sort=1'#http://atemio.dyndns.tv/mediathek/menu/page.jpg#page.jpg#$NAME#0" >> /tmp/tithek/$PARSER.$INPUT.list
57                i=`expr $i + 1`
58                done
59        fi
60        echo "/tmp/tithek/$PARSER.$INPUT.list"
61}
62
63page()
64{
65        if [ ! -e "$TMP/$PARSER.$INPUT.$FROM.$FILENAME.list" ]; then
66                piccount=0
67
68                $curlbin $URL/$PAGE -o $TMP/cache.$PARSER.$FROM.$FILENAME.1
69
70                cat $TMP/cache.$PARSER.$FROM.$FILENAME.1 | tr '\n' '\r' |  tr '\r' ' ' | tr '\n' ' ' | tr '\t' ' ' | sed 's/ \+/ /g' | sed 's!<a href="http://www.streamlive.to/view/!\nhttp://www.streamlive.to/view/!g' | grep ^"http://www.streamlive.to/view/" | grep -v "<strong>" | grep -v "premium_only" >$TMP/cache.$PARSER.$FROM.$FILENAME.2
71
72                while read -u 3 ROUND; do
73
74                        URL=`echo $ROUND | cut -d'"' -f1`
75                        PIC=`echo $ROUND | sed 's!src="!\npic="!g' | grep ^pic= | cut -d'"' -f2 | tail -n1`
76                        TITLE=`echo $ROUND | sed 's!title="!\ntitle="!g' | grep ^title= | cut -d'"' -f2 | tail -n1`
77                        if [ -z "$TITLE" ];then
78                                TITLE=`echo $ROUND | cut -d"<" -f2 | cut -d">" -f2`
79                        fi
80               
81                        if [ -z "$PIC" ] || [ "$PIC" = "http:" ]; then 
82                                PIC="http://atemio.dyndns.tv/mediathek/menu/default.jpg"
83                        fi
84               
85                        TITLE=`echo $URL | tr '/' '\n' | tail -n1 | sed 's/_/ /g'`
86                        TITLE=`echo $TITLE | sed -e 's/&#038;/&/g' -e 's/&amp;/und/g' -e 's/&quot;/"/g' -e 's/&lt;/\</g' -e 's/&#034;/\"/g' -e 's/&#039;/\"/g' -e 's/#034;/\"/g' -e 's/#039;/\"/g' -e 's/&szlig;/Ãx/g' -e 's/&ndash;/-/g' -e 's/&Auml;/Ã/g' -e 's/&Uuml;/ÃS/g' -e 's/&Ouml;/Ã/g' -e 's/&auml;/ä/g' -e 's/&uuml;/ü/g' -e 's/&ouml;/ö/g' -e 's/&eacute;/é/g' -e 's/&egrave;/è/g' -e 's/%F6/ö/g' -e 's/%FC/ü/g' -e 's/%E4/ä/g' -e 's/%26/&/g' -e 's/%C4/Ã/g' -e 's/%D6/Ã/g' -e 's/%DC/ÃS/g' -e 's/%28/(/g' -e 's/%29/)/g' -e 's/%3A/:/g' -e 's/%40/@/g' -e 's/%2B/&/g' -e 's/%C3/A/g' -e 's/%B1/&/g' -e 's/%5B//g' -e 's/%5D//g' -e 's!%2F!/!g' -e 's/|/ /g' -e 's/(/ /g' -e 's/)/ /g' -e 's/+/ /g' -e 's/\//-/g' -e 's/,/ /g' -e 's/;/ /g' -e 's/:/ /g' -e 's/\.\+/./g'`
87
88                        if [ ! -z "$TITLE" ] && [ ! -z "$URL" ];then
89                                if [ ! -e $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list ];then
90                                        touch $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list
91                                fi
92                                piccount=$[$piccount+1]
93                                LINE="$TITLE#$URL#$PIC#$PARSER_$piccount.jpg#$NAME#91"
94                                echo "$LINE" >> $TMP/$PARSER.$INPUT.$FROM.$FILENAME.list
95                        fi
96       
97                done 3<$TMP/cache.$PARSER.$FROM.$FILENAME.2
98                rm $TMP/cache.* > /dev/null 2>&1
99        fi
100        echo "$TMP/$PARSER.$INPUT.$FROM.$FILENAME.list"
101}
102
103case $INPUT in
104        init) $INPUT;;
105        mainmenu) $INPUT;;
106        category) $INPUT;;
107        page) $INPUT;;
108esac
Note: See TracBrowser for help on using the repository browser.