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

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

tithek update

File size: 27.9 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.to", 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.to/", "", 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, 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.to", 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.to", 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, "#", 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, 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, 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, pathnew);
366                                       
367                                        tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
368                                        free(pathnew), pathnew = NULL;
369
370                                        titheklog(debuglevel, "/tmp/kinox5_tmpstr1", hname, tmpstr1);
371
372                                        tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
373                                        tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0);
374       
375                                        url = ostrcat(tmpstr1, NULL, 0, 0);
376////////////////
377                                        free(pathnew), pathnew = NULL;
378                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
379                                        pathnew = ostrcat(pathnew, "&Part=2", 1, 0);
380
381                                        titheklog(debuglevel, "/tmp/kinox6_pathnew2", hname, pathnew);
382                                       
383                                        tmpstr3 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
384                                        free(pathnew), pathnew = NULL;
385
386                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr3", hname, tmpstr3);
387
388                                        tmpstr3 = string_replace_all("\\", "", tmpstr3, 1);
389                                        tmpstr3 = string_resub("<a href=\"", "\"", tmpstr3, 0);
390                                       
391                                        url2 = ostrcat(tmpstr3, NULL, 0, 0);
392////////////////
393                                        free(pathnew), pathnew = NULL;
394                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
395                                        pathnew = ostrcat(pathnew, "&Part=3", 1, 0);
396
397                                        titheklog(debuglevel, "/tmp/kinox6_pathnew3", hname, pathnew);
398                                       
399                                        tmpstr4 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
400                                        free(pathnew), pathnew = NULL;
401
402                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr4", hname, tmpstr4);
403
404                                        tmpstr4 = string_replace_all("\\", "", tmpstr4, 1);
405                                        tmpstr4 = string_resub("<a href=\"", "\"", tmpstr4, 0);
406                                       
407                                        url3 = ostrcat(tmpstr4, NULL, 0, 0);
408////////////////
409                                        free(pathnew), pathnew = NULL;
410                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
411                                        pathnew = ostrcat(pathnew, "&Part=4", 1, 0);
412
413                                        titheklog(debuglevel, "/tmp/kinox6_pathnew4", hname, pathnew);
414                                       
415                                        tmpstr5 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
416                                        free(pathnew), pathnew = NULL;
417
418                                        titheklog(debuglevel, "/tmp/kinox7_tmpstr5", hname, tmpstr5);
419
420                                        tmpstr5 = string_replace_all("\\", "", tmpstr5, 1);
421                                        tmpstr5 = string_resub("<a href=\"", "\"", tmpstr5, 0);
422                                       
423                                        url4 = ostrcat(tmpstr5, NULL, 0, 0);
424////////////////
425                                        type = 14;
426
427                                        debug(99, "-------------------------------");
428                                        if(ostrcmp(url, url2) != 0)
429                                        {
430                                                debug(99, "(%d/%d) %s (Part1) url: %s extra: %s",i ,max , hname, url, extra);
431                                        }
432                                        else
433                                        {
434                                                debug(99, "(%d/%d) %s url: %s extra: %s",i ,max , hname, url, extra);
435                                        }
436                                       
437                                        incount += 1;
438                                        line = ostrcat(line, hname, 1, 0);
439                                        if(ostrcmp(url, url2) != 0)
440                                                line = ostrcat(line, " (Part1)", 1, 0);
441                                        if(extra != NULL)
442                                        {
443                                                line = ostrcat(line, " (", 1, 0);                                       
444                                                line = ostrcat(line, extra, 1, 0);                                     
445                                                line = ostrcat(line, ")", 1, 0);                                       
446                                        }                               
447                                        line = ostrcat(line, "#", 1, 0);
448                                        line = ostrcat(line, url, 1, 0);
449                                        line = ostrcat(line, "#", 1, 0);
450                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
451                                        line = ostrcat(line, pichname, 1, 0);
452                                        line = ostrcat(line, ".jpg#kinox_", 1, 0);
453                                        line = ostrcat(line, pichname, 1, 0);
454                                        line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
455                                        line = ostrcat(line, title, 1, 0);
456                                        line = ostrcat(line, "#", 1, 0);
457                                        line = ostrcat(line, oitoa(type), 1, 0);
458                                        line = ostrcat(line, "\n", 1, 0);
459
460                                        if(ostrcmp(url, url2) != 0)
461                                        {
462                                                free(tmpstr2), tmpstr2 = NULL;
463                                                free(hname), hname = NULL;
464                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
465                                                pichname = ostrcat(hname, NULL, 0, 0);
466                                                string_tolower(pichname);
467                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
468
469                                                type = 14;
470
471                                                debug(99, "-------------------------------");
472                                                debug(99, "(%d/%d) %s (Part2) url: %s extra: %s",i ,max, hname, url2, extra);
473
474                                                incount += 1;
475                                                line = ostrcat(line, hname, 1, 0);
476                                                line = ostrcat(line, " (Part2)", 1, 0);
477                                                if(extra != NULL)
478                                                {
479                                                        line = ostrcat(line, " (", 1, 0);                                       
480                                                        line = ostrcat(line, extra, 1, 0);                                     
481                                                        line = ostrcat(line, ")", 1, 0);                                       
482                                                }
483                                                line = ostrcat(line, "#", 1, 0);
484                                                line = ostrcat(line, url2, 1, 0);
485                                                line = ostrcat(line, "#", 1, 0);
486                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
487                                                line = ostrcat(line, pichname, 1, 0);
488                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
489                                                line = ostrcat(line, pichname, 1, 0);
490                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
491                                                line = ostrcat(line, title, 1, 0);
492                                                line = ostrcat(line, "#", 1, 0);
493                                                line = ostrcat(line, oitoa(type), 1, 0);
494                                                line = ostrcat(line, "\n", 1, 0);
495                                                free(tmpstr2), tmpstr2 = NULL;
496                                        }
497
498                                        if(ostrcmp(url, url3) != 0 && ostrcmp(url2, url3) != 0)
499                                        {
500                                                free(tmpstr2), tmpstr2 = NULL;
501                                                free(hname), hname = NULL;
502                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
503                                                pichname = ostrcat(hname, NULL, 0, 0);
504                                                string_tolower(pichname);
505                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
506                                                type = 14;
507
508                                                debug(99, "-------------------------------");
509                                                debug(99, "(%d/%d) %s (Part3) url: %s extra: %s",i ,max , hname, url3, extra);
510                                                                                       
511                                                incount += 1;
512                                                line = ostrcat(line, hname, 1, 0);
513                                                if(extra != NULL)
514                                                line = ostrcat(line, " (Part3)", 1, 0);                                 
515                                                if(extra != NULL)
516                                                {
517                                                        line = ostrcat(line, " (", 1, 0);                                       
518                                                        line = ostrcat(line, extra, 1, 0);                                     
519                                                        line = ostrcat(line, ")", 1, 0);                                       
520                                                }
521                                                line = ostrcat(line, "#", 1, 0);
522                                                line = ostrcat(line, url3, 1, 0);
523                                                line = ostrcat(line, "#", 1, 0);
524                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
525                                                line = ostrcat(line, pichname, 1, 0);
526                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
527                                                line = ostrcat(line, pichname, 1, 0);
528                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
529                                                line = ostrcat(line, title, 1, 0);
530                                                line = ostrcat(line, "#", 1, 0);
531                                                line = ostrcat(line, oitoa(type), 1, 0);
532                                                line = ostrcat(line, "\n", 1, 0);
533                                                free(tmpstr2), tmpstr2 = NULL;
534                                        }
535
536                                        if(ostrcmp(url, url4) != 0 && ostrcmp(url2, url4) != 0 && ostrcmp(url3, url4) != 0)
537                                        {
538                                                free(tmpstr2), tmpstr2 = NULL;
539                                                free(hname), hname = NULL;
540                                                hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
541                                                pichname = ostrcat(hname, NULL, 0, 0);
542                                                string_tolower(pichname);
543                                                pichname = stringreplacecharonce(pichname, '\n', '\0');
544                                                type = 14;
545
546                                                debug(99, "-------------------------------");
547                                                debug(99, "(%d/%d) %s (Part4) url: %s extra: %s",i ,max , hname, url4, extra);
548
549                                                incount += 1;
550                                                line = ostrcat(line, hname, 1, 0);
551                                                line = ostrcat(line, " (Part4)", 1, 0);
552                                                if(extra != NULL)
553                                                {
554                                                        line = ostrcat(line, " (", 1, 0);                                       
555                                                        line = ostrcat(line, extra, 1, 0);                                     
556                                                        line = ostrcat(line, ")", 1, 0);                                       
557                                                }               
558                                                line = ostrcat(line, "#", 1, 0);
559                                                line = ostrcat(line, url4, 1, 0);
560                                                line = ostrcat(line, "#", 1, 0);
561                                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
562                                                line = ostrcat(line, pichname, 1, 0);
563                                                line = ostrcat(line, ".jpg#kinox_", 1, 0);
564                                                line = ostrcat(line, pichname, 1, 0);
565                                                line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
566                                                line = ostrcat(line, title, 1, 0);
567                                                line = ostrcat(line, "#", 1, 0);
568                                                line = ostrcat(line, oitoa(type), 1, 0);
569                                                line = ostrcat(line, "\n", 1, 0);
570                                                free(tmpstr2), tmpstr2 = NULL;
571                                        }
572                                       
573                                        free(tmpstr1), tmpstr1 = NULL;
574                                        free(tmpstr2), tmpstr2 = NULL;
575                                        free(tmpstr3), tmpstr3 = NULL;
576                                        free(tmpstr4), tmpstr4 = NULL;
577                                        free(tmpstr5), tmpstr5 = NULL;
578                                        free(hname), hname = NULL;
579                                        free(hnr), hnr = NULL;
580                                        free(hlink), hlink = NULL;                                                                             
581                                        free(url), url = NULL;
582                                        free(url2), url2 = NULL;
583                                        free(url3), url3 = NULL;
584                                        free(url4), url4 = NULL;
585                                        free(pathnew), pathnew = NULL;
586                                        free(pichname), pichname = NULL;
587                                        free(extra), extra = NULL;
588                                }
589                        }
590                        free(ret1), ret1 = NULL;
591                }
592        }
593        free(tmpstr), tmpstr = NULL;   
594
595        if(line != NULL)
596        {
597                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
598                if(series == 0)
599                {
600                        tmpstr = ostrcat("/tmp/tithek/kinox.hoster.", oitoa(time(NULL)), 0, 1);
601                        tmpstr = ostrcat(tmpstr, ".list", 1, 0);
602                }
603                else
604                {
605                        tmpstr = ostrcat("/tmp/tithek/kinox.hoster.ser.", oitoa(time(NULL)), 0, 1);
606                        tmpstr = ostrcat(tmpstr, ".list", 1, 0);
607                }
608                writesys(tmpstr, line, 0);
609
610                titheklog(debuglevel, "/tmp/kinox8_line", NULL, line);
611                                       
612                struct tithek* tnode = (struct tithek*)listbox->select->handle;
613                createtithek(tnode, tnode->title,  tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
614                ret = 0;
615        }
616
617        return ret;
618}
619
620int kinox_hoster_series(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
621{
622        debug(99, "link: %s", link);
623        int debuglevel = getconfigint("debuglevel", NULL);
624        int ret = 1;
625        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;               
626        char* pichname = NULL, *extra= NULL;
627        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
628                return ret;
629
630        int count0 = 0;
631        struct splitstr* ret0 = NULL;
632        ret0 = strsplit(link, ";", &count0);
633        if(ret0 != NULL && count0 >= 3)
634        {
635                url = ostrcat(url, ret0[0].part, 1, 0);
636                debug(99, "url: %s", url);
637
638                session = ostrcat(session, ret0[1].part, 1, 0);
639                debug(99, "Season: %s", session);
640
641                episode = ostrcat(episode, ret0[2].part, 1, 0);
642                debug(99, "episode: %s", episode);
643
644                searchname = ostrcat(searchname, ret0[0].part, 1, 0);
645                searchname = string_replace("http://kinox.to//Stream/", "", searchname, 0);
646                searchname = string_replace("http://kinox.to/Stream/", "", searchname, 0);
647                searchname = string_replace(".html", "", searchname, 0);
648                debug(99, "searchname: %s", searchname);
649        }
650        free(ret0), ret0 = NULL;
651
652        ip = string_replace("http://", "", url, 0);
653
654        if(ip != NULL)
655                pos = strchr(ip, '/');
656        if(pos != NULL)
657        {
658                pos[0] = '\0';
659                path = pos + 1;
660        }
661
662        tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
663
664        if(tmpstr != NULL)
665        {
666                drawscreen(load, 0, 0);
667               
668                seriesid = string_resub("SeriesID=", "\"", tmpstr, 0);
669                debug(99, "seriesid: %s", seriesid);
670                       
671                pathnew = ostrcat("/aGET/MirrorByEpisode/&?Addr=", searchname, 0, 0);
672                pathnew = ostrcat(pathnew, "&SeriesID=", 1, 0);
673                pathnew = ostrcat(pathnew, seriesid, 1, 0);
674                pathnew = ostrcat(pathnew, "&Season=", 1, 0);
675                pathnew = ostrcat(pathnew, session, 1, 0);
676                pathnew = ostrcat(pathnew, "&Episode=", 1, 0);
677                pathnew = ostrcat(pathnew, episode, 1, 0);
678                debug(99, "pathnew: %s", pathnew);
679       
680                free(tmpstr), tmpstr = NULL;
681                tmpstr = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
682                free(pathnew), pathnew = NULL;
683       
684                if(tmpstr != NULL)
685                {
686                        tmpstr = string_resub("<ul id=\"HosterList\" class=\"Sortable\">", "</ul>", tmpstr, 0);
687               
688                        int type = 14;
689                        int count = 0;
690                        int incount = 0;
691                        int i;
692                        struct splitstr* ret1 = NULL;
693                        ret1 = strsplit(tmpstr, "\n", &count);
694               
695                        char* hname = NULL;
696                        char* hnr = NULL;
697                        char* hlink = NULL;
698                       
699                        if(ret1 != NULL && count > 0)
700                        {
701                                int max = count;
702                                for(i = 0; i < max; i++)
703                                {
704                                        hnr = string_resub("<li id=\"Hoster_", "\"", ret1[i].part, 0);
705                                        hlink = string_resub("rel=\"", "\">", ret1[i].part, 0);
706                                        hlink = string_replace_all("amp;", "", hlink, 1);
707                                        hname = string_resub("<div class=\"Named\">", "</div>", ret1[i].part, 0);
708
709                                        pichname = ostrcat(hname, NULL, 0, 0);
710                                        string_tolower(pichname);
711                                        pichname = stringreplacecharonce(pichname, '.', '\0');
712
713                                        extra = string_resub("<b>Vom</b>: ", "</div>", ret1[i].part, 0);
714                       
715                                        hlink = string_replace("http://kinox.to//Stream/", "", hlink, 1);                                       
716                                        hlink = string_replace("http://kinox.to/Stream/", "", hlink, 1);
717                                                                               
718                                        pathnew = ostrcat("/aGET/Mirror/", hlink, 0, 0);
719                                        debug(99, "pathnew: %s", pathnew);
720       
721                                        tmpstr1 = gethttp("kinox.to", pathnew, 80, NULL, NULL, 10000, NULL, 0);
722                                        tmpstr1 = string_replace_all("\\", "", tmpstr1, 1);
723                                        tmpstr1 = string_resub("<a href=\"", "\"", tmpstr1, 0);
724       
725                                        url = ostrcat(tmpstr1, NULL, 0, 0);
726
727                                        type = 14;
728
729                                        debug(99, "-------------------------------");
730                                        debug(99, "(%d/%d) %s url: %s extra: %s",i ,max , hname, url, extra);
731                                                       
732                                        incount += 1;
733                                        line = ostrcat(line, hname, 1, 0);
734                                        if(extra != NULL)
735                                        {
736                                                line = ostrcat(line, " (", 1, 0);                                       
737                                                line = ostrcat(line, extra, 1, 0);                                     
738                                                line = ostrcat(line, ")", 1, 0);                                       
739                                        }
740                                        line = ostrcat(line, "#", 1, 0);
741                                        line = ostrcat(line, url, 1, 0);
742                                        line = ostrcat(line, "#", 1, 0);
743                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
744                                        line = ostrcat(line, pichname, 1, 0);
745                                        line = ostrcat(line, ".jpg#kinox_", 1, 0);
746                                        line = ostrcat(line, pichname, 1, 0);
747                                        line = ostrcat(line, ".jpg#KinoX - ", 1, 0);
748                                        line = ostrcat(line, title, 1, 0);
749                                        line = ostrcat(line, "#", 1, 0);
750                                        line = ostrcat(line, oitoa(type), 1, 0);
751                                        line = ostrcat(line, "\n", 1, 0);
752
753                                        free(tmpstr1), tmpstr1 = NULL;                                                 
754                                        free(tmpstr2), tmpstr2 = NULL;                                 
755                                        free(hname), hname = NULL;
756                                        free(hnr), hnr = NULL;
757                                        free(hlink), hlink = NULL;                                                                             
758                                        free(url), url = NULL; 
759                                        free(pathnew), pathnew = NULL;
760                                        free(pichname), pichname = NULL;
761                                        free(extra), extra = NULL;
762                                }
763                        }
764                        free(ret1), ret1 = NULL;
765                }
766        }
767
768        free(tmpstr), tmpstr = NULL;   
769        if(line != NULL)
770        {
771                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
772                tmpstr = ostrcat("/tmp/tithek/kinox.hoster.series.", oitoa(time(NULL)), 0, 1);
773                tmpstr = ostrcat(tmpstr, ".list", 1, 0);
774                       
775                writesys(tmpstr, line, 0);
776
777                titheklog(debuglevel, "/tmp/kinox9_line", NULL, line);
778
779                struct tithek* tnode = (struct tithek*)listbox->select->handle;
780                createtithek(tnode, tnode->title,  tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
781                ret = 0;
782        }
783
784        return ret;
785}
786
787int kinox_search_cast(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr)
788{
789        int ret = 1;
790
791        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
792                return ret;
793
794        char* search = NULL;
795        if(searchstr == NULL)
796                search = textinputhist(_("Search"), " ", "searchhist");
797        else
798                search = textinputhist(_("Search"), searchstr, "searchhist");
799       
800        if(search != NULL)
801        {
802                drawscreen(load, 0, 0);
803                search = strstrip(search);
804                search = stringreplacechar(search, ' ', '+');
805                debug(99, "search: %s", search);
806
807                char* tmpstr = NULL;
808                char* tmpstr1 = NULL;
809                char* ip = NULL;
810                char* path = NULL;
811
812                char* line = NULL;
813                char* menu = NULL;
814
815                ip = ostrcat("www.imdb.com", NULL, 0, 0);
816                path = ostrcat("find?q=", search, 0, 0);
817                path = ostrcat(path, "&s=nm", 1, 0);
818
819                tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
820                writesys("/var/usr/local/share/titan/plugins/tithek/kinox_cast_tmpstr", tmpstr, 0);
821                tmpstr = string_replace_all("<td class=\"primary_photo\"> <a href=\"/name/", "\nfound=\"", tmpstr, 1);
822                writesys("/var/usr/local/share/titan/plugins/tithek/kinox_cast_tmpstr2", tmpstr, 0);
823
824                tmpstr1 = string_resub("<table class=\"findList\">", "</div>", tmpstr, 0);
825                writesys("/var/usr/local/share/titan/plugins/tithek/kinox_cast_tmpstr3", tmpstr1, 0);
826                                free(tmpstr), tmpstr = NULL;
827
828                int count = 0;
829                int incount = 0;
830                int i;
831                struct splitstr* ret1 = NULL;
832                ret1 = strsplit(tmpstr1, "\n", &count);
833       
834                char* url = NULL;
835                char* pic = NULL;
836                char* name = NULL;
837               
838                if(ret1 != NULL && count > 0)
839                {
840                        int max = count;
841                        for(i = 0; i < max; i++)
842                        {
843                                url = string_resub("found=\"", "/", ret1[i].part, 0);
844                                pic = string_resub("<img src=\"", "\"", ret1[i].part, 0);
845
846                                tmpstr = string_resub("found=\"", "<small>", ret1[i].part, 0);
847//                              name = oregex(".*<a href=\"/name/nm.*\ >(.*)</a>", tmpstr);
848                                name = oregex(".*<a href=\"/name/nm.* >(.*)</a>", tmpstr);
849
850                                debug(99, "(%d/%d) name: %s url: %s pic: %s\n",i, count, name, url, pic);
851                                debug(99, "-------------------------------");
852                                                                       
853                                pic = string_replace_all(",", "%2C", pic, 1);
854
855                                if(url != NULL)
856                                {
857                                        incount++;
858                                        line = ostrcat(line, name, 1, 0);
859                                        line = ostrcat(line, "#http://kinox.to/People/", 1, 0);
860                                        line = ostrcat(line, url, 1, 0);
861                                        line = ostrcat(line, "#", 1, 0);
862                                        line = ostrcat(line, pic, 1, 0);
863                                        line = ostrcat(line, "#kinox_search_", 1, 0);
864                                        line = ostrcat(line, oitoa(incount + time(NULL)), 1, 1);
865                                        line = ostrcat(line, ".jpg#KinoX - Cast Search#32\n", 1, 0);
866                                }
867                               
868                                free(url), url = NULL;
869                                free(pic), pic = NULL;
870                                free(name), name = NULL;                               
871                                free(tmpstr), tmpstr = NULL;
872                        }
873
874                        free(ret1), ret1 = NULL;
875                        if(line != NULL)
876                        {
877                                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
878                                menu = ostrcat("/tmp/tithek/kinox.search.cast.", oitoa(time(NULL)), 0, 1);
879                                menu = ostrcat(menu, ".list", 1, 0);
880                       
881                                writesys(menu, line, 0);
882                                struct tithek* tnode = (struct tithek*)listbox->select->handle;
883                                createtithek(tnode, tnode->title,  menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
884                                ret = 0;
885                        }
886
887                }
888                free(tmpstr), tmpstr = NULL;
889                free(ip), ip = NULL;
890        }
891        free(search), search = NULL;
892        return ret;
893}
894
895#endif
Note: See TracBrowser for help on using the repository browser.