source: titan/plugins/tithek/movie4k.h @ 30274

Last change on this file since 30274 was 30274, checked in by obi, 10 years ago

[tithek] update thefile hoster and movie4k

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