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

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

[tithek] add exit option on search modus

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