1 | #ifndef MOVIE2K_H |
---|
2 | #define MOVIE2K_H |
---|
3 | |
---|
4 | char* movie2k(char* link) |
---|
5 | { |
---|
6 | debug(99, "link: %s", link); |
---|
7 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
8 | char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *url = NULL, *streamurl = NULL, *tmppath = NULL, *tmphost = NULL, *pos = NULL; |
---|
9 | titheklog(debuglevel, "/tmp/movie2k_streamurl_url0", NULL, NULL, NULL, link); |
---|
10 | |
---|
11 | if(link == NULL || ostrncmp("http://", link, 7)) return NULL; |
---|
12 | |
---|
13 | tmpstr1 = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1); |
---|
14 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek//movie2k_streamurl_tmpstr1_a", NULL, NULL, NULL, tmpstr1); |
---|
15 | |
---|
16 | tmpstr = string_resub("question.png", "underplayer", tmpstr1, 0); |
---|
17 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek//movie2k_streamurl_tmpstr1_b", NULL, NULL, NULL, tmpstr); |
---|
18 | |
---|
19 | free(tmpstr1), tmpstr1 = NULL; |
---|
20 | |
---|
21 | if(tmpstr == NULL) |
---|
22 | { |
---|
23 | textbox(_("Message"), _("Connection Error, try again later.") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); |
---|
24 | goto end; |
---|
25 | } |
---|
26 | |
---|
27 | url = oregex(".*<a href=\"(http://.*)\" target.*", tmpstr); |
---|
28 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek//movie2k_streamurl_url1", NULL, NULL, NULL, url); |
---|
29 | |
---|
30 | if(url == NULL) |
---|
31 | { |
---|
32 | textbox(_("Message"), _("Can not parse Stream URL, try again later.") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0); |
---|
33 | goto end; |
---|
34 | } |
---|
35 | |
---|
36 | streamurl = hoster(url); |
---|
37 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek//movie2k_streamurl_url7", NULL, NULL, NULL, url); |
---|
38 | end: |
---|
39 | free(url), url = NULL; |
---|
40 | free(tmpstr), tmpstr = NULL; |
---|
41 | free(tmpstr2), tmpstr2 = NULL; |
---|
42 | free(tmphost), tmphost = NULL; |
---|
43 | |
---|
44 | return streamurl; |
---|
45 | } |
---|
46 | |
---|
47 | int movie2k_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
48 | { |
---|
49 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
50 | int incount = 0; |
---|
51 | char* tmpstr = NULL; |
---|
52 | char* from = NULL; |
---|
53 | char* folgen = NULL; |
---|
54 | char* folgentmp = NULL; |
---|
55 | char* name = NULL; |
---|
56 | char* lang = NULL; |
---|
57 | char* season = NULL; |
---|
58 | char* episode = NULL; |
---|
59 | char* line = NULL; |
---|
60 | char* menu = NULL; |
---|
61 | char* str = NULL; |
---|
62 | char* pic = NULL; |
---|
63 | char* type = NULL; |
---|
64 | |
---|
65 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
66 | |
---|
67 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
68 | return ret; |
---|
69 | |
---|
70 | char* search = NULL; |
---|
71 | if(flag == 0) |
---|
72 | { |
---|
73 | if(searchstr == NULL) |
---|
74 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
75 | else |
---|
76 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
77 | } |
---|
78 | else |
---|
79 | search = ostrcat(link, NULL, 0, 0); |
---|
80 | |
---|
81 | if(search != NULL) |
---|
82 | { |
---|
83 | drawscreen(load, 0, 0); |
---|
84 | search = strstrip(search); |
---|
85 | search = stringreplacechar(search, ' ', '+'); |
---|
86 | debug(99, "search: %s", search); |
---|
87 | |
---|
88 | char* send = NULL; |
---|
89 | send = ostrcat(send, "GET /searchAutoCompleteNew.php?search=the HTTP/1.1\r\n", 1, 0); |
---|
90 | send = ostrcat(send, "Accept-Encoding: identity\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n", 1, 0); |
---|
91 | send = ostrcat(send, "Host: www.movie2k.to\r\nAccept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4\r\n", 1, 0); |
---|
92 | send = ostrcat(send, "Connection: close\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3\r\n\r\n", 1, 0); |
---|
93 | debug(99, "send: %s", send); |
---|
94 | |
---|
95 | tmpstr = gethttpreal("www.movie2k.to", "/searchAutoCompleteNew.php?search=the", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
96 | free(send); send = NULL; |
---|
97 | debug(99, "tmpstr: %s", tmpstr); |
---|
98 | titheklog(debuglevel, "/tmp/movie2k_search", NULL, NULL, NULL, tmpstr); |
---|
99 | |
---|
100 | char* key = string_resub("securekey=", "&search", tmpstr, 0); |
---|
101 | debug(99, "key: %s", key); |
---|
102 | |
---|
103 | send = ostrcat(send, "GET /movies.php?list=search&securekey=", 1, 0); |
---|
104 | send = ostrcat(send, key, 1, 0); |
---|
105 | send = ostrcat(send, "&search=", 1, 0); |
---|
106 | send = ostrcat(send, search, 1, 0); |
---|
107 | send = ostrcat(send, " HTTP/1.1\r\nAccept-Encoding: identity\r\n", 1, 0); |
---|
108 | send = ostrcat(send, "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4\r\n", 1, 0); |
---|
109 | send = ostrcat(send, "Host: www.movie2k.to\r\n", 1, 0); |
---|
110 | send = ostrcat(send, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3\r\n", 1, 0); |
---|
111 | send = ostrcat(send, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n", 1, 0); |
---|
112 | send = ostrcat(send, "Connection: close\r\nCookie: xxx2=ok;\r\n\r\n", 1, 0); |
---|
113 | debug(99, "send: %s", send); |
---|
114 | |
---|
115 | free(tmpstr), tmpstr = NULL; |
---|
116 | tmpstr = gethttpreal("movie2k.to", "/", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
117 | |
---|
118 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
119 | folgen = string_replace_all("1000\r\n", "", folgen, 1); |
---|
120 | folgen = string_replace_all("2000\r\n", "", folgen, 1); |
---|
121 | stringreplacechar(folgen, '\n', ' '); |
---|
122 | stringreplacechar(folgen, '\t', ' '); |
---|
123 | string_strip_whitechars(folgen); |
---|
124 | folgen = string_replace_all("</TD> </TR> <TR id=\"coverPreview", "</TD> </TR>\n<TR id=\"cover1Preview", folgen, 1); |
---|
125 | if(folgen != NULL) |
---|
126 | { |
---|
127 | int count = 0; |
---|
128 | int j; |
---|
129 | struct splitstr* ret1 = NULL; |
---|
130 | ret1 = strsplit(folgen, "\n", &count); |
---|
131 | |
---|
132 | if(ret1 != NULL && count > 0) |
---|
133 | { |
---|
134 | int max = count; |
---|
135 | for(j = 0; j < max; j++) |
---|
136 | { |
---|
137 | int rcret = waitrc(NULL, 10, 0); |
---|
138 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
139 | |
---|
140 | incount++; |
---|
141 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
142 | name = string_resub(".html\">", "</a>", ret1[j].part, 0); |
---|
143 | char* id = string_resub("online-film-", ".html", link, 0); |
---|
144 | if(id == NULL) |
---|
145 | id = string_resub("watch-movie-", ".html", link, 0); |
---|
146 | if(id == NULL) |
---|
147 | id = oregex(".*tvshows-(.*[0-9]{4,10})-.*", link); |
---|
148 | |
---|
149 | |
---|
150 | from = ostrcat("#coverPreview", id, 0, 0); |
---|
151 | pic = string_resub(from, from, tmpstr, 0); |
---|
152 | pic = string_resub("<img src='", "' alt=", pic, 1); |
---|
153 | if(pic == NULL) |
---|
154 | pic = ostrcat("http://atemio.dyndns.tv/mediathek/menu/default.jpg", NULL, 0, 0); |
---|
155 | |
---|
156 | if(ostrstr(link, "online-serie-") != NULL) |
---|
157 | type = ostrcat("40", NULL, 0, 0); |
---|
158 | else |
---|
159 | type = ostrcat("34", NULL, 0, 0); |
---|
160 | |
---|
161 | |
---|
162 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
163 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
164 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
165 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
166 | else |
---|
167 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
168 | |
---|
169 | ostrcatbig(&line, name, &maxlen, &bigpos); |
---|
170 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
171 | ostrcatbig(&line, "#http://www.movie2k.to/", &maxlen, &bigpos); |
---|
172 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
173 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
174 | ostrcatbig(&line, pic, &maxlen, &bigpos); |
---|
175 | ostrcatbig(&line, "#movie2k_search_", &maxlen, &bigpos); |
---|
176 | char* cincount = oitoa(incount + time(NULL)); |
---|
177 | ostrcatbig(&line, cincount, &maxlen, &bigpos); |
---|
178 | free(cincount); cincount = NULL; |
---|
179 | ostrcatbig(&line, ".jpg#movie2k - Search#", &maxlen, &bigpos); |
---|
180 | ostrcatbig(&line, type, &maxlen, &bigpos); |
---|
181 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
182 | |
---|
183 | free(str), str = NULL; |
---|
184 | |
---|
185 | free(name), name = NULL; |
---|
186 | free(lang), lang = NULL; |
---|
187 | free(season), season = NULL; |
---|
188 | free(episode), episode = NULL; |
---|
189 | free(from), from = NULL; |
---|
190 | free(pic), pic = NULL; |
---|
191 | free(type), type = NULL; |
---|
192 | if(j == 60) |
---|
193 | break; |
---|
194 | } |
---|
195 | } |
---|
196 | free(ret1), ret1 = NULL; |
---|
197 | } |
---|
198 | free(from), from = NULL; |
---|
199 | free(folgen), folgen = NULL; |
---|
200 | free(folgentmp), folgentmp = NULL; |
---|
201 | |
---|
202 | if(line != NULL) |
---|
203 | { |
---|
204 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
205 | menu = ostrcat("/tmp/tithek/movie2k.search.", oitoa(time(NULL)), 0, 1); |
---|
206 | menu = ostrcat(menu, ".list", 1, 0); |
---|
207 | writesys(menu, line, 0); |
---|
208 | free(line); line = NULL; |
---|
209 | |
---|
210 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
211 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
212 | ret = 0; |
---|
213 | free(menu); menu = NULL; |
---|
214 | } |
---|
215 | |
---|
216 | free(tmpstr), tmpstr = NULL; |
---|
217 | } |
---|
218 | free(search), search = NULL; |
---|
219 | return ret; |
---|
220 | } |
---|
221 | |
---|
222 | int movie2k_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
223 | { |
---|
224 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
225 | int ret = 1, count = 0, i = 0; |
---|
226 | |
---|
227 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
228 | return ret; |
---|
229 | |
---|
230 | if(searchstr == NULL) |
---|
231 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
232 | else |
---|
233 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
234 | |
---|
235 | if(search != NULL) |
---|
236 | { |
---|
237 | drawscreen(load, 0, 0); |
---|
238 | |
---|
239 | strstrip(search); |
---|
240 | string_tolower(search); |
---|
241 | |
---|
242 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/movie2k/streams/movie2k.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
243 | |
---|
244 | struct splitstr* ret1 = NULL; |
---|
245 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
246 | |
---|
247 | if(ret1 != NULL) |
---|
248 | { |
---|
249 | int max = count; |
---|
250 | for(i = 0; i < max; i++) |
---|
251 | { |
---|
252 | |
---|
253 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
254 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
255 | string_tolower(tmpstr1); |
---|
256 | |
---|
257 | if(ostrstr(tmpstr1, search) != NULL) |
---|
258 | { |
---|
259 | printf("found: %s\n", ret1[i].part); |
---|
260 | int rcret = waitrc(NULL, 10, 0); |
---|
261 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
262 | |
---|
263 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
264 | line = ostrcat(line, "\n", 0, 0); |
---|
265 | } |
---|
266 | free(tmpstr1), tmpstr1 = NULL; |
---|
267 | } |
---|
268 | free(ret1), ret1 = NULL; |
---|
269 | |
---|
270 | if(line != NULL) |
---|
271 | { |
---|
272 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
273 | menu = ostrcat("/tmp/tithek/movie2k.search.", oitoa(time(NULL)), 0, 1); |
---|
274 | menu = ostrcat(menu, ".list", 1, 0); |
---|
275 | writesys(menu, line, 0); |
---|
276 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
277 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
278 | ret = 0; |
---|
279 | } |
---|
280 | } |
---|
281 | free(tmpstr), tmpstr = NULL; |
---|
282 | } |
---|
283 | free(search), search = NULL; |
---|
284 | return ret; |
---|
285 | } |
---|
286 | |
---|
287 | int movie2k_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
288 | { |
---|
289 | debug(99, "link: %s", link); |
---|
290 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
291 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
292 | char* tmpstr = NULL, *line = NULL, *url = NULL; |
---|
293 | char* tmphname = NULL; |
---|
294 | char* pichname = NULL; |
---|
295 | |
---|
296 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
297 | return ret; |
---|
298 | |
---|
299 | drawscreen(load, 0, 0); |
---|
300 | |
---|
301 | tmpstr = gethttps(link, NULL, NULL, NULL, NULL, NULL, 1); |
---|
302 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/movie2k1_hoster_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
303 | |
---|
304 | if(tmpstr != NULL) |
---|
305 | { |
---|
306 | tmpstr = string_replace_all("\n", " ", tmpstr, 1); |
---|
307 | tmpstr = string_replace_all("\t", " ", tmpstr, 1); |
---|
308 | string_strip_whitechars(tmpstr); |
---|
309 | tmpstr = string_replace_all("<tr id=\"tablemoviesindex2\"", "\n<tr id=\"tablemoviesindex2\"", tmpstr, 1); |
---|
310 | tmpstr = string_replace_all("<select name=\"hosterlist\"", "\n<select name=\"hosterlist\"", tmpstr, 1); |
---|
311 | titheklog(debuglevel, "/var/usr/local/share/titan/plugins/tithek/movie2k2_hoster_tmpstr_replace", NULL, NULL, NULL, tmpstr); |
---|
312 | |
---|
313 | int count = 0; |
---|
314 | int incount = 0; |
---|
315 | int i; |
---|
316 | struct splitstr* ret1 = NULL; |
---|
317 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
318 | |
---|
319 | if(ret1 != NULL && count > 0) |
---|
320 | { |
---|
321 | int max = count; |
---|
322 | for(i = 0; i < max; i++) |
---|
323 | { |
---|
324 | printf("##############################################################\n"); |
---|
325 | |
---|
326 | printf("ret1[i].part: %s\n",ret1[i].part); |
---|
327 | |
---|
328 | |
---|
329 | if(ostrstr(ret1[i].part, "<tr id=\"tablemoviesindex2\"") != NULL) |
---|
330 | { |
---|
331 | printf("found: tablemoviesindex2\n"); |
---|
332 | url = string_resub("<a href=\"", "\"", ret1[i].part, 0); |
---|
333 | printf("url: %s\n",url); |
---|
334 | tmphname = string_resub("title=\"", " ", ret1[i].part, 0); |
---|
335 | printf("tmphname: %s\n",tmphname); |
---|
336 | pichname = ostrcat(tmphname, NULL, 0, 0); |
---|
337 | string_tolower(pichname); |
---|
338 | pichname = stringreplacecharonce(pichname, '.', '\0'); |
---|
339 | printf("pichname: %s\n",pichname); |
---|
340 | /* |
---|
341 | char* tmpstr1 = NULL; |
---|
342 | tmpstr1 = gethttps(url, NULL, NULL, NULL, NULL, NULL, 1); |
---|
343 | if(ostrstr(tmpstr1, "<select name=\"hosterlist\"") != NULL) |
---|
344 | { |
---|
345 | printf("-----------------------------------------------------\n"); |
---|
346 | printf("found: hosterlist\n"); |
---|
347 | tmpstr1 = string_replace_all("\n", " ", tmpstr1, 1); |
---|
348 | printf("found: hosterlist1\n"); |
---|
349 | tmpstr1 = string_replace_all("\t", " ", tmpstr1, 1); |
---|
350 | printf("found: hosterlist2\n"); |
---|
351 | string_strip_whitechars(tmpstr1); |
---|
352 | printf("found: hosterlist3\n"); |
---|
353 | tmpstr1 = string_replace_all("<select name=\"hosterlist\"", "\n<select name=\"hosterlist\"", tmpstr1, 1); |
---|
354 | char* tmpstr2 = NULL; |
---|
355 | printf("found: hosterlist4\n"); |
---|
356 | tmpstr2 = string_resub("<select name=\"hosterlist\"", "</select>", tmpstr1, 0); |
---|
357 | printf("tmpstr2: %s\n",tmpstr2); |
---|
358 | free(tmpstr2), tmpstr2 = NULL; |
---|
359 | printf("-----------------------------------------------------\n"); |
---|
360 | |
---|
361 | } |
---|
362 | free(tmpstr1), tmpstr1 = NULL; |
---|
363 | */ |
---|
364 | int type = 94; |
---|
365 | |
---|
366 | debug(99, "(%d/%d) %s url: %s",i ,max ,tmphname, url); |
---|
367 | |
---|
368 | incount += 1; |
---|
369 | ostrcatbig(&line, tmphname, &maxlen, &bigpos); |
---|
370 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
371 | ostrcatbig(&line, url, &maxlen, &bigpos); |
---|
372 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/", &maxlen, &bigpos); |
---|
373 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
374 | ostrcatbig(&line, ".jpg#movie2k_", &maxlen, &bigpos); |
---|
375 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
376 | ostrcatbig(&line, ".jpg#movie2k - ", &maxlen, &bigpos); |
---|
377 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
378 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
379 | char* ctype = oitoa(type); |
---|
380 | ostrcatbig(&line, ctype, &maxlen, &bigpos); |
---|
381 | free(ctype), ctype = NULL; |
---|
382 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
383 | } |
---|
384 | free(url); url = NULL; |
---|
385 | } |
---|
386 | } |
---|
387 | free(ret1); ret1 = NULL; |
---|
388 | } |
---|
389 | free(tmpstr); tmpstr = NULL; |
---|
390 | |
---|
391 | if(line != NULL) |
---|
392 | { |
---|
393 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
394 | tmpstr = ostrcat("/tmp/tithek/movie2k.hoster.", oitoa(time(NULL)), 0, 1); |
---|
395 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
396 | |
---|
397 | writesys(tmpstr, line, 0); |
---|
398 | free(line); line = NULL; |
---|
399 | |
---|
400 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
401 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
402 | ret = 0; |
---|
403 | } |
---|
404 | |
---|
405 | return ret; |
---|
406 | } |
---|
407 | |
---|
408 | int movie2k_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
409 | { |
---|
410 | debug(99, "link: %s", link); |
---|
411 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
412 | int ret = 1, series = 0, maxlen = 0, bigpos = 0; |
---|
413 | char* ip = NULL, *pos = NULL, *id = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL, *episode = NULL; |
---|
414 | char* from = NULL; |
---|
415 | char* folgen = NULL; |
---|
416 | char* folgentmp = NULL; |
---|
417 | |
---|
418 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
419 | return ret; |
---|
420 | |
---|
421 | drawscreen(load, 0, 0); |
---|
422 | |
---|
423 | ip = string_replace("http://", "", (char*)link, 0); |
---|
424 | |
---|
425 | if(ip != NULL) |
---|
426 | pos = strchr(ip, '/'); |
---|
427 | if(pos != NULL) |
---|
428 | { |
---|
429 | pos[0] = '\0'; |
---|
430 | path = pos + 1; |
---|
431 | } |
---|
432 | |
---|
433 | if(!ostrncmp("tvshows-", path, 8)) |
---|
434 | { |
---|
435 | debug(99, "path: %s",path); |
---|
436 | tpath = ostrcat(path, NULL, 0, 0); |
---|
437 | id = oregex(".*tvshows-(.*[0-9]{4,10})-.*", path); |
---|
438 | tpath = string_replace("tvshows-season-", "", tpath, 1); |
---|
439 | tpath = string_replace(".html", "", tpath, 1); |
---|
440 | tpath = ostrcat(tpath, "-online-serie-", 1, 0); |
---|
441 | tpath = ostrcat(tpath, id, 1, 0); |
---|
442 | tpath = ostrcat(tpath, ".html", 1, 0); |
---|
443 | debug(99, "convertpath: %s",tpath); |
---|
444 | } |
---|
445 | else |
---|
446 | tpath = ostrcat(path, NULL, 0, 0); |
---|
447 | |
---|
448 | tmpstr = gethttp(ip, tpath, 80, NULL, NULL, 10000, NULL, 0); |
---|
449 | free(tpath), tpath = NULL; |
---|
450 | titheklog(debuglevel, "/tmp/movie2k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
451 | |
---|
452 | if(tmpstr != NULL) |
---|
453 | { |
---|
454 | if(ostrstr(tmpstr, "episodeform") != NULL) |
---|
455 | { |
---|
456 | int i; |
---|
457 | for(i = 1; i < 30; i++) |
---|
458 | { |
---|
459 | from = ostrcat(from, "<FORM name=\"episodeform", 1, 0); |
---|
460 | from = ostrcat(from, oitoa(i), 1, 1); |
---|
461 | from = ostrcat(from, "\">", 1, 0); |
---|
462 | folgen = string_resub(from, "</FORM>", tmpstr, 0); |
---|
463 | folgen = string_resub("<OPTION></OPTION>", "</SELECT>", folgen, 1); |
---|
464 | folgen = string_replace_all("><", ">\n<", folgen, 1); |
---|
465 | folgentmp = ostrcat(folgen, NULL, 0, 0); |
---|
466 | |
---|
467 | if(folgen != NULL) |
---|
468 | { |
---|
469 | int count = 0; |
---|
470 | int incount = 0; |
---|
471 | int j; |
---|
472 | struct splitstr* ret1 = NULL; |
---|
473 | ret1 = strsplit(folgen, "\n", &count); |
---|
474 | |
---|
475 | if(ret1 != NULL && count > 0) |
---|
476 | { |
---|
477 | int max = count + 1; |
---|
478 | for(j = 1; j < max; j++) |
---|
479 | { |
---|
480 | link = string_resub("<OPTION value=\"", "\"", ret1[j-1].part, 0); |
---|
481 | id = oregex(".*tvshows-(.*[0-9]{4,10})-.*", link); |
---|
482 | episode = oregex(".*>Episode (.*[0-9]{1,10})</OPTION>.*", ret1[j-1].part); |
---|
483 | |
---|
484 | debug(99, "(S%d/E%s)(%d) link: %s id: %s", i, episode, j, link, id); |
---|
485 | link = string_replace("tvshows-", "", link, 1); |
---|
486 | link = string_replace(id, "", link, 1); |
---|
487 | link = string_replace("-", "", link, 1); |
---|
488 | link = string_replace(".html", "", link, 1); |
---|
489 | link = ostrcat(link, "-online-serie-", 1, 0); |
---|
490 | link = ostrcat(link, id, 1, 0); |
---|
491 | link = ostrcat(link, ".html", 1, 0); |
---|
492 | debug(99, "(S%d/E%d) convertlink: %s id: %s", i, j, link, id); |
---|
493 | |
---|
494 | incount += 1; |
---|
495 | |
---|
496 | char* ci = oitoa(i); |
---|
497 | // char* cj = oitoa(j); |
---|
498 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
499 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
500 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
501 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
502 | ostrcatbig(&line, _("Episode"), &maxlen, &bigpos); |
---|
503 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
504 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
505 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
506 | ostrcatbig(&line, "#http://www.movie2k.to/", &maxlen, &bigpos); |
---|
507 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
508 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
509 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
510 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
511 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
512 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
513 | ostrcatbig(&line, ".jpg#movie2k_search_", &maxlen, &bigpos); |
---|
514 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
515 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
516 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
517 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
518 | ostrcatbig(&line, ".jpg#movie2k - ", &maxlen, &bigpos); |
---|
519 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
520 | ostrcatbig(&line, "#34\n", &maxlen, &bigpos); |
---|
521 | |
---|
522 | free(id); id = NULL; |
---|
523 | free(episode); episode = NULL; |
---|
524 | free(ci); ci = NULL; |
---|
525 | // free(cj); cj = NULL; |
---|
526 | } |
---|
527 | } |
---|
528 | free(ret1), ret1 = NULL; |
---|
529 | } |
---|
530 | free(from), from = NULL; |
---|
531 | free(folgen), folgen = NULL; |
---|
532 | free(folgentmp), folgentmp = NULL; |
---|
533 | } |
---|
534 | } |
---|
535 | } |
---|
536 | free(tmpstr), tmpstr = NULL; |
---|
537 | |
---|
538 | if(line != NULL) |
---|
539 | { |
---|
540 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
541 | if(series == 0) |
---|
542 | { |
---|
543 | tmpstr = ostrcat("/tmp/tithek/movie2k.hoster.", oitoa(time(NULL)), 0, 1); |
---|
544 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
545 | } |
---|
546 | else |
---|
547 | { |
---|
548 | tmpstr = ostrcat("/tmp/tithek/movie2k.hoster.ser.", oitoa(time(NULL)), 0, 1); |
---|
549 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
550 | } |
---|
551 | writesys(tmpstr, line, 0); |
---|
552 | |
---|
553 | titheklog(debuglevel, "/tmp/movie2k8_line", NULL, NULL, NULL, line); |
---|
554 | free(line); line = NULL; |
---|
555 | |
---|
556 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
557 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
558 | ret = 0; |
---|
559 | } |
---|
560 | return ret; |
---|
561 | } |
---|
562 | |
---|
563 | int movie2k_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
564 | { |
---|
565 | debug(99, "link: %s", link); |
---|
566 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
567 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
568 | char* ip = NULL, *pos = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL; |
---|
569 | char* from = NULL; |
---|
570 | char* folgen = NULL; |
---|
571 | char* folgentmp = NULL; |
---|
572 | char* name = NULL; |
---|
573 | char* lang = NULL; |
---|
574 | char* season = NULL; |
---|
575 | |
---|
576 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
577 | return ret; |
---|
578 | |
---|
579 | drawscreen(load, 0, 0); |
---|
580 | |
---|
581 | ip = string_replace("http://", "", (char*)link, 0); |
---|
582 | |
---|
583 | if(ip != NULL) |
---|
584 | pos = strchr(ip, '/'); |
---|
585 | if(pos != NULL) |
---|
586 | { |
---|
587 | pos[0] = '\0'; |
---|
588 | path = pos + 1; |
---|
589 | } |
---|
590 | |
---|
591 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
592 | free(tpath), tpath = NULL; |
---|
593 | titheklog(debuglevel, "/tmp/movie2k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
594 | |
---|
595 | if(tmpstr != NULL) |
---|
596 | { |
---|
597 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
598 | folgen = string_replace_all("\n", "", folgen, 1); |
---|
599 | folgen = string_replace_all("\t", "", folgen, 1); |
---|
600 | string_strip_whitechars(folgen); |
---|
601 | folgen = string_replace_all("</TD> </TR> <TR>", "</TD> </TR>\n<TR>", folgen, 1); |
---|
602 | |
---|
603 | if(folgen != NULL) |
---|
604 | { |
---|
605 | int count = 0; |
---|
606 | int j; |
---|
607 | struct splitstr* ret1 = NULL; |
---|
608 | ret1 = strsplit(folgen, "\n", &count); |
---|
609 | |
---|
610 | if(ret1 != NULL && count > 0) |
---|
611 | { |
---|
612 | int max = count; |
---|
613 | for(j = 0; j < max; j++) |
---|
614 | { |
---|
615 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
616 | |
---|
617 | name = oregex(".*><a href=.*\">(.*)</a></TD>.*", ret1[j].part); |
---|
618 | |
---|
619 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
620 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
621 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
622 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
623 | else |
---|
624 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
625 | |
---|
626 | season = oregex(".*Season:(.*[0-9]{1,3}).*", name); |
---|
627 | season = strstrip(season); |
---|
628 | debug(99, "(S%s) input: %s%s",season, name, lang); |
---|
629 | |
---|
630 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
631 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
632 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
633 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
634 | |
---|
635 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
636 | ostrcatbig(&line, "#http://www.movie2k.to/", &maxlen, &bigpos); |
---|
637 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
638 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
639 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
640 | ostrcatbig(&line, ".jpg#s", &maxlen, &bigpos); |
---|
641 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
642 | ostrcatbig(&line, ".jpg#movie2k - ", &maxlen, &bigpos); |
---|
643 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
644 | ostrcatbig(&line, "#39\n", &maxlen, &bigpos); |
---|
645 | |
---|
646 | free(name), name = NULL; |
---|
647 | free(lang), lang = NULL; |
---|
648 | free(season), season = NULL; |
---|
649 | } |
---|
650 | } |
---|
651 | free(ret1), ret1 = NULL; |
---|
652 | } |
---|
653 | free(from), from = NULL; |
---|
654 | free(folgen), folgen = NULL; |
---|
655 | free(folgentmp), folgentmp = NULL; |
---|
656 | } |
---|
657 | free(tmpstr), tmpstr = NULL; |
---|
658 | |
---|
659 | if(line != NULL) |
---|
660 | { |
---|
661 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
662 | tmpstr = ostrcat("/tmp/tithek/movie2k.series.", oitoa(time(NULL)), 0, 1); |
---|
663 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
664 | |
---|
665 | writesys(tmpstr, line, 0); |
---|
666 | |
---|
667 | titheklog(debuglevel, "/tmp/movie2k8_line", NULL, NULL, NULL, line); |
---|
668 | free(line); line = NULL; |
---|
669 | |
---|
670 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
671 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
672 | ret = 0; |
---|
673 | } |
---|
674 | return ret; |
---|
675 | } |
---|
676 | |
---|
677 | int movie2k_series_listed(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
678 | { |
---|
679 | debug(99, "link: %s", link); |
---|
680 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
681 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
682 | char* ip = NULL, *pos = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL; |
---|
683 | char* from = NULL; |
---|
684 | char* folgen = NULL; |
---|
685 | char* folgentmp = NULL; |
---|
686 | char* name = NULL; |
---|
687 | char* lang = NULL; |
---|
688 | char* season = NULL; |
---|
689 | char* episode = NULL; |
---|
690 | |
---|
691 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
692 | return ret; |
---|
693 | |
---|
694 | drawscreen(load, 0, 0); |
---|
695 | |
---|
696 | ip = string_replace("http://", "", (char*)link, 0); |
---|
697 | |
---|
698 | if(ip != NULL) |
---|
699 | pos = strchr(ip, '/'); |
---|
700 | if(pos != NULL) |
---|
701 | { |
---|
702 | pos[0] = '\0'; |
---|
703 | path = pos + 1; |
---|
704 | } |
---|
705 | |
---|
706 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
707 | free(tpath), tpath = NULL; |
---|
708 | titheklog(debuglevel, "/tmp/movie2k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
709 | |
---|
710 | if(tmpstr != NULL) |
---|
711 | { |
---|
712 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
713 | folgen = string_replace_all("\n", "", folgen, 1); |
---|
714 | folgen = string_replace_all("\t", "", folgen, 1); |
---|
715 | string_strip_whitechars(folgen); |
---|
716 | folgen = string_replace_all("</TD> </TR> <TR>", "</TD> </TR>\n<TR>", folgen, 1); |
---|
717 | |
---|
718 | if(folgen != NULL) |
---|
719 | { |
---|
720 | int count = 0; |
---|
721 | int j; |
---|
722 | struct splitstr* ret1 = NULL; |
---|
723 | ret1 = strsplit(folgen, "\n", &count); |
---|
724 | |
---|
725 | if(ret1 != NULL && count > 0) |
---|
726 | { |
---|
727 | int max = count; |
---|
728 | for(j = 0; j < max; j++) |
---|
729 | { |
---|
730 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
731 | name = oregex(".*><a href=.*\">(.*)</a></TD>.*", ret1[j].part); |
---|
732 | |
---|
733 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
734 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
735 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
736 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
737 | else |
---|
738 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
739 | |
---|
740 | season = oregex(".*Season:(.*),.*", name); |
---|
741 | season = strstrip(season); |
---|
742 | episode = oregex(".*Episode:(.*[0-9]{1,3}).*", name); |
---|
743 | episode = strstrip(episode); |
---|
744 | debug(99, "(S%s/E%s) input: %s%s",season, episode, name, lang); |
---|
745 | |
---|
746 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
747 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
748 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
749 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
750 | ostrcatbig(&line, _("Episode"), &maxlen, &bigpos); |
---|
751 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
752 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
753 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
754 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
755 | ostrcatbig(&line, "#http://www.movie2k.to/", &maxlen, &bigpos); |
---|
756 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
757 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
758 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
759 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
760 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
761 | ostrcatbig(&line, ".jpg#s", &maxlen, &bigpos); |
---|
762 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
763 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
764 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
765 | ostrcatbig(&line, ".jpg#movie2k - ", &maxlen, &bigpos); |
---|
766 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
767 | ostrcatbig(&line, "#34\n", &maxlen, &bigpos); |
---|
768 | |
---|
769 | free(name), name = NULL; |
---|
770 | free(lang), lang = NULL; |
---|
771 | free(season), season = NULL; |
---|
772 | free(episode), episode = NULL; |
---|
773 | } |
---|
774 | } |
---|
775 | free(ret1), ret1 = NULL; |
---|
776 | } |
---|
777 | free(from), from = NULL; |
---|
778 | free(folgen), folgen = NULL; |
---|
779 | free(folgentmp), folgentmp = NULL; |
---|
780 | } |
---|
781 | free(tmpstr), tmpstr = NULL; |
---|
782 | |
---|
783 | if(line != NULL) |
---|
784 | { |
---|
785 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
786 | tmpstr = ostrcat("/tmp/tithek/movie2k.series.listed.", oitoa(time(NULL)), 0, 1); |
---|
787 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
788 | |
---|
789 | writesys(tmpstr, line, 0); |
---|
790 | |
---|
791 | titheklog(debuglevel, "/tmp/movie2k8_line", NULL, NULL, NULL, line); |
---|
792 | free(line); line = NULL; |
---|
793 | |
---|
794 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
795 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
796 | ret = 0; |
---|
797 | } |
---|
798 | return ret; |
---|
799 | } |
---|
800 | |
---|
801 | |
---|
802 | #endif |
---|