1 | #ifndef MOVIE4K_H |
---|
2 | #define MOVIE4K_H |
---|
3 | |
---|
4 | // flag 1 = putlocker/sockshare |
---|
5 | // flag 2 = filenuke |
---|
6 | |
---|
7 | char* movie4k(char* link) |
---|
8 | { |
---|
9 | debug(99, "link: %s", link); |
---|
10 | char* tmpstr = NULL, *url = NULL, *streamurl = NULL, *tmppath = NULL, *tmphost = NULL, *pos = NULL; |
---|
11 | |
---|
12 | if(link == NULL || ostrncmp("http://", link, 7)) return NULL; |
---|
13 | |
---|
14 | tmphost = string_replace("http://", "", (char*)link, 0); |
---|
15 | |
---|
16 | if(tmphost != NULL) |
---|
17 | pos = strchr(tmphost, '/'); |
---|
18 | if(pos != NULL) |
---|
19 | { |
---|
20 | pos[0] = '\0'; |
---|
21 | tmppath = pos + 1; |
---|
22 | } |
---|
23 | |
---|
24 | tmpstr = gethttp(tmphost, tmppath, 80, NULL, NULL, 5000, NULL, 0); |
---|
25 | |
---|
26 | url = string_resub("<a target=\"_blank\" href=\"", "\"><", tmpstr, 0); |
---|
27 | |
---|
28 | if(ostrstr(url, "http://") == NULL) |
---|
29 | { |
---|
30 | free(url), url = NULL; |
---|
31 | url = string_resub("<iframe src=", "\" width", tmpstr, 0); |
---|
32 | } |
---|
33 | |
---|
34 | if(ostrstr(url, "http://www.facebook.com") != NULL) |
---|
35 | { |
---|
36 | free(url), url = NULL; |
---|
37 | url = oregex(".*<iframe width=.*(http://.*)&width.*", tmpstr); |
---|
38 | } |
---|
39 | |
---|
40 | url = string_replace_all("/embed/", "/file/", url, 1); |
---|
41 | url = string_replace_all("\"", "", url, 1); |
---|
42 | |
---|
43 | streamurl = hoster(url); |
---|
44 | free(url), url = NULL; |
---|
45 | free(tmpstr), tmpstr = NULL; |
---|
46 | free(tmphost), tmphost = NULL; |
---|
47 | |
---|
48 | return streamurl; |
---|
49 | } |
---|
50 | |
---|
51 | int movie4k_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
52 | { |
---|
53 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
54 | int incount = 0; |
---|
55 | char* tmpstr = NULL; |
---|
56 | char* from = NULL; |
---|
57 | char* folgen = NULL; |
---|
58 | char* folgentmp = NULL; |
---|
59 | char* name = NULL; |
---|
60 | char* lang = NULL; |
---|
61 | char* season = NULL; |
---|
62 | char* episode = NULL; |
---|
63 | char* line = NULL; |
---|
64 | char* menu = NULL; |
---|
65 | char* str = NULL; |
---|
66 | char* pic = NULL; |
---|
67 | char* type = NULL; |
---|
68 | |
---|
69 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
70 | |
---|
71 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
72 | return ret; |
---|
73 | |
---|
74 | char* search = NULL; |
---|
75 | if(flag == 0) |
---|
76 | { |
---|
77 | if(searchstr == NULL) |
---|
78 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
79 | else |
---|
80 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
81 | } |
---|
82 | else |
---|
83 | search = ostrcat(link, NULL, 0, 0); |
---|
84 | |
---|
85 | if(search != NULL) |
---|
86 | { |
---|
87 | drawscreen(load, 0, 0); |
---|
88 | search = strstrip(search); |
---|
89 | search = stringreplacechar(search, ' ', '+'); |
---|
90 | debug(99, "search: %s", search); |
---|
91 | |
---|
92 | char* send = NULL; |
---|
93 | send = ostrcat(send, "GET /searchAutoCompleteNew.php?search=the HTTP/1.1\r\n", 1, 0); |
---|
94 | send = ostrcat(send, "Accept-Encoding: identity\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n", 1, 0); |
---|
95 | send = ostrcat(send, "Host: www.movie4k.to\r\nAccept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4\r\n", 1, 0); |
---|
96 | 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); |
---|
97 | debug(99, "send: %s", send); |
---|
98 | |
---|
99 | tmpstr = gethttpreal("www.movie4k.to", "/searchAutoCompleteNew.php?search=the", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
100 | free(send); send = NULL; |
---|
101 | debug(99, "tmpstr: %s", tmpstr); |
---|
102 | titheklog(debuglevel, "/tmp/movie4k_search", NULL, NULL, NULL, tmpstr); |
---|
103 | |
---|
104 | char* key = string_resub("securekey=", "&search", tmpstr, 0); |
---|
105 | debug(99, "key: %s", key); |
---|
106 | |
---|
107 | send = ostrcat(send, "GET /movies.php?list=search&securekey=", 1, 0); |
---|
108 | send = ostrcat(send, key, 1, 0); |
---|
109 | send = ostrcat(send, "&search=", 1, 0); |
---|
110 | send = ostrcat(send, search, 1, 0); |
---|
111 | send = ostrcat(send, " HTTP/1.1\r\nAccept-Encoding: identity\r\n", 1, 0); |
---|
112 | send = ostrcat(send, "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4\r\n", 1, 0); |
---|
113 | send = ostrcat(send, "Host: www.movie4k.to\r\n", 1, 0); |
---|
114 | 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); |
---|
115 | send = ostrcat(send, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n", 1, 0); |
---|
116 | send = ostrcat(send, "Connection: close\r\nCookie: xxx2=ok;\r\n\r\n", 1, 0); |
---|
117 | debug(99, "send: %s", send); |
---|
118 | |
---|
119 | free(tmpstr), tmpstr = NULL; |
---|
120 | tmpstr = gethttpreal("movie4k.to", "/", 80, NULL, NULL, NULL, 0, send, NULL, 5000, 1); |
---|
121 | |
---|
122 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
123 | folgen = string_replace_all("1000\r\n", "", folgen, 1); |
---|
124 | folgen = string_replace_all("2000\r\n", "", folgen, 1); |
---|
125 | stringreplacechar(folgen, '\n', ' '); |
---|
126 | stringreplacechar(folgen, '\t', ' '); |
---|
127 | string_strip_whitechars(folgen); |
---|
128 | folgen = string_replace_all("</TD> </TR> <TR id=\"coverPreview", "</TD> </TR>\n<TR id=\"cover1Preview", folgen, 1); |
---|
129 | if(folgen != NULL) |
---|
130 | { |
---|
131 | int count = 0; |
---|
132 | int j; |
---|
133 | struct splitstr* ret1 = NULL; |
---|
134 | ret1 = strsplit(folgen, "\n", &count); |
---|
135 | |
---|
136 | if(ret1 != NULL && count > 0) |
---|
137 | { |
---|
138 | int max = count; |
---|
139 | for(j = 0; j < max; j++) |
---|
140 | { |
---|
141 | int rcret = waitrc(NULL, 10, 0); |
---|
142 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
143 | |
---|
144 | incount++; |
---|
145 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
146 | name = string_resub(".html\">", "</a>", ret1[j].part, 0); |
---|
147 | char* id = string_resub("online-film-", ".html", link, 0); |
---|
148 | if(id == NULL) |
---|
149 | id = string_resub("watch-movie-", ".html", link, 0); |
---|
150 | if(id == NULL) |
---|
151 | id = oregex(".*tvshows-(.*[0-9]{1,10})-.*", link); |
---|
152 | |
---|
153 | |
---|
154 | from = ostrcat("#coverPreview", id, 0, 0); |
---|
155 | pic = string_resub(from, from, tmpstr, 0); |
---|
156 | pic = string_resub("<img src='", "' alt=", pic, 1); |
---|
157 | if(pic == NULL) |
---|
158 | pic = ostrcat("http://atemio.dyndns.tv/mediathek/menu/default.jpg", NULL, 0, 0); |
---|
159 | |
---|
160 | if(ostrstr(link, "online-serie-") != NULL) |
---|
161 | type = ostrcat("40", NULL, 0, 0); |
---|
162 | else |
---|
163 | type = ostrcat("34", NULL, 0, 0); |
---|
164 | |
---|
165 | |
---|
166 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
167 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
168 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
169 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
170 | else |
---|
171 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
172 | |
---|
173 | ostrcatbig(&line, name, &maxlen, &bigpos); |
---|
174 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
175 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
176 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
177 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
178 | ostrcatbig(&line, pic, &maxlen, &bigpos); |
---|
179 | ostrcatbig(&line, "#movie4k_search_", &maxlen, &bigpos); |
---|
180 | char* cincount = oitoa(incount + time(NULL)); |
---|
181 | ostrcatbig(&line, cincount, &maxlen, &bigpos); |
---|
182 | free(cincount); cincount = NULL; |
---|
183 | ostrcatbig(&line, ".jpg#Movie4k - Search#", &maxlen, &bigpos); |
---|
184 | ostrcatbig(&line, type, &maxlen, &bigpos); |
---|
185 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
186 | |
---|
187 | free(str), str = NULL; |
---|
188 | |
---|
189 | free(name), name = NULL; |
---|
190 | free(lang), lang = NULL; |
---|
191 | free(season), season = NULL; |
---|
192 | free(episode), episode = NULL; |
---|
193 | free(from), from = NULL; |
---|
194 | free(pic), pic = NULL; |
---|
195 | free(type), type = NULL; |
---|
196 | if(j == 60) |
---|
197 | break; |
---|
198 | } |
---|
199 | } |
---|
200 | free(ret1), ret1 = NULL; |
---|
201 | } |
---|
202 | free(from), from = NULL; |
---|
203 | free(folgen), folgen = NULL; |
---|
204 | free(folgentmp), folgentmp = NULL; |
---|
205 | |
---|
206 | if(line != NULL) |
---|
207 | { |
---|
208 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
209 | menu = ostrcat("/tmp/tithek/movie4k.search.", oitoa(time(NULL)), 0, 1); |
---|
210 | menu = ostrcat(menu, ".list", 1, 0); |
---|
211 | writesys(menu, line, 0); |
---|
212 | free(line); line = NULL; |
---|
213 | |
---|
214 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
215 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
216 | ret = 0; |
---|
217 | free(menu); menu = NULL; |
---|
218 | } |
---|
219 | |
---|
220 | free(tmpstr), tmpstr = NULL; |
---|
221 | } |
---|
222 | free(search), search = NULL; |
---|
223 | return ret; |
---|
224 | } |
---|
225 | |
---|
226 | int movie4k_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag) |
---|
227 | { |
---|
228 | char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL; |
---|
229 | int ret = 1, count = 0, i = 0; |
---|
230 | |
---|
231 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
232 | return ret; |
---|
233 | |
---|
234 | if(searchstr == NULL) |
---|
235 | search = textinputhist(_("Search"), " ", "searchhist"); |
---|
236 | else |
---|
237 | search = textinputhist(_("Search"), searchstr, "searchhist"); |
---|
238 | |
---|
239 | if(search != NULL) |
---|
240 | { |
---|
241 | drawscreen(load, 0, 0); |
---|
242 | |
---|
243 | strstrip(search); |
---|
244 | string_tolower(search); |
---|
245 | |
---|
246 | tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/movie4k/streams/movie4k.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0); |
---|
247 | |
---|
248 | struct splitstr* ret1 = NULL; |
---|
249 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
250 | |
---|
251 | if(ret1 != NULL) |
---|
252 | { |
---|
253 | int max = count; |
---|
254 | for(i = 0; i < max; i++) |
---|
255 | { |
---|
256 | |
---|
257 | tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0); |
---|
258 | tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0'); |
---|
259 | string_tolower(tmpstr1); |
---|
260 | |
---|
261 | if(ostrstr(tmpstr1, search) != NULL) |
---|
262 | { |
---|
263 | printf("found: %s\n", ret1[i].part); |
---|
264 | int rcret = waitrc(NULL, 10, 0); |
---|
265 | if(rcret == getrcconfigint("rcexit", NULL)) break; |
---|
266 | |
---|
267 | line = ostrcat(line, ret1[i].part, 1, 0); |
---|
268 | line = ostrcat(line, "\n", 0, 0); |
---|
269 | } |
---|
270 | free(tmpstr1), tmpstr1 = NULL; |
---|
271 | } |
---|
272 | free(ret1), ret1 = NULL; |
---|
273 | |
---|
274 | if(line != NULL) |
---|
275 | { |
---|
276 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
277 | menu = ostrcat("/tmp/tithek/movie4k.search.", oitoa(time(NULL)), 0, 1); |
---|
278 | menu = ostrcat(menu, ".list", 1, 0); |
---|
279 | writesys(menu, line, 0); |
---|
280 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
281 | createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
282 | ret = 0; |
---|
283 | } |
---|
284 | } |
---|
285 | free(tmpstr), tmpstr = NULL; |
---|
286 | } |
---|
287 | free(search), search = NULL; |
---|
288 | return ret; |
---|
289 | } |
---|
290 | |
---|
291 | int movie4k_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
292 | { |
---|
293 | debug(99, "link: %s", link); |
---|
294 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
295 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
296 | char* extra = NULL, *pos3 = NULL, *ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *line = NULL, *url = NULL, *url2 = NULL; |
---|
297 | char* url3 = NULL, *url4 = NULL, *pathnew = NULL, *id = NULL, *logfile = NULL, *tmphname = NULL, *hnamein = NULL, *nolinks = NULL; |
---|
298 | char* tmpid = NULL, *pichname = NULL; |
---|
299 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
300 | return ret; |
---|
301 | |
---|
302 | drawscreen(load, 0, 0); |
---|
303 | |
---|
304 | ip = string_replace("http://", "", (char*)link, 0); |
---|
305 | |
---|
306 | if(ip != NULL) |
---|
307 | pos = strchr(ip, '/'); |
---|
308 | if(pos != NULL) |
---|
309 | { |
---|
310 | pos[0] = '\0'; |
---|
311 | path = pos + 1; |
---|
312 | } |
---|
313 | |
---|
314 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
315 | titheklog(debuglevel, "/tmp/movie4k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
316 | int a = 0; |
---|
317 | |
---|
318 | if(tmpstr != NULL) |
---|
319 | { |
---|
320 | int countj = 0; |
---|
321 | char* cpart = ostrstr(tmpstr, "&part="); |
---|
322 | if(cpart != NULL) |
---|
323 | { |
---|
324 | if(ostrstr(cpart, "&part=4") != NULL) |
---|
325 | countj = 4; |
---|
326 | else if(ostrstr(cpart, "&part=3") != NULL) |
---|
327 | countj = 3; |
---|
328 | else if(ostrstr(cpart, "&part=2") != NULL) |
---|
329 | countj = 2; |
---|
330 | else if(ostrstr(cpart, "&part=1") != NULL) |
---|
331 | countj = 1; |
---|
332 | |
---|
333 | tmpid = string_resub("movie.php?id=", "&part=", tmpstr, 0); |
---|
334 | } |
---|
335 | |
---|
336 | if(ostrstr(tmpstr, "links\[") == NULL) |
---|
337 | { |
---|
338 | hnamein = string_resub("width=\"16\"> ", "</a></td><td align=", tmpstr, 0); |
---|
339 | nolinks = ostrcat(tmpstr, NULL, 0, 0); |
---|
340 | } |
---|
341 | else |
---|
342 | { |
---|
343 | unlink("/tmp/movie4k.list"); |
---|
344 | writesys("/tmp/movie4k.list", tmpstr, 1); |
---|
345 | tmpstr = command("cat /tmp/movie4k.list | grep ^links"); |
---|
346 | } |
---|
347 | |
---|
348 | int count = 0; |
---|
349 | int incount = 0; |
---|
350 | int i; |
---|
351 | struct splitstr* ret1 = NULL; |
---|
352 | ret1 = strsplit(tmpstr, "\n", &count); |
---|
353 | |
---|
354 | if(ret1 != NULL && count > 0) |
---|
355 | { |
---|
356 | int max = count; |
---|
357 | for(i = 0; i < max; i++) |
---|
358 | { |
---|
359 | if((!ostrncmp("links", ret1[i].part, 5) && nolinks == NULL) || nolinks != NULL) |
---|
360 | { |
---|
361 | if(nolinks == NULL) |
---|
362 | { |
---|
363 | a++; |
---|
364 | // ret1[i].part = string_replace_all("</a> </td>", "</a></td>", ret1[i].part, 1); |
---|
365 | |
---|
366 | pathnew = string_resub("<a href=\\\"", "\\", ret1[i].part, 0); |
---|
367 | tmphname = string_resub("title=\\\"", " ", ret1[i].part, 0); |
---|
368 | if(tmphname == NULL) |
---|
369 | tmphname = string_resub(" ", "</a", ret1[i].part, 0); |
---|
370 | |
---|
371 | pos3 = ostrstr(ret1[i].part, "Movie quality"); |
---|
372 | extra = getxmlentry(pos3, "quality "); |
---|
373 | |
---|
374 | id = oregex(".*-online-film-(.*[0-9]{1,10}).html.*", pathnew); |
---|
375 | if(id == NULL) |
---|
376 | id = string_resub("watch-movie-", ".html", pathnew, 0); |
---|
377 | if(id == NULL) |
---|
378 | id = oregex(".*tvshows-(.*[0-9]{1,10})-.*", pathnew); |
---|
379 | if(id == NULL) |
---|
380 | id = ostrcat(tmpid, NULL, 0, 0); |
---|
381 | |
---|
382 | // debug(99, "(%d/%d/%d) pathnew: %s hname: %s id: %s",a ,i ,max ,pathnew , tmphname, id); |
---|
383 | |
---|
384 | if(ostrstr(pathnew, "tvshows-") != NULL) |
---|
385 | { |
---|
386 | pathnew = string_replace("tvshows-", "", pathnew, 1); |
---|
387 | pathnew = string_replace(id, "", pathnew, 1); |
---|
388 | pathnew = string_replace("-", "", pathnew, 1); |
---|
389 | pathnew = string_replace(".html", "", pathnew, 1); |
---|
390 | pathnew = ostrcat(pathnew, "-online-serie-", 1, 0); |
---|
391 | pathnew = ostrcat(pathnew, id, 1, 0); |
---|
392 | pathnew = ostrcat(pathnew, ".html", 1, 0); |
---|
393 | debug(99, "(%d/%d/%d) pathnew: %s hname: %s id: %s",a ,i ,max ,pathnew, tmphname, id); |
---|
394 | } |
---|
395 | |
---|
396 | |
---|
397 | // logfile = ostrcat("/tmp/movie4k4_pathnew1", id, 0, 0); |
---|
398 | // logfile = ostrcat(logfile, "_", 1, 0); |
---|
399 | // titheklog(debuglevel, logfile, tmphname, NULL, NULL, pathnew); |
---|
400 | // free(logfile), logfile= NULL; |
---|
401 | |
---|
402 | url = ostrcat(pathnew, NULL, 0, 0); |
---|
403 | } |
---|
404 | else |
---|
405 | { |
---|
406 | id = oregex(".*-online-film-(.*[0-9]{1,10}).html.*", path); |
---|
407 | if(id == NULL) |
---|
408 | id = string_resub("watch-movie-", ".html", path, 0); |
---|
409 | if(id == NULL) |
---|
410 | id = oregex(".*tvshows-(.*[0-9]{1,10})-.*", path); |
---|
411 | if(id == NULL) |
---|
412 | id = ostrcat(tmpid, NULL, 0, 0); |
---|
413 | |
---|
414 | tmphname = ostrcat(hnamein, NULL, 0, 0); |
---|
415 | |
---|
416 | pos3 = ostrstr(ret1[i].part, "Movie quality"); |
---|
417 | extra = getxmlentry(pos3, "quality "); |
---|
418 | } |
---|
419 | |
---|
420 | pichname = ostrcat(tmphname, NULL, 0, 0); |
---|
421 | string_tolower(pichname); |
---|
422 | pichname = stringreplacecharonce(pichname, '.', '\0'); |
---|
423 | |
---|
424 | if(id != NULL) |
---|
425 | { |
---|
426 | if(countj >= 1) |
---|
427 | { |
---|
428 | free(url), url = NULL; |
---|
429 | free(pathnew), pathnew = NULL; |
---|
430 | pathnew = ostrcat("movie.php?id=", id, 0, 0); |
---|
431 | pathnew = ostrcat(pathnew, "&part=1", 1, 0); |
---|
432 | url = ostrcat(pathnew, NULL, 0, 0); |
---|
433 | } |
---|
434 | if(countj >= 2) |
---|
435 | { |
---|
436 | free(pathnew), pathnew = NULL; |
---|
437 | pathnew = ostrcat("movie.php?id=", id, 0, 0); |
---|
438 | pathnew = ostrcat(pathnew, "&part=2", 1, 0); |
---|
439 | url2 = ostrcat(pathnew, NULL, 0, 0); |
---|
440 | } |
---|
441 | if(countj >= 3) |
---|
442 | { |
---|
443 | free(pathnew), pathnew = NULL; |
---|
444 | pathnew = ostrcat("movie.php?id=", id, 0, 0); |
---|
445 | pathnew = ostrcat(pathnew, "&part=3", 1, 0); |
---|
446 | url3 = ostrcat(pathnew, NULL, 0, 0); |
---|
447 | |
---|
448 | } |
---|
449 | if(countj >= 4) |
---|
450 | { |
---|
451 | free(pathnew), pathnew = NULL; |
---|
452 | pathnew = ostrcat("movie.php?id=", id, 0, 0); |
---|
453 | pathnew = ostrcat(pathnew, "&part=4", 1, 0); |
---|
454 | url4 = ostrcat(pathnew, NULL, 0, 0); |
---|
455 | } |
---|
456 | } |
---|
457 | |
---|
458 | int type = 41; |
---|
459 | |
---|
460 | if(ostrcmp(url, url2) != 0) |
---|
461 | { |
---|
462 | debug(99, "(%d/%d/%d) %s (Part1) extra: %s url: %s",a ,i ,max ,tmphname, extra, url); |
---|
463 | } |
---|
464 | else |
---|
465 | { |
---|
466 | debug(99, "(%d/%d/%d) %s extra: %s url: %s",a ,i ,max ,tmphname, extra, url); |
---|
467 | } |
---|
468 | incount += 1; |
---|
469 | ostrcatbig(&line, tmphname, &maxlen, &bigpos); |
---|
470 | if(url2 != NULL && ostrcmp(url, url2) != 0) |
---|
471 | ostrcatbig(&line, " (Part1)", &maxlen, &bigpos); |
---|
472 | if(extra != NULL) |
---|
473 | { |
---|
474 | ostrcatbig(&line, " (", &maxlen, &bigpos); |
---|
475 | ostrcatbig(&line, extra, &maxlen, &bigpos); |
---|
476 | ostrcatbig(&line, ")", &maxlen, &bigpos); |
---|
477 | } |
---|
478 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
479 | ostrcatbig(&line, url, &maxlen, &bigpos); |
---|
480 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/", &maxlen, &bigpos); |
---|
481 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
482 | ostrcatbig(&line, ".jpg#movie4k_", &maxlen, &bigpos); |
---|
483 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
484 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
485 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
486 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
487 | char* ctype = oitoa(type); |
---|
488 | ostrcatbig(&line, ctype, &maxlen, &bigpos); |
---|
489 | free(ctype); ctype = NULL; |
---|
490 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
491 | |
---|
492 | if(url2 != NULL && ostrcmp(url, url2) != 0) |
---|
493 | { |
---|
494 | int type = 41; |
---|
495 | |
---|
496 | debug(99, "-------------------------------"); |
---|
497 | debug(99, "(%d/%d/%d) %s (Part2) extra: %s url: %s",a ,i ,max ,tmphname, extra, url2); |
---|
498 | |
---|
499 | incount += 1; |
---|
500 | ostrcatbig(&line, tmphname, &maxlen, &bigpos); |
---|
501 | ostrcatbig(&line, " (Part2)", &maxlen, &bigpos); |
---|
502 | if(extra != NULL) |
---|
503 | { |
---|
504 | ostrcatbig(&line, " (", &maxlen, &bigpos); |
---|
505 | ostrcatbig(&line, extra, &maxlen, &bigpos); |
---|
506 | ostrcatbig(&line, ")", &maxlen, &bigpos); |
---|
507 | } |
---|
508 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
509 | ostrcatbig(&line, url2, &maxlen, &bigpos); |
---|
510 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/", &maxlen, &bigpos); |
---|
511 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
512 | ostrcatbig(&line, ".jpg#kinox_", &maxlen, &bigpos); |
---|
513 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
514 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
515 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
516 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
517 | char* ctype = oitoa(type); |
---|
518 | ostrcatbig(&line, ctype, &maxlen, &bigpos); |
---|
519 | free(ctype); ctype = NULL; |
---|
520 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
521 | } |
---|
522 | if(url3 != NULL && ostrcmp(url, url3) != 0) |
---|
523 | { |
---|
524 | int type = 41; |
---|
525 | |
---|
526 | debug(99, "-------------------------------"); |
---|
527 | debug(99, "(%d/%d/%d) %s (Part3) extra: %s url: %s",a ,i ,max ,tmphname, extra, url3); |
---|
528 | |
---|
529 | incount += 1; |
---|
530 | ostrcatbig(&line, tmphname, &maxlen, &bigpos); |
---|
531 | ostrcatbig(&line, " (Part3)", &maxlen, &bigpos); |
---|
532 | if(extra != NULL) |
---|
533 | { |
---|
534 | ostrcatbig(&line, " (", &maxlen, &bigpos); |
---|
535 | ostrcatbig(&line, extra, &maxlen, &bigpos); |
---|
536 | ostrcatbig(&line, ")", &maxlen, &bigpos); |
---|
537 | } |
---|
538 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
539 | ostrcatbig(&line, url3, &maxlen, &bigpos); |
---|
540 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/", &maxlen, &bigpos); |
---|
541 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
542 | ostrcatbig(&line, ".jpg#movie4k_", &maxlen, &bigpos); |
---|
543 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
544 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
545 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
546 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
547 | char* ctype = oitoa(type); |
---|
548 | ostrcatbig(&line, ctype, &maxlen, &bigpos); |
---|
549 | free(ctype); ctype = NULL; |
---|
550 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
551 | } |
---|
552 | if(url4 != NULL && ostrcmp(url, url4) != 0) |
---|
553 | { |
---|
554 | int type = 41; |
---|
555 | |
---|
556 | debug(99, "-------------------------------"); |
---|
557 | debug(99, "(%d/%d/%d) %s (Part4) extra: %s url: %s",a ,i ,max ,tmphname, extra, url4); |
---|
558 | |
---|
559 | incount += 1; |
---|
560 | ostrcatbig(&line, tmphname, &maxlen, &bigpos); |
---|
561 | ostrcatbig(&line, " (Part4)", &maxlen, &bigpos); |
---|
562 | if(extra != NULL) |
---|
563 | { |
---|
564 | ostrcatbig(&line, " (", &maxlen, &bigpos); |
---|
565 | ostrcatbig(&line, extra, &maxlen, &bigpos); |
---|
566 | ostrcatbig(&line, ")", &maxlen, &bigpos); |
---|
567 | } |
---|
568 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
569 | ostrcatbig(&line, url4, &maxlen, &bigpos); |
---|
570 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/", &maxlen, &bigpos); |
---|
571 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
572 | ostrcatbig(&line, ".jpg#movie4k_", &maxlen, &bigpos); |
---|
573 | ostrcatbig(&line, pichname, &maxlen, &bigpos); |
---|
574 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
575 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
576 | ostrcatbig(&line, "#", &maxlen, &bigpos); |
---|
577 | char* ctype = oitoa(type); |
---|
578 | ostrcatbig(&line, ctype, &maxlen, &bigpos); |
---|
579 | free(ctype); ctype = NULL; |
---|
580 | ostrcatbig(&line, "\n", &maxlen, &bigpos); |
---|
581 | } |
---|
582 | free(tmphname), tmphname = NULL; |
---|
583 | free(extra), extra = NULL; |
---|
584 | free(pichname), pichname = NULL; |
---|
585 | |
---|
586 | if(nolinks != NULL) |
---|
587 | { |
---|
588 | printf("break\n"); |
---|
589 | |
---|
590 | free(url); url = NULL; |
---|
591 | free(url2); url2 = NULL; |
---|
592 | free(url3); url3 = NULL; |
---|
593 | free(url4); url4 = NULL; |
---|
594 | free(pathnew); pathnew = NULL; |
---|
595 | free(logfile); logfile = NULL; |
---|
596 | free(id); id = NULL; |
---|
597 | break; |
---|
598 | } |
---|
599 | } |
---|
600 | |
---|
601 | free(url); url = NULL; |
---|
602 | free(url2); url2 = NULL; |
---|
603 | free(url3); url3 = NULL; |
---|
604 | free(url4); url4 = NULL; |
---|
605 | free(pathnew); pathnew = NULL; |
---|
606 | free(logfile); logfile = NULL; |
---|
607 | free(id); id = NULL; |
---|
608 | } |
---|
609 | } |
---|
610 | free(ret1); ret1 = NULL; |
---|
611 | } |
---|
612 | |
---|
613 | free(tmpid); tmpid = NULL; |
---|
614 | free(tmpstr); tmpstr = NULL; |
---|
615 | |
---|
616 | if(line != NULL) |
---|
617 | { |
---|
618 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
619 | tmpstr = ostrcat("/tmp/tithek/movie4k.hoster.", oitoa(time(NULL)), 0, 1); |
---|
620 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
621 | |
---|
622 | writesys(tmpstr, line, 0); |
---|
623 | free(line); line = NULL; |
---|
624 | |
---|
625 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
626 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
627 | ret = 0; |
---|
628 | } |
---|
629 | |
---|
630 | return ret; |
---|
631 | } |
---|
632 | |
---|
633 | int movie4k_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
634 | { |
---|
635 | debug(99, "link: %s", link); |
---|
636 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
637 | int ret = 1, series = 0, maxlen = 0, bigpos = 0; |
---|
638 | char* ip = NULL, *pos = NULL, *id = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL, *episode = NULL; |
---|
639 | char* from = NULL; |
---|
640 | char* folgen = NULL; |
---|
641 | char* folgentmp = NULL; |
---|
642 | |
---|
643 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
644 | return ret; |
---|
645 | |
---|
646 | drawscreen(load, 0, 0); |
---|
647 | |
---|
648 | ip = string_replace("http://", "", (char*)link, 0); |
---|
649 | |
---|
650 | if(ip != NULL) |
---|
651 | pos = strchr(ip, '/'); |
---|
652 | if(pos != NULL) |
---|
653 | { |
---|
654 | pos[0] = '\0'; |
---|
655 | path = pos + 1; |
---|
656 | } |
---|
657 | /* |
---|
658 | if(!ostrncmp("tvshows-", path, 8)) |
---|
659 | { |
---|
660 | debug(99, "path: %s",path); |
---|
661 | tpath = ostrcat(path, NULL, 0, 0); |
---|
662 | id = oregex(".*tvshows-(.*[0-9]{1,10})-.*", path); |
---|
663 | tpath = string_replace("tvshows-season-", "", tpath, 1); |
---|
664 | tpath = string_replace(".html", "", tpath, 1); |
---|
665 | tpath = ostrcat(tpath, "-online-serie-", 1, 0); |
---|
666 | tpath = ostrcat(tpath, id, 1, 0); |
---|
667 | tpath = ostrcat(tpath, ".html", 1, 0); |
---|
668 | debug(99, "convertpath: %s",tpath); |
---|
669 | } |
---|
670 | else |
---|
671 | */ |
---|
672 | tpath = ostrcat(path, NULL, 0, 0); |
---|
673 | |
---|
674 | tmpstr = gethttp(ip, tpath, 80, NULL, NULL, 10000, NULL, 0); |
---|
675 | free(tpath), tpath = NULL; |
---|
676 | titheklog(debuglevel, "/tmp/movie4k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
677 | |
---|
678 | if(tmpstr != NULL) |
---|
679 | { |
---|
680 | if(ostrstr(tmpstr, "episodeform") != NULL) |
---|
681 | { |
---|
682 | int i; |
---|
683 | for(i = 1; i < 30; i++) |
---|
684 | { |
---|
685 | from = ostrcat(from, "<FORM name=\"episodeform", 1, 0); |
---|
686 | from = ostrcat(from, oitoa(i), 1, 1); |
---|
687 | from = ostrcat(from, "\">", 1, 0); |
---|
688 | folgen = string_resub(from, "</FORM>", tmpstr, 0); |
---|
689 | folgen = string_resub("<OPTION></OPTION>", "</SELECT>", folgen, 1); |
---|
690 | folgen = string_replace_all("><", ">\n<", folgen, 1); |
---|
691 | folgentmp = ostrcat(folgen, NULL, 0, 0); |
---|
692 | |
---|
693 | if(folgen != NULL) |
---|
694 | { |
---|
695 | int count = 0; |
---|
696 | int incount = 0; |
---|
697 | int j; |
---|
698 | struct splitstr* ret1 = NULL; |
---|
699 | ret1 = strsplit(folgen, "\n", &count); |
---|
700 | |
---|
701 | if(ret1 != NULL && count > 0) |
---|
702 | { |
---|
703 | int max = count + 1; |
---|
704 | for(j = 1; j < max; j++) |
---|
705 | { |
---|
706 | link = string_resub("<OPTION value=\"", "\"", ret1[j-1].part, 0); |
---|
707 | id = oregex(".*tvshows-(.*[0-9]{1,10})-.*", link); |
---|
708 | episode = oregex(".*>Episode (.*[0-9]{1,10})</OPTION>.*", ret1[j-1].part); |
---|
709 | |
---|
710 | debug(99, "(S%d/E%s)(%d) link: %s id: %s", i, episode, j, link, id); |
---|
711 | link = string_replace("tvshows-", "", link, 1); |
---|
712 | link = string_replace(id, "", link, 1); |
---|
713 | link = string_replace("-", "", link, 1); |
---|
714 | link = string_replace(".html", "", link, 1); |
---|
715 | link = ostrcat(link, "-online-serie-", 1, 0); |
---|
716 | link = ostrcat(link, id, 1, 0); |
---|
717 | link = ostrcat(link, ".html", 1, 0); |
---|
718 | debug(99, "(S%d/E%d) convertlink: %s id: %s", i, j, link, id); |
---|
719 | |
---|
720 | incount += 1; |
---|
721 | |
---|
722 | char* ci = oitoa(i); |
---|
723 | // char* cj = oitoa(j); |
---|
724 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
725 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
726 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
727 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
728 | ostrcatbig(&line, _("Episode"), &maxlen, &bigpos); |
---|
729 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
730 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
731 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
732 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
733 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
734 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
735 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
736 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
737 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
738 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
739 | ostrcatbig(&line, ".jpg#movie4k_search_", &maxlen, &bigpos); |
---|
740 | ostrcatbig(&line, ci, &maxlen, &bigpos); |
---|
741 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
742 | // ostrcatbig(&line, cj, &maxlen, &bigpos); |
---|
743 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
744 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
745 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
746 | ostrcatbig(&line, "#34\n", &maxlen, &bigpos); |
---|
747 | |
---|
748 | free(id); id = NULL; |
---|
749 | free(episode); episode = NULL; |
---|
750 | free(ci); ci = NULL; |
---|
751 | // free(cj); cj = NULL; |
---|
752 | } |
---|
753 | } |
---|
754 | free(ret1), ret1 = NULL; |
---|
755 | } |
---|
756 | free(from), from = NULL; |
---|
757 | free(folgen), folgen = NULL; |
---|
758 | free(folgentmp), folgentmp = NULL; |
---|
759 | } |
---|
760 | } |
---|
761 | } |
---|
762 | free(tmpstr), tmpstr = NULL; |
---|
763 | |
---|
764 | if(line != NULL) |
---|
765 | { |
---|
766 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
767 | if(series == 0) |
---|
768 | { |
---|
769 | tmpstr = ostrcat("/tmp/tithek/movie4k.hoster.", oitoa(time(NULL)), 0, 1); |
---|
770 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
771 | } |
---|
772 | else |
---|
773 | { |
---|
774 | tmpstr = ostrcat("/tmp/tithek/movie4k.hoster.ser.", oitoa(time(NULL)), 0, 1); |
---|
775 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
776 | } |
---|
777 | writesys(tmpstr, line, 0); |
---|
778 | |
---|
779 | titheklog(debuglevel, "/tmp/movie4k8_line", NULL, NULL, NULL, line); |
---|
780 | free(line); line = NULL; |
---|
781 | |
---|
782 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
783 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
784 | ret = 0; |
---|
785 | } |
---|
786 | return ret; |
---|
787 | } |
---|
788 | |
---|
789 | int movie4k_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
790 | { |
---|
791 | debug(99, "link: %s", link); |
---|
792 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
793 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
794 | char* ip = NULL, *pos = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL; |
---|
795 | char* from = NULL; |
---|
796 | char* folgen = NULL; |
---|
797 | char* folgentmp = NULL; |
---|
798 | char* name = NULL; |
---|
799 | char* lang = NULL; |
---|
800 | char* season = NULL; |
---|
801 | |
---|
802 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
803 | return ret; |
---|
804 | |
---|
805 | drawscreen(load, 0, 0); |
---|
806 | |
---|
807 | ip = string_replace("http://", "", (char*)link, 0); |
---|
808 | |
---|
809 | if(ip != NULL) |
---|
810 | pos = strchr(ip, '/'); |
---|
811 | if(pos != NULL) |
---|
812 | { |
---|
813 | pos[0] = '\0'; |
---|
814 | path = pos + 1; |
---|
815 | } |
---|
816 | |
---|
817 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
818 | free(tpath), tpath = NULL; |
---|
819 | titheklog(debuglevel, "/tmp/movie4k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
820 | |
---|
821 | if(tmpstr != NULL) |
---|
822 | { |
---|
823 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
824 | folgen = string_replace_all("\n", "", folgen, 1); |
---|
825 | folgen = string_replace_all("\t", "", folgen, 1); |
---|
826 | string_strip_whitechars(folgen); |
---|
827 | folgen = string_replace_all("</TD> </TR> <TR>", "</TD> </TR>\n<TR>", folgen, 1); |
---|
828 | |
---|
829 | if(folgen != NULL) |
---|
830 | { |
---|
831 | int count = 0; |
---|
832 | int j; |
---|
833 | struct splitstr* ret1 = NULL; |
---|
834 | ret1 = strsplit(folgen, "\n", &count); |
---|
835 | |
---|
836 | if(ret1 != NULL && count > 0) |
---|
837 | { |
---|
838 | int max = count; |
---|
839 | for(j = 0; j < max; j++) |
---|
840 | { |
---|
841 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
842 | |
---|
843 | name = oregex(".*><a href=.*\">(.*)</a></TD>.*", ret1[j].part); |
---|
844 | |
---|
845 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
846 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
847 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
848 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
849 | else |
---|
850 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
851 | |
---|
852 | season = oregex(".*Season:(.*[0-9]{1,3}).*", name); |
---|
853 | season = strstrip(season); |
---|
854 | debug(99, "(S%s) input: %s%s",season, name, lang); |
---|
855 | |
---|
856 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
857 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
858 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
859 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
860 | |
---|
861 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
862 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
863 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
864 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
865 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
866 | ostrcatbig(&line, ".jpg#s", &maxlen, &bigpos); |
---|
867 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
868 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
869 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
870 | ostrcatbig(&line, "#39\n", &maxlen, &bigpos); |
---|
871 | |
---|
872 | free(name), name = NULL; |
---|
873 | free(lang), lang = NULL; |
---|
874 | free(season), season = NULL; |
---|
875 | } |
---|
876 | } |
---|
877 | free(ret1), ret1 = NULL; |
---|
878 | } |
---|
879 | free(from), from = NULL; |
---|
880 | free(folgen), folgen = NULL; |
---|
881 | free(folgentmp), folgentmp = NULL; |
---|
882 | } |
---|
883 | free(tmpstr), tmpstr = NULL; |
---|
884 | |
---|
885 | if(line != NULL) |
---|
886 | { |
---|
887 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
888 | tmpstr = ostrcat("/tmp/tithek/movie4k.series.", oitoa(time(NULL)), 0, 1); |
---|
889 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
890 | |
---|
891 | writesys(tmpstr, line, 0); |
---|
892 | |
---|
893 | titheklog(debuglevel, "/tmp/movie4k8_line", NULL, NULL, NULL, line); |
---|
894 | free(line); line = NULL; |
---|
895 | |
---|
896 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
897 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
898 | ret = 0; |
---|
899 | } |
---|
900 | return ret; |
---|
901 | } |
---|
902 | |
---|
903 | int movie4k_series_listed(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title) |
---|
904 | { |
---|
905 | debug(99, "link: %s", link); |
---|
906 | int debuglevel = getconfigint("debuglevel", NULL); |
---|
907 | int ret = 1, maxlen = 0, bigpos = 0; |
---|
908 | char* ip = NULL, *pos = NULL, *tpath = NULL, *path = NULL, *tmpstr = NULL, *line = NULL; |
---|
909 | char* from = NULL; |
---|
910 | char* folgen = NULL; |
---|
911 | char* folgentmp = NULL; |
---|
912 | char* name = NULL; |
---|
913 | char* lang = NULL; |
---|
914 | char* season = NULL; |
---|
915 | char* episode = NULL; |
---|
916 | |
---|
917 | if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL) |
---|
918 | return ret; |
---|
919 | |
---|
920 | drawscreen(load, 0, 0); |
---|
921 | |
---|
922 | ip = string_replace("http://", "", (char*)link, 0); |
---|
923 | |
---|
924 | if(ip != NULL) |
---|
925 | pos = strchr(ip, '/'); |
---|
926 | if(pos != NULL) |
---|
927 | { |
---|
928 | pos[0] = '\0'; |
---|
929 | path = pos + 1; |
---|
930 | } |
---|
931 | |
---|
932 | tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0); |
---|
933 | free(tpath), tpath = NULL; |
---|
934 | titheklog(debuglevel, "/tmp/movie4k2_tmpstr", NULL, NULL, NULL, tmpstr); |
---|
935 | |
---|
936 | if(tmpstr != NULL) |
---|
937 | { |
---|
938 | folgen = string_resub("<TABLE id=\"tablemoviesindex\">", "</TABLE>", tmpstr, 0); |
---|
939 | folgen = string_replace_all("\n", "", folgen, 1); |
---|
940 | folgen = string_replace_all("\t", "", folgen, 1); |
---|
941 | string_strip_whitechars(folgen); |
---|
942 | folgen = string_replace_all("</TD> </TR> <TR>", "</TD> </TR>\n<TR>", folgen, 1); |
---|
943 | |
---|
944 | if(folgen != NULL) |
---|
945 | { |
---|
946 | int count = 0; |
---|
947 | int j; |
---|
948 | struct splitstr* ret1 = NULL; |
---|
949 | ret1 = strsplit(folgen, "\n", &count); |
---|
950 | |
---|
951 | if(ret1 != NULL && count > 0) |
---|
952 | { |
---|
953 | int max = count; |
---|
954 | for(j = 0; j < max; j++) |
---|
955 | { |
---|
956 | link = string_resub("<a href=\"", "\">", ret1[j].part, 0); |
---|
957 | name = oregex(".*><a href=.*\">(.*)</a></TD>.*", ret1[j].part); |
---|
958 | |
---|
959 | if(ostrstr(ret1[j].part, "us_ger_small.png") != NULL) |
---|
960 | lang = ostrcat(" (de)", NULL, 0, 0); |
---|
961 | else if(ostrstr(ret1[j].part, "us_flag_small.png") != NULL) |
---|
962 | lang = ostrcat(" (en)", NULL, 0, 0); |
---|
963 | else |
---|
964 | lang = ostrcat(" (\?\?)", NULL, 0, 0); |
---|
965 | |
---|
966 | season = oregex(".*Season:(.*),.*", name); |
---|
967 | season = strstrip(season); |
---|
968 | episode = oregex(".*Episode:(.*[0-9]{1,3}).*", name); |
---|
969 | episode = strstrip(episode); |
---|
970 | debug(99, "(S%s/E%s) input: %s%s",season, episode, name, lang); |
---|
971 | |
---|
972 | ostrcatbig(&line, _("Season"), &maxlen, &bigpos); |
---|
973 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
974 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
975 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
976 | ostrcatbig(&line, _("Episode"), &maxlen, &bigpos); |
---|
977 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
978 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
979 | ostrcatbig(&line, " ", &maxlen, &bigpos); |
---|
980 | ostrcatbig(&line, lang, &maxlen, &bigpos); |
---|
981 | ostrcatbig(&line, "#http://www.movie4k.to/", &maxlen, &bigpos); |
---|
982 | ostrcatbig(&line, link, &maxlen, &bigpos); |
---|
983 | ostrcatbig(&line, "#http://atemio.dyndns.tv/mediathek/menu/s", &maxlen, &bigpos); |
---|
984 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
985 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
986 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
987 | ostrcatbig(&line, ".jpg#s", &maxlen, &bigpos); |
---|
988 | ostrcatbig(&line, season, &maxlen, &bigpos); |
---|
989 | ostrcatbig(&line, "e", &maxlen, &bigpos); |
---|
990 | ostrcatbig(&line, episode, &maxlen, &bigpos); |
---|
991 | ostrcatbig(&line, ".jpg#Movie4k - ", &maxlen, &bigpos); |
---|
992 | ostrcatbig(&line, title, &maxlen, &bigpos); |
---|
993 | ostrcatbig(&line, "#34\n", &maxlen, &bigpos); |
---|
994 | |
---|
995 | free(name), name = NULL; |
---|
996 | free(lang), lang = NULL; |
---|
997 | free(season), season = NULL; |
---|
998 | free(episode), episode = NULL; |
---|
999 | } |
---|
1000 | } |
---|
1001 | free(ret1), ret1 = NULL; |
---|
1002 | } |
---|
1003 | free(from), from = NULL; |
---|
1004 | free(folgen), folgen = NULL; |
---|
1005 | free(folgentmp), folgentmp = NULL; |
---|
1006 | } |
---|
1007 | free(tmpstr), tmpstr = NULL; |
---|
1008 | |
---|
1009 | if(line != NULL) |
---|
1010 | { |
---|
1011 | line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1); |
---|
1012 | tmpstr = ostrcat("/tmp/tithek/movie4k.series.listed.", oitoa(time(NULL)), 0, 1); |
---|
1013 | tmpstr = ostrcat(tmpstr, ".list", 1, 0); |
---|
1014 | |
---|
1015 | writesys(tmpstr, line, 0); |
---|
1016 | |
---|
1017 | titheklog(debuglevel, "/tmp/movie4k8_line", NULL, NULL, NULL, line); |
---|
1018 | free(line); line = NULL; |
---|
1019 | |
---|
1020 | struct tithek* tnode = (struct tithek*)listbox->select->handle; |
---|
1021 | createtithek(tnode, tnode->title, tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag); |
---|
1022 | ret = 0; |
---|
1023 | } |
---|
1024 | return ret; |
---|
1025 | } |
---|
1026 | |
---|
1027 | |
---|
1028 | #endif |
---|