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

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

fix

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