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

Last change on this file since 24237 was 24237, checked in by nit, 10 years ago

optimize

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