source: titan/mediathek/localparser_secret/bs.sh @ 36968

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

update tithek

  • Property svn:executable set to *
File size: 7.7 KB
Line 
1#!/bin/bash
2# titannit box parser for burning series
3
4SRC=$1
5INPUT=$2
6PARAM=$3
7PARAM2=$4
8URL="http://bs.to/"
9PARSER=`echo $SRC | tr '/' '\n' | tail -n1 | sed 's/.sh//'`
10NAME="burningseries"
11wgetbin="wget -q -T2"
12TMP=/tmp/parser
13
14rm -rf $TMP > /dev/null 2>&1
15mkdir $TMP > /dev/null 2>&1
16
17if [ `echo $SRC | grep ^"/mnt/parser" |wc -l` -gt 0 ];then
18        TYPE="$SRC - Shell script"
19elif [ `echo $SRC | grep ^"/var/swap" | wc -l` -gt 0 ];then
20        TYPE="Swap - Shell script"
21elif [ `echo $SRC | grep ^"/mnt/swapextensions" | wc -l` -gt 0 ];then
22        TYPE="Mnt - Shell script"
23else
24        TYPE="Flash - Shell script"
25fi
26
27init()
28{
29        echo "Burning Series($TYPE)#$SRC $SRC mainmenu#http://atemio.dyndns.tv/mediathek/menu/$PARSER.jpg#$PARSER.jpg#TiThek#0"
30}
31
32mainmenu()
33{
34        echo "Genres#$SRC $SRC genres#http://atemio.dyndns.tv/mediathek/menu/serien.genre.jpg#serien.genre.jpg#$NAME#0" >/tmp/tithek/$PARSER.mainmenu.list
35        echo "All Series#$SRC $SRC allseries#http://atemio.dyndns.tv/mediathek/menu/serien.jpg#serien.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
36        echo "Search#$SRC $SRC search#http://atemio.dyndns.tv/mediathek/menu/search.jpg#search.jpg#$NAME#0" >>/tmp/tithek/$PARSER.mainmenu.list
37        echo "/tmp/tithek/$PARSER.mainmenu.list"
38}
39
40genres()
41{
42        $wgetbin $URL"andere-serien" -O - | awk -v SRC=$SRC -v NAME=$NAME '
43BEGIN { in_genres = 0
44      }
45
46/<div class="genre">/ { in_genres = 1
47                        next
48                      }
49
50/<span><strong>/ { i = index($0, "<span><strong>") + 14
51                   j = index($0, "</strong></span>") - i
52                   title = substr($0, i, j)
53                   pic = tolower(title)
54                   print title "#" SRC " " SRC " series " title "#http://atemio.dyndns.tv/mediathek/menu/" pic ".jpg#" pic ".jpg#" NAME "#0"
55                   next
56                 }
57                 
58' >/tmp/tithek/$PARSER.genres.list
59        echo "/tmp/tithek/$PARSER.genres.list"
60}
61
62series()
63{
64        $wgetbin $URL"andere-serien" -O - | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
65/<span><strong>/ { i = index($0, "<span><strong>") + 14
66                   j = index($0, "</strong></span>") - i
67                   genre = substr($0, i, j)
68                 }
69
70/<li><a href=\"/ { if (genre == PARAM) {
71                      i = index($0, "<li><a href=\"") + 13
72                      j = index(substr($0, i), "\">") - 1
73                      url = substr($0, i, j)
74                      k = i + j + 2
75                      l = index(substr($0, k), "</a></li>") - 1
76                      title = substr($0, k, l)
77                      print title "#" SRC " " SRC " staffel " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#0"
78                   }
79                   next
80                 }
81' >/tmp/tithek/$PARSER.series.list
82        echo "/tmp/tithek/$PARSER.series.list"
83}
84
85staffel()
86{
87        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v SRC=$SRC -v NAME=$NAME '
88/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
89                          }
90
91/<li class=\" \"><a href="/ { i = index($0, "<li class=\" \"><a href=\"") + 23
92                              j = index(substr($0, i), "\">") - 1
93                              url = substr($0, i, j)
94                              k = i + j + 2
95                              l = index(substr($0, k), "</a></li>") - 1
96                              staffel = substr($0, k, l)
97                              print "Staffel " staffel "#" SRC " " SRC " episode " url " " staffel "#http://atemio.dyndns.tv/mediathek/menu/s" staffel ".jpg#s" staffel ".jpg#" NAME "#0"
98                            }
99' >/tmp/tithek/$PARSER.staffel.list
100        echo "/tmp/tithek/$PARSER.staffel.list"
101}
102
103episode()
104{
105        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
106BEGIN { in_table_row = 0
107        episode = ""
108        url = ""
109        title = ""
110      }
111/<tr>/ { in_table_row = 1
112         next
113       }
114/<td><a href=\"/ { if (in_table_row == 1) {
115                      i = index($0, "<td><a href=\"") + 13
116                      j = index(substr($0, i), "\">") - 1
117                      url = substr($0, i, j)
118                   }
119                   next
120                 }
121
122/<td>/ { if (in_table_row == 1) {
123            i = index($0, "<td>") + 4
124            j = index(substr($0, i), "</td>") - 1
125            episode = substr($0, i, j)
126         }
127         next
128       }
129
130/<strong>/ { if (in_table_row == 1) {
131                i = index($0, "<strong>") + 8
132                j = index(substr($0, i), "</strong>") - 1
133                title = substr($0, i, j)
134                do {
135                   i = match(title, /&#[0-2][0-9][0-9];/)
136                   if (i != 0) {
137                      j = substr(title, i + 2, 3) * 1
138                      title = substr(title, 1, i - 1) sprintf("%c", j) substr(title, i + 6)
139                   }
140                } while(i != 0)
141             }
142             next
143           }
144
145/<\/tr>/ { if (in_table_row == 1) {
146             if (episode != "") {
147                print title "#" SRC " " SRC " hoster " url "#http://atemio.dyndns.tv/mediathek/menu/s" PARAM2 "e" episode ".jpg#s" PARAM2 "e" episode ".jpg#" NAME "#0"
148                title = ""
149                url = ""
150                episode = ""
151             }
152             in_table_row = 0
153          }
154          next
155        }
156
157/<li class=\" current\">/ { sub(/<li class=\" current\">/, "<li class=\" \">", $0)
158                          }
159' >/tmp/tithek/$PARSER.episode.list
160        echo "/tmp/tithek/$PARSER.episode.list"
161}
162
163hoster()
164{
165        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
166BEGIN { in_hoster = 0
167        url = ""
168        title = ""
169      }
170
171/<h3>Hoster dieser Episode<\/h3>/ { in_hoster = 1
172                                    next
173                                  }
174
175/href=\"/ { if (in_hoster == 1) {
176               i = index($0, "href=\"") + 6
177               j = index(substr($0, i), "\">") - 1
178               url = substr($0, i, j)
179            }
180            next
181          }
182
183/<\/span> / { if (in_hoster == 1) {
184                 i = index($0, "</span> ") + 8
185                 j = index(substr($0, i), "</a>") - 1
186                 title = substr($0, i, j)
187                 print title "#" SRC " " SRC " video " url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#111"
188              }
189              next
190            }
191
192/<\/ul>/ { in_hoster = 0
193          next
194        }
195
196' >/tmp/tithek/$PARSER.hoster.list
197        echo "/tmp/tithek/$PARSER.hoster.list"
198}
199
200video()
201{
202        $wgetbin $URL$PARAM -O - | awk -v PARAM=$PARAM -v PARAM2=$PARAM2 -v SRC=$SRC -v NAME=$NAME '
203BEGIN { in_hoster = 0
204        url = ""
205        title = ""
206      }
207
208/<div id=\"video_actions\">/ { in_video = 1
209                               next
210                             }
211
212/<a href=\"/ { if (in_video == 1) {
213                  i = index($0, "<a href=\"") + 9
214                  j = index(substr($0, i), "\"") - 1
215                  url = substr($0, i, j)
216
217                  i = index($0, "<a href=\"") + 16
218                  j = index(substr($0, i), "/") - 1
219                  title = substr($0, i, j)
220                 
221#                  print "Originalvideo#" url "#http://atemio.dyndns.tv/mediathek/menu/default.jpg#default.jpg#" NAME "#140"
222#                  print title "#" url "#http://atemio.dyndns.tv/mediathek/menu/" title ".jpg#" title ".jpg#" NAME "#14"
223                  print url
224               }
225               next
226             }
227
228/<\/div>/ { in_video = 0
229            next
230          }
231
232' >/tmp/tithek/$PARSER.video.list
233#       echo "/tmp/tithek/$PARSER.video.list"
234        cat     "/tmp/tithek/$PARSER.video.list"
235}
236
237case $INPUT in
238        init) $INPUT;;
239        mainmenu) $INPUT;;
240        genres) $INPUT;;
241        series) $INPUT;;
242        staffel) $INPUT;;
243        episode) $INPUT;;
244        hoster) $INPUT;;
245        video) $INPUT;;
246esac
247
Note: See TracBrowser for help on using the repository browser.