source: titan/plugins/tithek/kinox.h @ 39369

Last change on this file since 39369 was 39369, checked in by obi, 7 years ago

test

File size: 29.1 KB
Line 
1#ifndef KINOX_H
2#define KINOX_H
3
4// flag 1 = putlocker/sockshare
5// flag 2 = filenuke
6
7char* kinox(char* link)
8{
9        debug(99, "link: %s", link);
10        char* streamurl = NULL;
11
12        streamurl = hoster(link);
13        debug(99, "streamurl1: %s", streamurl);
14
15        streamurl = string_replace_all("amp;", "", streamurl, 1);
16        debug(99, "streamurl2: %s", streamurl);
17
18        return streamurl;
19}
20
21int kinox_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag)
22{
23        int ret = 1;
24        int debuglevel = getconfigint("debuglevel", NULL);
25
26        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
27                return ret;
28
29        char* search = NULL;
30        if(flag == 0)
31        {
32                if(searchstr == NULL)
33                        search = textinputhist(_("Search"), " ", "searchhist");
34                else
35                        search = textinputhist(_("Search"), searchstr, "searchhist");
36        }
37        else
38                search = ostrcat(link, NULL, 0, 0);
39
40        if(search != NULL)
41        {
42                drawscreen(load, 0, 0);
43                char* tmpstr = NULL;
44                char* tmpstr1 = NULL;
45                char* line = NULL;
46                char* pic = NULL;
47                char* title = NULL;     
48                char* lang = NULL;
49                char* langck = NULL;
50                char* from = NULL;
51                char* url = NULL;
52                char* ip = NULL;
53                char* path = NULL;
54                char* menu = NULL;
55
56                search = strstrip(search);
57                search = stringreplacechar(search, ' ', '+');
58                debug(99, "search: %s", search);
59
60                ip = ostrcat("kinox.me", NULL, 0, 0);
61                if(flag == 0)
62                        path = ostrcat("Search.html?q=", search, 0, 0);
63                else
64                        path = string_replace_all("http://kinox.me/", "", search, 0);
65               
66                tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
67                tmpstr = string_resub("<div id=\"beep\" class=\"beep\"></div>", "</table>", tmpstr, 0);
68
69                titheklog(debuglevel, "/tmp/kinox1_tmpstr", NULL, NULL, NULL, tmpstr);
70               
71                int count = 0;
72                int incount = 0;
73                int i = 0;
74                struct splitstr* ret1 = NULL;
75                ret1 = strsplit(tmpstr, "\n", &count);
76
77                if(ret1 != NULL)
78                {
79                        int max = count;
80                        for(i = 0; i < max; i++)
81                        {
82                                if(oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part) != NULL)
83                                {
84                                        free(langck), langck = NULL;
85                                        langck = oregex(".*src=\"/gr/sys/lng/(.*)\" alt=\"language\"></td>.*", ret1[i].part);
86                                }
87                               
88                                if(oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part) != NULL)
89                                {
90                                        int rcret = waitrc(NULL, 10, 0);
91                                        if(rcret == getrcconfigint("rcexit", NULL)) break;
92                                        free(path), path = NULL;
93                                        path = oregex(".*<td class=\"Title\"><a href=\"(.*)\" onclick=.*", ret1[i].part);
94
95                                        if(ostrstr(langck, "1.png") != NULL)
96                                                lang = ostrcat(lang, " (de)", 1, 0);
97                                        else if(ostrstr(langck, "2.png") != NULL)
98                                                lang = ostrcat(lang, " (en)", 1, 0);
99                                        else
100                                                lang = ostrcat(lang, " (\?\?)", 1, 0);
101                                                                                                                                       
102                                        tmpstr1 = gethttp("kinox.me", path, 80, NULL, NULL, 10000, NULL, 0);
103
104                                        from = ostrcat("<div class=\"Grahpics\"><a href=\"", path, 0, 0);
105                                        from = ostrcat(from, "\"><img src=\"", 1, 0);
106
107                                        pic = string_resub(from, "\" alt=\"", tmpstr1, 0);
108                                       
109                                        if(pic == NULL)
110                                                pic = ostrcat("dummy", NULL, 0, 0);
111
112                                        title = ostrcat(path, NULL, 0, 0);
113                                        title = string_replace_all("/Stream/", "", title, 1);
114                                        title = string_replace_all(".html", "", title, 1);
115                                        title = stringreplacechar(title, '_', ' ');
116                                        title = ostrcat(title , lang, 1, 0);
117
118                                        url = ostrcat("http://kinox.me", path, 0, 0);
119
120                                        debug(99, "---------------------------");
121                                        debug(99, "langck: %s", langck);
122                                        debug(99, "pic: %s", pic);
123                                        debug(99, "title: %s", title);
124                                        debug(99, "url: %s", url);                                     
125                                        debug(99, "---------------------------");
126
127                                        if(url != NULL)
128                                        {
129                                                incount += 1;
130                                                line = ostrcat(line, title, 1, 0);
131                                                line = ostrcat(line, "#", 1, 0);
132                                                line = ostrcat(line, url, 1, 0);
133                                                line = ostrcat(line, "#http://kinox.me/", 1, 0);
134                                                line = ostrcat(line, pic, 1, 0);
135                                                line = ostrcat(line, "#kinox_search_", 1, 0);
136                                                line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1);
137                                                line = ostrcat(line, ".jpg#KinoX - Search#22\n", 1, 0);
138                                        }
139                                        free(url), url = NULL;
140                                        free(path), path = NULL;
141                                        free(title), title = NULL;
142                                        free(pic), pic = NULL;         
143                                        free(from), from = NULL;
144                                        free(tmpstr1), tmpstr1 = NULL;
145                                        free(lang), lang = NULL;
146                                        free(langck), langck = NULL;   
147                                }
148                        }
149                        free(ret1), ret1 = NULL;
150                        if(line != NULL)
151                        {
152                                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
153                                menu = ostrcat("/tmp/tithek/kinox.search.", oitoa(time(NULL)), 0, 1);
154                                menu = ostrcat(menu, ".list", 1, 0);
155
156                                writesys(menu, line, 0);
157                                struct tithek* tnode = (struct tithek*)listbox->select->handle;
158                                createtithek(tnode, tnode->title,  menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
159                                ret = 0;
160                        }
161
162                }
163                free(tmpstr), tmpstr = NULL;
164                free(ip), ip = NULL;
165        }
166        free(search), search = NULL;
167        return ret;
168}
169
170int kinox_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag)
171{
172        char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL;
173        int ret = 1, count = 0, i = 0;
174
175        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
176                return ret;
177
178        if(searchstr == NULL)
179                search = textinputhist(_("Search"), " ", "searchhist");
180        else
181                search = textinputhist(_("Search"), searchstr, "searchhist");
182
183        if(search != NULL)
184        {
185                drawscreen(load, 0, 0);
186
187                strstrip(search);
188                string_tolower(search);
189
190                tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/kinox/streams/kinox.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0);
191
192                struct splitstr* ret1 = NULL;
193                ret1 = strsplit(tmpstr, "\n", &count);
194
195                if(ret1 != NULL)
196                {
197                        int max = count;
198                        for(i = 0; i < max; i++)
199                        {
200                       
201                                tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
202                                tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0');
203                                string_tolower(tmpstr1);
204
205                                if(ostrstr(tmpstr1, search) != NULL)
206                                {
207                                        printf("found: %s\n", ret1[i].part);
208                                        int rcret = waitrc(NULL, 10, 0);
209                                        if(rcret == getrcconfigint("rcexit", NULL)) break;
210
211                                        line = ostrcat(line, ret1[i].part, 1, 0);
212                                        line = ostrcat(line, "\n", 0, 0);
213                                }
214                                free(tmpstr1), tmpstr1 = NULL;                         
215                        }
216                        free(ret1), ret1 = NULL;
217
218                        if(line != NULL)
219                        {
220                                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
221                                menu = ostrcat("/tmp/tithek/kinox.search.", oitoa(time(NULL)), 0, 1);
222                                menu = ostrcat(menu, ".list", 1, 0);
223
224                                writesys(menu, line, 0);
225                                struct tithek* tnode = (struct tithek*)listbox->select->handle;
226                                createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
227                                ret = 0;
228                        }
229                }
230                free(tmpstr), tmpstr = NULL;
231        }
232        free(search), search = NULL;
233        return ret;
234}
235
236int kinox_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
237{
238        debug(99, "link: %s", link);
239        int debuglevel = getconfigint("debuglevel", NULL);
240        int ret = 1, series = 0;
241        char* ip = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *pichname = NULL;
242        char* tmpstr4 = NULL, *tmpstr5 = NULL, *line = NULL, *url = NULL, *url2 = NULL, *url3 = NULL, *url4 = NULL, *pathnew = NULL, *extra = NULL;
243
244        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
245                return ret;
246
247        ip = string_replace("http://", "", (char*)link, 0);
248
249        if(ip != NULL)
250                pos = strchr(ip, '/');
251        if(pos != NULL)
252        {
253                pos[0] = '\0';
254                path = pos + 1;
255        }
256
257        tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
258        titheklog(debuglevel, "/tmp/kinox2_tmpstr", NULL, NULL, NULL, tmpstr);
259       
260        if(tmpstr != NULL)
261        {
262                drawscreen(load, 0, 0);
263                if(ostrstr(tmpstr, "SeriesID") != NULL)
264                {
265                        char* pos1 = NULL;
266                        char* from = NULL;
267                        char* folgen = NULL;
268                        int i;
269
270                        series = 1;
271       
272                        for(i = 1; i < 30; i++)
273                        {
274                                from = ostrcat(from, "<option value=\"", 1, 0);
275                                from = ostrcat(from, oitoa(i), 1, 0);
276                                from = ostrcat(from, "\" rel=", 1, 0);
277                       
278                                pos1 = ostrstr(tmpstr, from);
279                                folgen = getxmlentry(ostrstr(tmpstr, from), "rel=");
280                                printf("Season %d folgen: %s\n",i , folgen);   
281
282                                if(folgen != NULL)
283                                {
284                                        int count = 0;
285                                        int incount = 0;
286                                        int j;
287                                        struct splitstr* ret1 = NULL;
288                                        ret1 = strsplit(folgen, ",", &count);
289                                               
290                                        if(ret1 != NULL && count > 0)
291                                        {
292                                                int max = count + 1;
293                                                for(j = 1; j < max; j++)
294                                                {                                                       
295                                                        incount += 1;
296                                                        line = ostrcat(line, _("Season"), 1, 0);
297                                                        line = ostrcat(line, " ", 1, 0);
298                                                        line = ostrcat(line, oitoa(i), 1, 0);
299                                                        line = ostrcat(line, " ", 1, 0);
300                                                        line = ostrcat(line, _("Episode"), 1, 0);
301                                                        line = ostrcat(line, " ", 1, 0);
302                                                        line = ostrcat(line, oitoa(j), 1, 0);                                   
303                                                        line = ostrcat(line, "#", 1, 0);
304                                                        line = ostrcat(line, link, 1, 0);
305                                                        line = ostrcat(line, ";", 1, 0);
306                                                        line = ostrcat(line, oitoa(i), 1, 0);
307                                                        line = ostrcat(line, ";", 1, 0);
308                                                        line = ostrcat(line, oitoa(j), 1, 0);
309                                                        line = ostrcat(line, "#", 1, 0);
310                                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/s", 1, 0);
311                                                        line = ostrcat(line, oitoa(i), 1, 0);
312                                                        line = ostrcat(line, "e", 1, 0);
313                                                        line = ostrcat(line, oitoa(j), 1, 0);
314                                                        line = ostrcat(line, ".jpg", 1, 0);                                                                                                                             
315                                                        line = ostrcat(line, "#kinox_search_", 1, 0);
316                                                        line = ostrcat(line, oitoa(i), 1, 0);
317                                                        line = ostrcat(line, "e", 1, 0);
318                                                        line = ostrcat(line, oitoa(j), 1, 0);
319                                                        line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
320                                                        line = ostrcat(line, title, 1, 0);
321                                                        line = ostrcat(line, "#23\n", 1, 0);
322                                                }
323                                        }
324                                        free(ret1), ret1 = NULL;
325                                }                               
326                                free(from), from = NULL;
327                                free(folgen), folgen = NULL;
328                        }
329                }
330                else
331                {
332                        tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0);
333                        titheklog(debuglevel, "/tmp/kinox3_tmpstr", NULL, NULL, NULL, tmpstr);
334       
335                        int type = 14;
336                        int count = 0;
337                        int incount = 0;
338                        int i;
339                        struct splitstr* ret1 = NULL;
340                        ret1 = strsplit(tmpstr, "\n", &count);
341       
342                        char* hname = NULL;
343                        char* hnr = NULL;
344                        char* hlink = NULL;
345
346                        if(ret1 != NULL && count > 0)
347                        {
348                                int max = count;
349                                for(i = 0; i < max; i++)
350                                {
351//                                      printf("ret1[i].part: %s\n",ret1[i].part);
352                                        hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0);
353                                        hlink = string_resub("rel=\"", "\">", ret1[i].part, 0);
354                                        hlink = string_replace_all("amp;", "", hlink, 1);
355       
356                                        hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
357                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
358
359                                        pichname = ostrcat(hname, NULL, 0, 0);
360                                        string_tolower(pichname);
361                                        pichname = stringreplacecharonce(pichname, '.', '\0');
362
363                                        extra = string_resub("<b>Vom</b>: ", "</div>", ret1[i].part, 0);
364
365                                        titheklog(debuglevel, "/tmp/kinox4_pathnew1", hname, NULL, NULL, pathnew);
366                                       
367                                        tmpstr1 = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
368                                        if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL)
369                                        {
370                                                sleep(1);
371                                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
372                                        }
373                                        if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL)
374                                        {
375                                                sleep(1);
376                                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
377                                        }
378                                        if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL)
379                                        {
380                                                sleep(1);
381                                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
382                                        }
383                                        if(ostrstr(tmpstr1, "503 Service Temporarily Unavailable") != NULL)
384                                        {
385                                                sleep(1);
386                                                tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
387                                        }
388                                        free(pathnew), pathnew = NULL;
389
390                                        titheklog(debuglevel, "/tmp/kinox5_tmpstr1", hname, NULL, NULL, tmpstr1);
391
392                                        tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
393                                        if(ostrstr(tmpstr1, "iframe src") != NULL)
394                                                url = string_resub("<iframe src=\"", "\"", tmpstr1, 0);
395                                        else
396                                                url = string_resub("<a href=\"", "\"", tmpstr1, 0);
397
398                                        //url = ostrcat(tmpstr1, NULL, 0, 0);
399////////////////
400                                        free(pathnew), pathnew = NULL;
401                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
402                                        pathnew = ostrcat(pathnew, "&Part=2", 1, 0);
403
404                                        titheklog(debuglevel, "/tmp/kinox6_pathnew2", hname, NULL, NULL, pathnew);
405                                       
406                                        tmpstr3 = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
407                                        free(pathnew), pathnew = NULL;
408
409                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr3", hname, NULL, NULL, tmpstr3);
410
411                                        tmpstr3 = string_replace_all("\\", "", tmpstr3, 1);
412                                        tmpstr3 = string_resub("<a href=\"", "\"", tmpstr3, 0);
413                                       
414                                        url2 = ostrcat(tmpstr3, NULL, 0, 0);
415////////////////
416                                        free(pathnew), pathnew = NULL;
417                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
418                                        pathnew = ostrcat(pathnew, "&Part=3", 1, 0);
419
420                                        titheklog(debuglevel, "/tmp/kinox6_pathnew3", hname, NULL, NULL, pathnew);
421                                       
422                                        tmpstr4 = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
423                                        free(pathnew), pathnew = NULL;
424
425                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr4", hname, NULL, NULL, tmpstr4);
426
427                                        tmpstr4 = string_replace_all("\\", "", tmpstr4, 1);
428                                        tmpstr4 = string_resub("<a href=\"", "\"", tmpstr4, 0);
429                                       
430                                        url3 = ostrcat(tmpstr4, NULL, 0, 0);
431////////////////
432                                        free(pathnew), pathnew = NULL;
433                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
434                                        pathnew = ostrcat(pathnew, "&Part=4", 1, 0);
435
436                                        titheklog(debuglevel, "/tmp/kinox6_pathnew4", hname, NULL, NULL, pathnew);
437                                       
438                                        tmpstr5 = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
439                                        free(pathnew), pathnew = NULL;
440
441                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr5", hname, NULL, NULL, tmpstr5);
442
443                                        tmpstr5 = string_replace_all("\\", "", tmpstr5, 1);
444                                        tmpstr5 = string_resub("<a href=\"", "\"", tmpstr5, 0);
445                                       
446                                        url4 = ostrcat(tmpstr5, NULL, 0, 0);
447////////////////
448                                        type = 14;
449
450                                        debug(99, "-------------------------------");
451                                        if(ostrcmp(url, url2) != 0)
452                                        {
453                                                debug(99, "(%d/%d) %s (Part1) url: %s extra: %s",i ,max , hname, url, extra);
454                                        }
455                                        else
456                                        {
457                                                debug(99, "(%d/%d) %s url: %s extra: %s",i ,max , hname, url, extra);
458                                        }
459
460                                        incount += 1;
461                                        line = ostrcat(line, hname, 1, 0);
462                                        if(url == NULL)
463                                                line = ostrcat(line, " (Error)", 1, 0);
464                                       
465                                        if(url2 != NULL && ostrcmp(url, url2) != 0)
466                                                line = ostrcat(line, " (Part1)", 1, 0);
467                                        if(extra != NULL)
468                                        {
469                                                line = ostrcat(line, " (", 1, 0);                                       
470                                                line = ostrcat(line, extra, 1, 0);                                     
471                                                line = ostrcat(line, ")", 1, 0);                                       
472                                        }                               
473                                        line = ostrcat(line, "#", 1, 0);
474                                        line = ostrcat(line, url, 1, 0);
475                                        line = ostrcat(line, "#", 1, 0);
476                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
477                                        line = ostrcat(line, pichname, 1, 0);
478                                        line = ostrcat(line, ".jpg#kinox_", 1, 0);
479                                        line = ostrcat(line, pichname, 1, 0);
480                                        line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
481                                        line = ostrcat(line, title, 1, 0);
482                                        line = ostrcat(line, "#", 1, 0);
483                                        line = ostrcat(line, oitoa(type), 1, 0);
484                                        line = ostrcat(line, "\n", 1, 0);
485
486                                        if((url != NULL || url2 != NULL) && ostrcmp(url, url2) != 0)
487                                        {
488                                                free(tmpstr2), tmpstr2 = NULL;
489                                                free(hname), hname = NULL;
490                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
491                                                pichname = ostrcat(hname, NULL, 0, 0);
492                                                string_tolower(pichname);
493                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
494
495                                                type = 14;
496
497                                                debug(99, "-------------------------------");
498                                                debug(99, "(%d/%d) %s (Part2) url: %s extra: %s",i ,max, hname, url2, extra);
499
500                                                incount += 1;
501                                                line = ostrcat(line, hname, 1, 0);
502                                                line = ostrcat(line, " (Part2)", 1, 0);
503                                                if(extra != NULL)
504                                                {
505                                                        line = ostrcat(line, " (", 1, 0);                                       
506                                                        line = ostrcat(line, extra, 1, 0);                                     
507                                                        line = ostrcat(line, ")", 1, 0);                                       
508                                                }
509                                                line = ostrcat(line, "#", 1, 0);
510                                                line = ostrcat(line, url2, 1, 0);
511                                                line = ostrcat(line, "#", 1, 0);
512                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
513                                                line = ostrcat(line, pichname, 1, 0);
514                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
515                                                line = ostrcat(line, pichname, 1, 0);
516                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
517                                                line = ostrcat(line, title, 1, 0);
518                                                line = ostrcat(line, "#", 1, 0);
519                                                line = ostrcat(line, oitoa(type), 1, 0);
520                                                line = ostrcat(line, "\n", 1, 0);
521                                                free(tmpstr2), tmpstr2 = NULL;
522                                        }
523
524                                        if((url != NULL || url3 != NULL) && ostrcmp(url, url3) != 0 && ostrcmp(url2, url3) != 0)
525                                        {
526                                                free(tmpstr2), tmpstr2 = NULL;
527                                                free(hname), hname = NULL;
528                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
529                                                pichname = ostrcat(hname, NULL, 0, 0);
530                                                string_tolower(pichname);
531                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
532                                                type = 14;
533
534                                                debug(99, "-------------------------------");
535                                                debug(99, "(%d/%d) %s (Part3) url: %s extra: %s",i ,max , hname, url3, extra);
536                                                                                       
537                                                incount += 1;
538                                                line = ostrcat(line, hname, 1, 0);
539                                                if(extra != NULL)
540                                                line = ostrcat(line, " (Part3)", 1, 0);                                 
541                                                if(extra != NULL)
542                                                {
543                                                        line = ostrcat(line, " (", 1, 0);                                       
544                                                        line = ostrcat(line, extra, 1, 0);                                     
545                                                        line = ostrcat(line, ")", 1, 0);                                       
546                                                }
547                                                line = ostrcat(line, "#", 1, 0);
548                                                line = ostrcat(line, url3, 1, 0);
549                                                line = ostrcat(line, "#", 1, 0);
550                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
551                                                line = ostrcat(line, pichname, 1, 0);
552                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
553                                                line = ostrcat(line, pichname, 1, 0);
554                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
555                                                line = ostrcat(line, title, 1, 0);
556                                                line = ostrcat(line, "#", 1, 0);
557                                                line = ostrcat(line, oitoa(type), 1, 0);
558                                                line = ostrcat(line, "\n", 1, 0);
559                                                free(tmpstr2), tmpstr2 = NULL;
560                                        }
561
562                                        if((url != NULL || url4 != NULL) && ostrcmp(url, url4) != 0 && ostrcmp(url2, url4) != 0 && ostrcmp(url3, url4) != 0)
563                                        {
564                                                free(tmpstr2), tmpstr2 = NULL;
565                                                free(hname), hname = NULL;
566                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
567                                                pichname = ostrcat(hname, NULL, 0, 0);
568                                                string_tolower(pichname);
569                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
570                                                type = 14;
571
572                                                debug(99, "-------------------------------");
573                                                debug(99, "(%d/%d) %s (Part4) url: %s extra: %s",i ,max , hname, url4, extra);
574
575                                                incount += 1;
576                                                line = ostrcat(line, hname, 1, 0);
577                                                line = ostrcat(line, " (Part4)", 1, 0);
578                                                if(extra != NULL)
579                                                {
580                                                        line = ostrcat(line, " (", 1, 0);                                       
581                                                        line = ostrcat(line, extra, 1, 0);                                     
582                                                        line = ostrcat(line, ")", 1, 0);                                       
583                                                }               
584                                                line = ostrcat(line, "#", 1, 0);
585                                                line = ostrcat(line, url4, 1, 0);
586                                                line = ostrcat(line, "#", 1, 0);
587                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
588                                                line = ostrcat(line, pichname, 1, 0);
589                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
590                                                line = ostrcat(line, pichname, 1, 0);
591                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
592                                                line = ostrcat(line, title, 1, 0);
593                                                line = ostrcat(line, "#", 1, 0);
594                                                line = ostrcat(line, oitoa(type), 1, 0);
595                                                line = ostrcat(line, "\n", 1, 0);
596                                                free(tmpstr2), tmpstr2 = NULL;
597                                        }
598                                       
599                                        free(tmpstr1), tmpstr1 = NULL;
600                                        free(tmpstr2), tmpstr2 = NULL;
601                                        free(tmpstr3), tmpstr3 = NULL;
602                                        free(tmpstr4), tmpstr4 = NULL;
603                                        free(tmpstr5), tmpstr5 = NULL;
604                                        free(hname), hname = NULL;
605                                        free(hnr), hnr = NULL;
606                                        free(hlink), hlink = NULL;                                                                             
607                                        free(url), url = NULL;
608                                        free(url2), url2 = NULL;
609                                        free(url3), url3 = NULL;
610                                        free(url4), url4 = NULL;
611                                        free(pathnew), pathnew = NULL;
612                                        free(pichname), pichname = NULL;
613                                        free(extra), extra = NULL;
614                                }
615                        }
616                        free(ret1), ret1 = NULL;
617                }
618        }
619        free(tmpstr), tmpstr = NULL;   
620
621        if(line != NULL)
622        {
623                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
624                if(series == 0)
625                {
626                        tmpstr = ostrcat("/tmp/tithek/kinox.hoster.", oitoa(time(NULL)), 0, 1);
627                        tmpstr = ostrcat(tmpstr, ".list", 1, 0);
628                }
629                else
630                {
631                        tmpstr = ostrcat("/tmp/tithek/kinox.hoster.ser.", oitoa(time(NULL)), 0, 1);
632                        tmpstr = ostrcat(tmpstr, ".list", 1, 0);
633                }
634                writesys(tmpstr, line, 0);
635
636                titheklog(debuglevel, "/tmp/kinox8_line", NULL, NULL, NULL, line);
637                                       
638                struct tithek* tnode = (struct tithek*)listbox->select->handle;
639                createtithek(tnode, tnode->title,  tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
640                ret = 0;
641        }
642
643        return ret;
644}
645
646int kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
647{
648        debug(99, "link: %s", link);
649        int debuglevel = getconfigint("debuglevel", NULL);
650        int ret = 1;
651        char* ip = NULL, *pathnew = NULL, *seriesid = NULL, *searchname = NULL, *url = NULL, *session = NULL, *episode = NULL, *pos = NULL, *path = NULL, *tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL, *line = NULL;               
652        char* pichname = NULL, *extra= NULL;
653        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
654                return ret;
655
656        int count0 = 0;
657        struct splitstr* ret0 = NULL;
658        ret0 = strsplit(link, ";", &count0);
659        if(ret0 != NULL && count0 >= 3)
660        {
661                url = ostrcat(url, ret0[0].part, 1, 0);
662                debug(99, "url: %s", url);
663
664                session = ostrcat(session, ret0[1].part, 1, 0);
665                debug(99, "Season: %s", session);
666
667                episode = ostrcat(episode, ret0[2].part, 1, 0);
668                debug(99, "episode: %s", episode);
669
670                searchname = ostrcat(searchname, ret0[0].part, 1, 0);
671                searchname = string_replace("http://kinox.me//Stream/", "", searchname, 0);
672                searchname = string_replace("http://kinox.me/Stream/", "", searchname, 0);
673                searchname = string_replace(".html", "", searchname, 0);
674                debug(99, "searchname: %s", searchname);
675        }
676        free(ret0), ret0 = NULL;
677
678        ip = string_replace("http://", "", url, 0);
679
680        if(ip != NULL)
681                pos = strchr(ip, '/');
682        if(pos != NULL)
683        {
684                pos[0] = '\0';
685                path = pos + 1;
686        }
687
688        tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
689
690        if(tmpstr != NULL)
691        {
692                drawscreen(load, 0, 0);
693               
694                seriesid = string_resub("SeriesID=", "\"", tmpstr, 0);
695                debug(99, "seriesid: %s", seriesid);
696                       
697                pathnew = ostrcat("/aGET/MirrorByEpisode/&?Addr=", searchname, 0, 0);
698                pathnew = ostrcat(pathnew, "&SeriesID=", 1, 0);
699                pathnew = ostrcat(pathnew, seriesid, 1, 0);
700                pathnew = ostrcat(pathnew, "&Season=", 1, 0);
701                pathnew = ostrcat(pathnew, session, 1, 0);
702                pathnew = ostrcat(pathnew, "&Episode=", 1, 0);
703                pathnew = ostrcat(pathnew, episode, 1, 0);
704                debug(99, "pathnew: %s", pathnew);
705       
706                free(tmpstr), tmpstr = NULL;
707                tmpstr = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
708                free(pathnew), pathnew = NULL;
709       
710                if(tmpstr != NULL)
711                {
712                        tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0);
713               
714                        int type = 14;
715                        int count = 0;
716                        int incount = 0;
717                        int i;
718                        struct splitstr* ret1 = NULL;
719                        ret1 = strsplit(tmpstr, "\n", &count);
720               
721                        char* hname = NULL;
722                        char* hnr = NULL;
723                        char* hlink = NULL;
724                       
725                        if(ret1 != NULL && count > 0)
726                        {
727                                int max = count;
728                                for(i = 0; i < max; i++)
729                                {
730                                        hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0);
731                                        hlink = string_resub("rel=\"", "\">", ret1[i].part, 0);
732                                        hlink = string_replace_all("amp;", "", hlink, 1);
733                                        hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
734
735                                        pichname = ostrcat(hname, NULL, 0, 0);
736                                        string_tolower(pichname);
737                                        pichname = stringreplacecharonce(pichname, '.', '\0');
738
739                                        extra = string_resub("<b>Vom</b>: ", "</div>", ret1[i].part, 0);
740                       
741                                        hlink = string_replace("http://kinox.me//Stream/", "", hlink, 1);                                       
742                                        hlink = string_replace("http://kinox.me/Stream/", "", hlink, 1);
743                                                                               
744                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
745                                        debug(99, "pathnew: %s", pathnew);
746       
747                                        tmpstr1 = gethttp("kinox.me", pathnew, 80, NULL, NULL, 10000, NULL, 0);
748                                        tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
749                                        tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0);
750       
751                                        url = ostrcat(tmpstr1, NULL, 0, 0);
752
753                                        type = 14;
754
755                                        debug(99, "-------------------------------");
756                                        debug(99, "(%d/%d) %s url: %s extra: %s",i ,max , hname, url, extra);
757                                                       
758                                        incount += 1;
759                                        line = ostrcat(line, hname, 1, 0);
760                                        if(extra != NULL)
761                                        {
762                                                line = ostrcat(line, " (", 1, 0);                                       
763                                                line = ostrcat(line, extra, 1, 0);                                     
764                                                line = ostrcat(line, ")", 1, 0);                                       
765                                        }
766                                        line = ostrcat(line, "#", 1, 0);
767                                        line = ostrcat(line, url, 1, 0);
768                                        line = ostrcat(line, "#", 1, 0);
769                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
770                                        line = ostrcat(line, pichname, 1, 0);
771                                        line = ostrcat(line, ".jpg#kinox_", 1, 0);
772                                        line = ostrcat(line, pichname, 1, 0);
773                                        line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
774                                        line = ostrcat(line, title, 1, 0);
775                                        line = ostrcat(line, "#", 1, 0);
776                                        line = ostrcat(line, oitoa(type), 1, 0);
777                                        line = ostrcat(line, "\n", 1, 0);
778
779                                        free(tmpstr1), tmpstr1 = NULL;                                                 
780                                        free(tmpstr2), tmpstr2 = NULL;                                 
781                                        free(hname), hname = NULL;
782                                        free(hnr), hnr = NULL;
783                                        free(hlink), hlink = NULL;                                                                             
784                                        free(url), url = NULL; 
785                                        free(pathnew), pathnew = NULL;
786                                        free(pichname), pichname = NULL;
787                                        free(extra), extra = NULL;
788                                }
789                        }
790                        free(ret1), ret1 = NULL;
791                }
792        }
793
794        free(tmpstr), tmpstr = NULL;   
795        if(line != NULL)
796        {
797                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
798                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.series.", oitoa(time(NULL)), 0, 1);
799                tmpstr = ostrcat(tmpstr, ".list", 1, 0);
800                       
801                writesys(tmpstr, line, 0);
802
803                titheklog(debuglevel, "/tmp/kinox9_line", NULL, NULL, NULL, line);
804
805                struct tithek* tnode = (struct tithek*)listbox->select->handle;
806                createtithek(tnode, tnode->title,  tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
807                ret = 0;
808        }
809
810        return ret;
811}
812
813int kinox_search_cast(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr)
814{
815        int debuglevel = getconfigint("debuglevel", NULL);
816        int ret = 1;
817
818        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
819                return ret;
820
821        char* search = NULL;
822        if(searchstr == NULL)
823                search = textinputhist(_("Search"), " ", "searchhist");
824        else
825                search = textinputhist(_("Search"), searchstr, "searchhist");
826       
827        if(search != NULL)
828        {
829                drawscreen(load, 0, 0);
830                search = strstrip(search);
831                search = stringreplacechar(search, ' ', '+');
832                debug(99, "search: %s", search);
833
834                char* tmpstr = NULL;
835                char* tmpstr1 = NULL;
836                char* ip = NULL;
837                char* path = NULL;
838
839                char* line = NULL;
840                char* menu = NULL;
841
842                ip = ostrcat("www.imdb.com", NULL, 0, 0);
843                path = ostrcat("find?q=", search, 0, 0);
844                path = ostrcat(path, "&s=nm", 1, 0);
845
846                tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
847                titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr1", NULL, NULL, NULL, tmpstr);
848                tmpstr = string_replace_all("<td class=\"primary_photo\"> <a href=\"/name/", "\nfound=\"", tmpstr, 1);
849                titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr2", NULL, NULL, NULL, tmpstr);
850
851                tmpstr1 = string_resub("<table class=\"findList\">", "</div>", tmpstr, 0);
852                titheklog(debuglevel, "/tmp/kinox10_cast_tmpstr3", NULL, NULL, NULL, tmpstr1);
853                free(tmpstr), tmpstr = NULL;
854
855                int count = 0;
856                int incount = 0;
857                int i;
858                struct splitstr* ret1 = NULL;
859                ret1 = strsplit(tmpstr1, "\n", &count);
860       
861                char* url = NULL;
862                char* pic = NULL;
863                char* name = NULL;
864               
865                if(ret1 != NULL && count > 0)
866                {
867                        int max = count;
868                        for(i = 0; i < max; i++)
869                        {
870                                url = string_resub("found=\"", "/", ret1[i].part, 0);
871                                pic = string_resub("<img src=\"", "\"", ret1[i].part, 0);
872
873                                tmpstr = string_resub("found=\"", "<small>", ret1[i].part, 0);
874//                              name = oregex(".*<a href=\"/name/nm.*\ >(.*)</a>", tmpstr);
875                                name = oregex(".*<a href=\"/name/nm.* >(.*)</a>", tmpstr);
876
877                                debug(99, "(%d/%d) name: %s url: %s pic: %s\n",i, count, name, url, pic);
878                                debug(99, "-------------------------------");
879                                                                       
880                                pic = string_replace_all(",", "%2C", pic, 1);
881
882                                if(url != NULL)
883                                {
884                                        incount++;
885                                        line = ostrcat(line, name, 1, 0);
886                                        line = ostrcat(line, "#http://kinox.me/People/", 1, 0);
887                                        line = ostrcat(line, url, 1, 0);
888                                        line = ostrcat(line, "#", 1, 0);
889                                        line = ostrcat(line, pic, 1, 0);
890                                        line = ostrcat(line, "#kinox_search_", 1, 0);
891                                        line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1);
892                                        line = ostrcat(line, ".jpg#KinoX - Cast Search#32\n", 1, 0);
893                                }
894                               
895                                free(url), url = NULL;
896                                free(pic), pic = NULL;
897                                free(name), name = NULL;                               
898                                free(tmpstr), tmpstr = NULL;
899                        }
900
901                        free(ret1), ret1 = NULL;
902                        if(line != NULL)
903                        {
904                                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
905                                menu = ostrcat("/tmp/tithek/kinox.search.cast.", oitoa(time(NULL)), 0, 1);
906                                menu = ostrcat(menu, ".list", 1, 0);
907                       
908                                writesys(menu, line, 0);
909                                struct tithek* tnode = (struct tithek*)listbox->select->handle;
910                                createtithek(tnode, tnode->title,  menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
911                                ret = 0;
912                        }
913
914                }
915                free(tmpstr), tmpstr = NULL;
916                free(ip), ip = NULL;
917        }
918        free(search), search = NULL;
919        return ret;
920}
921
922#endif
Note: See TracBrowser for help on using the repository browser.