source: titan/plugins/tithek/solarmovie.h @ 36059

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

fix solar

File size: 20.3 KB
Line 
1#ifndef SOLARMOVIE_H
2#define SOLARMOVIE_H
3
4char* solarmovie(char* link)
5{
6        debug(99, "link: %s", link);
7        char* tmpstr = NULL, *tmpstr1 = NULL, *pos = NULL, *url = NULL, *streamurl = NULL, *tmphost = NULL, *tmppath = NULL;
8        char* error = NULL;
9
10        if(link == NULL || ostrncmp("http://", link, 7)) return NULL;
11
12        tmphost = string_replace("http://", "", (char*)link, 0);
13
14        if(tmphost != NULL)
15                pos = strchr(tmphost, '/');
16        if(pos != NULL)
17        {
18                pos[0] = '\0';
19                tmppath = pos + 1;
20        }
21       
22        char* send = ostrcat("GET /", NULL, 0, 0);
23        send = ostrcat(send, tmppath, 1, 0);
24        send = ostrcat(send, " HTTP/1.1\r\nHost: ", 1, 0);
25        send = ostrcat(send, tmphost, 1, 0);
26        send = ostrcat(send, "\r\nUser-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.99 Safari/535.1\r\nConnection: close\r\nAccept-Encoding: gzip\r\n\r\n", 1, 0);
27        debug(99, "send: %s", send);
28
29// ssl workaround
30        unlink("/tmp/.solar.cache");
31        char* cmd = NULL;
32        cmd = ostrcat("wget --no-check-certificate \"http://", tmphost, 0, 0);
33        cmd = ostrcat(cmd, "/", 1, 0);
34        cmd = ostrcat(cmd, tmppath, 1, 0);
35        cmd = ostrcat(cmd, "\" -O /tmp/.solar.cache", 1, 0);
36        debug(99, "cmd: %s", cmd);
37        system(cmd);
38        free(cmd), cmd = NULL;
39        tmpstr = command("cat /tmp/.solar.cache");
40        debug(99, "tmpstr: %s", tmpstr);
41// ssl workaround end
42//      tmpstr = gethttpreal(tmphost, tmppath, 80, NULL, NULL, NULL, 0, send, NULL, 5000, 0);
43        debug(99, "tmpstr: %s", tmpstr);
44        free(send); send = NULL;
45
46        if(tmpstr == NULL)
47        {
48                textbox(_("Message"), _("The page is temporarily unavailable") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
49                goto end;
50        }
51
52        if(ostrstr(tmpstr, "<h2>404</h2>") != NULL)
53        {
54                error = string_resub("<strong>", "</strong>", tmpstr, 0);
55                string_deltags(error);
56                stringreplacechar(error, '|', '\0');
57                error = strstrip(error);
58                if(error == NULL || strlen(error) == 0)
59                        error = ostrcat(_("The page is temporarily unavailable"), error, 0, 1);
60                textbox(_("Message"), error, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 400, 0, 0);
61                goto end;
62        }
63           
64        string_strip_whitechars(tmpstr);
65
66
67        tmpstr1 = string_resub("<iframe name=\"service_frame\" class=\"service_frame\"", "</iframe>", tmpstr, 0);
68printf("tmpstr1: %s\n",tmpstr1);
69
70        url = string_resub("src=\"", "\"", tmpstr1, 0);
71printf("url: %s\n",url);
72
73        free(tmpstr1), tmpstr1 = NULL;
74
75//      if(ostrncmp("http://", url, 7) == 0)
76        if(url == NULL)
77        {
78                free(url), url = NULL;
79
80                if(ostrstr(tmpstr, "<div class=\"thirdPartyEmbContainer\"") != NULL)
81                {
82                        tmpstr1 = string_resub("<div class=\"thirdPartyEmbContainer\"", "</div>", tmpstr, 0);
83                        stringreplacechar(tmpstr1, '\n', ' ');
84       
85                        url = oregex(".*(http://.*).*\"", tmpstr1);
86                        stringreplacechar(url, '"', '\0');
87       
88                        if(url == NULL)
89                                url = string_resub("<center><iframe src=\"", "\"", tmpstr1, 0);
90                        if(url == NULL)
91                                url = string_resub("<center><IFRAME SRC=\"", "\"", tmpstr1, 0);
92       
93                        if(url == NULL || ostrncmp("http://", url, 7) == 1)
94                        {
95                                free(url); url = NULL;
96                                url = oregex(".*src=\"(http://.*)&width.*", tmpstr1);
97                        }
98                }
99                else
100                {
101                        //char* tmpurl = oregex(".*<iframe name=\"service_frame\" class=\"service_frame\" src=\"(http://.*)\".*", tmpstr);
102                        //url = oregex("(http://.*)\".*", tmpurl);
103                        //free(tmpurl); tmpurl == NULL;
104                        url = string_resub("<iframe name=\"service_frame\" class=\"service_frame\" src=\"", "\"", tmpstr, 0);
105                        url = string_replace_all("embed", "file", url, 1);
106                }
107        }
108
109        debug(99, "url: %s", url);
110        streamurl = hoster(url);
111
112end:
113
114        free(error), error = NULL;
115        free(url), url = NULL;
116        free(tmpstr), tmpstr = NULL;
117        free(tmpstr1), tmpstr1 = NULL;
118        free(tmphost), tmphost = NULL;
119//      free(tmppath), tmppath = NULL;
120
121        return streamurl;
122}
123
124int solarmovie_search(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag)
125{
126        int debuglevel = getconfigint("debuglevel", NULL);
127        int ret = 1;
128        int incount = 0;
129               
130        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
131                return ret;
132
133        char* search = NULL;
134        if(searchstr == NULL)
135                search = textinputhist(_("Search"), " ", "searchhist");
136        else
137                search = textinputhist(_("Search"), searchstr, "searchhist");
138       
139        if(search != NULL)
140        {
141                drawscreen(load, 0, 0);
142                char* tmpstr = NULL;
143                char* tmpstr1 = NULL;
144                char* line = NULL;
145                char* pic = NULL;
146                char* title = NULL;
147                char* url = NULL;
148                char* ip = NULL;
149                char* path = NULL;
150                char* menu = NULL;
151                char* file = NULL;
152                char* file1 = NULL;
153                search = strstrip(search);
154                search = stringreplacechar(search, ' ', '+');
155                debug(99, "search: %s", search);
156
157                ip = ostrcat("www.solarmovie.ph", NULL, 0, 0);
158                if(flag == 0)
159                        path = ostrcat("movie/search/", search, 0, 0);
160                else
161                        path = ostrcat("tv/search/", search, 0, 0);
162
163// ssl workaround
164                unlink("/tmp/.solar.cache");
165                char* cmd = NULL;
166                cmd = ostrcat("wget --no-check-certificate \"http://", ip, 0, 0);
167                cmd = ostrcat(cmd, "/", 1, 0);
168                cmd = ostrcat(cmd, path, 1, 0);
169                cmd = ostrcat(cmd, "\" -O /tmp/.solar.cache", 1, 0);
170                debug(99, "cmd: %s", cmd);
171                system(cmd);
172                free(cmd), cmd = NULL;
173                tmpstr = command("cat /tmp/.solar.cache");
174                debug(99, "tmpstr: %s", tmpstr);
175// ssl workaround end
176
177//              tmpstr = gethttp(ip, path, 80, NULL, NULL, 10000, NULL, 0);
178                titheklog(debuglevel, "/tmp/solarmovie_tmpstr", NULL, NULL, NULL, tmpstr);
179
180                while(ostrstr(tmpstr, "<div class=\"typicalGrey coverGroup\">") != NULL)
181                {
182                        int rcret = waitrc(NULL, 10, 0);
183                        if(rcret == getrcconfigint("rcexit", NULL)) break;
184
185                        incount += 1;
186                        if(debuglevel == 99)
187                        {
188                                file = ostrcat("/tmp/solarmovie_tmpstr", oitoa(incount), 0, 1);
189                                writesys(file, tmpstr, 0);
190                        }
191                               
192                        tmpstr1 = string_resub("<div class=\"typicalGrey coverGroup\">", "</div>", tmpstr, 0);
193
194                        if(debuglevel == 99)
195                        {
196                                file1 = ostrcat("/tmp/solarmovie_tmpstr_resub", oitoa(incount), 0, 1);
197                                writesys(file1, tmpstr1, 0);
198                        }
199
200                        path = string_resub("href=\"", "\"", tmpstr1, 0);
201                        pic = string_resub("<img src=\"", "\"", tmpstr1, 0);
202                        title = string_resub("<a title=\"", "\"", tmpstr1, 0);
203       
204                        url = ostrcat("http://www.solarmovie.ph", path, 0, 0);
205       
206                        debug(99, "---------------------------");
207                        debug(99, "pic: %s", pic);
208                        debug(99, "title: %s", title);
209                        debug(99, "url: %s", url);                                     
210                        debug(99, "---------------------------");
211       
212                        if(url != NULL)
213                        {
214                                line = ostrcat(line, title, 1, 0);
215                                line = ostrcat(line, "#", 1, 0);
216                                line = ostrcat(line, url, 1, 0);
217                                line = ostrcat(line, "#", 1, 0);
218                                line = ostrcat(line, pic, 1, 0);
219                                line = ostrcat(line, "#solarmovie_search_", 1, 0);
220                                line = ostrcat(line, oitoa(incount + time(NULL)), 1, 0);
221                                line = ostrcat(line, ".jpg#SolarMovie - Search#28\n", 1, 0);
222                        }
223                        free(url), url = NULL;
224                        free(path), path = NULL;
225                        free(title), title = NULL;
226                        free(pic), pic = NULL;         
227                        free(file), file = NULL;
228                        free(file1), file1 = NULL;
229
230                        tmpstr = string_replace("typicalGrey coverGroup", "", tmpstr, 1);
231                        free(tmpstr1), tmpstr1 = NULL;
232                }
233
234                if(line != NULL)
235                {
236                        line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
237                        menu = ostrcat("/tmp/tithek/solarmovie.search.list", NULL, 0, 0);
238                        writesys(menu, line, 0);
239                        free(line); line = NULL;
240                       
241                        struct tithek* tnode = (struct tithek*)listbox->select->handle;
242                        createtithek(tnode, tnode->title,  menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
243                        ret = 0;
244                }
245
246                free(tmpstr), tmpstr = NULL;
247                free(ip), ip = NULL;
248        }
249        free(search), search = NULL;
250        return ret;
251}
252
253int solarmovie_search_local(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title, char* searchstr, int flag)
254{
255        char* tmpstr = NULL, *tmpstr1 = NULL, *line = NULL, *menu = NULL, *search = NULL;
256        int ret = 1, count = 0, i = 0;
257
258        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
259                return ret;
260
261        if(searchstr == NULL)
262                search = textinputhist(_("Search"), " ", "searchhist");
263        else
264                search = textinputhist(_("Search"), searchstr, "searchhist");
265
266        if(search != NULL)
267        {
268                drawscreen(load, 0, 0);
269
270                strstrip(search);
271                string_tolower(search);
272
273                tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/solarmovie/streams/solarmovie.all-sorted.list", 80, NULL, HTTPAUTH, 5000, NULL, 0);
274
275                struct splitstr* ret1 = NULL;
276                ret1 = strsplit(tmpstr, "\n", &count);
277
278                if(ret1 != NULL)
279                {
280                        int max = count;
281                        for(i = 0; i < max; i++)
282                        {
283                       
284                                tmpstr1 = ostrcat(ret1[i].part, NULL, 0, 0);
285                                tmpstr1 = stringreplacecharonce(tmpstr1, '#', '\0');
286                                string_tolower(tmpstr1);
287
288                                if(ostrstr(tmpstr1, search) != NULL)
289                                {
290                                        printf("found: %s\n", ret1[i].part);
291                                        int rcret = waitrc(NULL, 10, 0);
292                                        if(rcret == getrcconfigint("rcexit", NULL)) break;
293
294                                        line = ostrcat(line, ret1[i].part, 1, 0);
295                                        line = ostrcat(line, "\n", 0, 0);
296                                }
297                                free(tmpstr1), tmpstr1 = NULL;                         
298                        }
299                        free(ret1), ret1 = NULL;
300
301                        if(line != NULL)
302                        {
303                                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
304                                menu = ostrcat("/tmp/tithek/solarmovie.search.list", NULL, 0, 0);
305                                writesys(menu, line, 0);
306                                struct tithek* tnode = (struct tithek*)listbox->select->handle;
307                                createtithek(tnode, tnode->title, menu, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
308                                ret = 0;
309                        }
310                }
311                free(tmpstr), tmpstr = NULL;
312        }
313        free(search), search = NULL;
314        return ret;
315}
316
317int solarmovie_hoster(struct skin* grid, struct skin* listbox, struct skin* countlabel, struct skin* load, char* link, char* title)
318{
319        debug(99, "link: %s", link);
320        int debuglevel = getconfigint("debuglevel", NULL);
321        int ret = 1, series = 0;
322        char* pos = NULL, *etitle = NULL, *episode = NULL, *session = NULL, *update = NULL, *quality = NULL, *id = NULL, *line = NULL, *hname = NULL, *tmpstr = NULL, *url = NULL, *tmphost = NULL, *tmphname = NULL;
323//      char* tmpstr1 = NULL;
324        char* pichname = NULL, *tmppath = NULL;
325        unlink("/tmp/tithek/get");
326        unlink("/tmp/tithek/get_zcat");
327        unlink("/tmp/tithek/get_zcat1");
328
329        if(listbox == NULL || listbox->select == NULL || listbox->select->handle == NULL)
330                return ret;
331
332        drawscreen(load, 0, 0);
333
334        tmphost = string_replace("http://", "", (char*)link, 0);
335
336        if(tmphost != NULL)
337                pos = strchr(tmphost, '/');
338        if(pos != NULL)
339        {
340                pos[0] = '\0';
341                tmppath = pos + 1;
342        }
343
344// ssl workaround
345        unlink("/tmp/.solar.cache");
346        char* cmd = NULL;
347        cmd = ostrcat("wget --no-check-certificate http://", tmphost, 0, 0);
348        cmd = ostrcat(cmd, "/", 1, 0);
349        cmd = ostrcat(cmd, tmppath, 1, 0);
350        cmd = ostrcat(cmd, " -O /tmp/.solar.cache", 1, 0);
351        debug(99, "cmd: %s", cmd);
352        system(cmd);
353        free(cmd), cmd = NULL;
354        tmpstr = command("cat /tmp/.solar.cache");
355        debug(99, "tmpstr: %s", tmpstr);
356// ssl workaround end
357
358//      tmpstr = gethttp(tmphost, tmppath, 80, NULL, NULL, 10000, NULL, 0);
359       
360        if(tmpstr == NULL)
361        {
362                textbox(_("Message"), _("This file doesn't exist, or has been removed") , _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1200, 200, 0, 0);
363                goto end;
364        }
365//      if(debuglevel == 99) system("cp -a /tmp/tithek/get /tmp/solarmovie1_tmpstr_get");
366
367//      tmpstr = command("cat /tmp/tithek/get");
368/*
369        if(ostrstr(tmpstr, "<!DOCTYPE") == NULL)
370        {
371                cmd = ostrcat(cmd, "cat /tmp/tithek/get | zcat", 1, 0);
372                debug(99, "cmd: %s", cmd);
373                free(tmpstr), tmpstr = NULL;
374                tmpstr = command(cmd);
375               
376                writesys("/tmp/tithek/get_zcat", tmpstr, 0);
377                free(cmd), cmd = NULL;
378        }
379//      else
380//              system("cp -a /tmp/tithek/get /tmp/tithek/get_zcat");
381*/
382
383writesys("/tmp/tithek/get_zcat", tmpstr, 0);
384
385
386
387        titheklog(debuglevel, "/tmp/solarmovie2_tmpstr_zcat", NULL, NULL, NULL, tmpstr);
388
389        if(ostrstr(link, "/tv/") != NULL && ostrstr(link, "/season-") == NULL && ostrstr(link, "/episode-") == NULL)   
390                series = 1;
391        else
392                series = 0;
393
394printf("series: %d\n", series);
395
396        if(series == 0)
397        {
398printf("11111111111111111111111111111\n");
399                series = 0;
400                if(tmpstr != NULL)
401                {
402//                      free(tmpstr), tmpstr = NULL;
403//                      tmpstr = command("cat /tmp/tithek/get_zcat");
404                        char* tmpcat = string_resub("<tbody>", "</tbody>", tmpstr, 0);
405//new
406                        stringreplacechar(tmpcat, '\n', ' ');
407                        string_strip_whitechars(tmpcat);
408                        tmpcat = string_replace_all("td class=\"qualit", "\ntd class=\"qualit", tmpcat, 1);
409//end
410                        int count = 0;
411                        struct splitstr* ret1 = NULL;
412                        ret1 = strsplit(tmpcat, "\n", &count);
413                        int max = count;
414                        int i = 0, incount = 0;
415                        for(i = 0; i < max; i++)
416                        {
417                                debug(99, "ret1[i].part: %s", ret1[i].part);
418
419                                id = string_resub("/link/show/", "/", ret1[i].part, 0);
420                                debug(99, "id: %s", id);
421
422                                if(id == NULL) continue;
423
424                                quality = string_resub("qualityCell js-link-format\" style=\"text-transform: uppercase;\">", "</td>", ret1[i].part, 0);
425                                update = string_resub("oddCell\" style=\"color: #59636a;\">", "</td>", ret1[i].part, 0);
426                                string_remove_whitechars(quality);
427                                strstrip(quality);
428 
429                                tmphname = oregex(".*<a href=\"/link/show/.*> (.*) </a>.*", ret1[i].part);
430                                debug(99, "tmphname: %s", tmphname);
431                                   
432                                string_remove_whitechars(tmphname);
433                                strstrip(tmphname);
434
435                                pichname = ostrcat(tmphname, NULL, 0, 0);
436                                string_tolower(pichname);
437                                pichname = stringreplacecharonce(pichname, '.', '\0');
438
439                                int type = 43;
440                                debug(99, "(%d/%d) %s id: %s quality: %s update: %s pic: %s", i, max, tmphname, id, quality, update, pichname);
441
442                                incount += 1;
443                                line = ostrcat(line, tmphname, 1, 0);
444                                if(quality != NULL)
445                                {
446                                        line = ostrcat(line, " (", 1, 0);                                       
447                                        line = ostrcat(line, quality, 1, 0);                                   
448                                        line = ostrcat(line, ")", 1, 0);                                       
449                                }
450                                if(update != NULL)
451                                {
452                                        line = ostrcat(line, " (", 1, 0);                                       
453                                        line = ostrcat(line, update, 1, 0);                                     
454                                        line = ostrcat(line, ")", 1, 0);                                       
455                                }                                       
456                                line = ostrcat(line, "#", 1, 0);
457                                line = ostrcat(line, "http://www.solarmovie.ph/link/play/", 1, 0);
458                                line = ostrcat(line, id, 1, 0);
459                                line = ostrcat(line, "#", 1, 0);
460                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
461                                line = ostrcat(line, pichname, 1, 0);
462                                line = ostrcat(line, ".jpg#solarmovie_", 1, 0);
463                                line = ostrcat(line, pichname, 1, 0);
464                                line = ostrcat(line, ".jpg#Solarmovie - ", 1, 0);
465                                line = ostrcat(line, title, 1, 0);
466                                line = ostrcat(line, "#", 1, 0);
467                                line = ostrcat(line, oitoa(type), 1, 0);
468                                line = ostrcat(line, "\n", 1, 0);
469                                free(hname), hname = NULL;
470                                                       
471                                free(pichname), pichname = NULL;               
472                                free(tmphname), tmphname = NULL;
473                                free(id), id = NULL;
474                                free(quality), quality = NULL;
475                                free(update), update = NULL;
476
477                                debug(99, "#######################################################");
478                        }
479                               
480/*
481//                      string_strip_whitechars(tmpstr);
482                        writesys("/var/usr/local/share/titan/plugins/tithek/1solarmovie8_tmpcat", tmpcat, 0);
483       
484                        char* ptmpcat = ostrstr(tmpcat, "<td class=\"qualit");
485                        writesys("/var/usr/local/share/titan/plugins/tithek/1solarmovie8_ptmpcat", ptmpcat, 0);
486
487                        int i = 0, incount = 0;
488                        while(ptmpcat != NULL)
489                        {
490                                i++;
491                                tmpstr1 = ostrcat(tmpstr1, string_resub("<td class=\"qualit", "<div class=\"linkDetails\">", ptmpcat, 0), 1, 1);
492                        writesys("/var/usr/local/share/titan/plugins/tithek/1solarmovie8_tmpstr1", tmpstr1, 0);
493//return;
494                                ptmpcat += 5;
495                                ptmpcat = ostrstr(ptmpcat, "<td class=\"qualit");
496       
497                                if(ptmpcat != NULL)
498                                {
499                                        char* tmpid = oregex(".*<a href=\"/link/(.*)/.*", tmpstr1);
500//                                      debug(99, "tmpid: %s", tmpid);
501                                        id = string_resub("show/", "/", tmpid, 0);
502                                        free(tmpid), tmpid = NULL;
503//                                      debug(99, "id: %s", id);
504//                                      debug(99, "#######################################################");
505
506
507                                        quality = string_resub("yCell\">", "</td>", tmpstr1, 0);
508                                        update = string_resub("oddCell\">", "</td>", tmpstr1, 0);
509                                        string_remove_whitechars(quality);
510                                        strstrip(quality);
511                                       
512                                        tmphname = oregex(".*<a href=\"/link/show/.*\">(.*)</a>.*", tmpstr1);
513
514                                        string_remove_whitechars(tmphname);
515                                        strstrip(tmphname);
516
517                                        pichname = ostrcat(tmphname, NULL, 0, 0);
518                                        string_tolower(pichname);
519                                        pichname = stringreplacecharonce(pichname, '.', '\0');
520
521                                        int type = 43;
522                                        debug(99, "(%d/\?\?) %s id: %s quality: %s update: %s pic: %s", i, tmphname, id, quality, update, pichname);
523
524                                        incount += 1;
525                                        line = ostrcat(line, tmphname, 1, 0);
526                                        if(quality != NULL)
527                                        {
528                                                line = ostrcat(line, " (", 1, 0);                                       
529                                                line = ostrcat(line, quality, 1, 0);                                   
530                                                line = ostrcat(line, ")", 1, 0);                                       
531                                        }
532                                        if(update != NULL)
533                                        {
534                                                line = ostrcat(line, " (", 1, 0);                                       
535                                                line = ostrcat(line, update, 1, 0);                                     
536                                                line = ostrcat(line, ")", 1, 0);                                       
537                                        }                                       
538                                        line = ostrcat(line, "#", 1, 0);
539                                        line = ostrcat(line, "http://www.solarmovie.ph/link/play/", 1, 0);
540                                        line = ostrcat(line, id, 1, 0);
541                                        line = ostrcat(line, "#", 1, 0);
542                                        line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/", 1, 0);
543                                        line = ostrcat(line, pichname, 1, 0);
544                                        line = ostrcat(line, ".jpg#solarmovie_", 1, 0);
545                                        line = ostrcat(line, pichname, 1, 0);
546                                        line = ostrcat(line, ".jpg#Solarmovie - ", 1, 0);
547                                        line = ostrcat(line, title, 1, 0);
548                                        line = ostrcat(line, "#", 1, 0);
549                                        line = ostrcat(line, oitoa(type), 1, 0);
550                                        line = ostrcat(line, "\n", 1, 0);
551                                        free(hname), hname = NULL;
552                                                               
553                                        free(pichname), pichname = NULL;               
554                                        free(tmphname), tmphname = NULL;
555                                        free(id), id = NULL;           
556                                }
557                        }
558*/
559                        free(tmpcat); tmpcat = NULL;
560                }       
561        }
562        else
563        {
564printf("22222222222222222222222222222222\n");
565       
566                series = 1;
567                if(tmpstr != NULL)
568                {
569//writesys("/tmp/tithek/get_zcat", tmpstr, 0);
570
571                        free(tmpstr), tmpstr = NULL;
572                        tmpstr = command("cat /tmp/tithek/get_zcat | grep episode- | grep -v Episode | grep -v 'linkCount typicalGrey'");
573                        writesys("/var/usr/local/share/titan/plugins/tithek/solarmovie8_tmpstr", tmpstr, 0);
574
575                        int count = 0;
576                        struct splitstr* ret1 = NULL;
577                        ret1 = strsplit(tmpstr, "\n", &count);
578                        int max = count;
579                        int i = 0, incount = 0;
580                        for(i = 0; i < max; i++)
581                        {
582//<a href="/tv/avatar-the-last-airbender-2005/season-3/episode-2/">The Headband</a>
583                                session = oregex(".*/season-([0-9]{1,2})/episode-.*", ret1[i].part);
584                                episode = oregex(".*/episode-([0-9]{1,2})/.*", ret1[i].part);
585                                etitle = oregex(".*>(.*)<.*", ret1[i].part);
586                                url = string_resub("\"", "\"", ret1[i].part, 0);
587
588                                incount += 1;
589                                line = ostrcat(line, _("Season"), 1, 0);
590                                line = ostrcat(line, " ", 1, 0);
591                                line = ostrcat(line, session, 1, 0);
592                                line = ostrcat(line, " ", 1, 0);
593                                line = ostrcat(line, _("Episode"), 1, 0);
594                                line = ostrcat(line, " ", 1, 0);
595                                line = ostrcat(line, episode, 1, 0);
596
597//                              line = ostrcat(line, "(s", 1, 0);
598//                              line = ostrcat(line, session, 1, 0);
599//                              line = ostrcat(line, "e", 1, 0);
600//                              line = ostrcat(line, episode, 1, 0);
601//                              line = ostrcat(line, ") ", 1, 0);
602//                              line = ostrcat(line, etitle, 1, 0);
603
604                                line = ostrcat(line, "#http://www.solarmovie.ph", 1, 0);
605                                line = ostrcat(line, url, 1, 0);
606//                              line = ostrcat(line, ";", 1, 0);
607//                              line = ostrcat(line, session, 1, 0);
608//                              line = ostrcat(line, ";", 1, 0);
609//                              line = ostrcat(line, episode, 1, 0);
610                                line = ostrcat(line, "#", 1, 0);
611                                line = ostrcat(line, "http://atemio.dyndns.tv/mediathek/menu/s", 1, 0);
612                                line = ostrcat(line, session, 1, 0);
613                                line = ostrcat(line, "e", 1, 0);
614                                line = ostrcat(line, episode, 1, 0);
615                                line = ostrcat(line, ".jpg", 1, 0);                                                                                                                             
616                                line = ostrcat(line, "#s", 1, 0);
617                                line = ostrcat(line, session, 1, 0);
618                                line = ostrcat(line, "e", 1, 0);
619                                line = ostrcat(line, episode, 1, 0);
620                                line = ostrcat(line, ".jpg#Solarmovie - ", 1, 0);
621                                line = ostrcat(line, title, 1, 0);
622                                line = ostrcat(line, "#28\n", 1, 0);
623                                free(session), session = NULL;
624                                free(episode), episode = NULL;
625                                free(url), url = NULL; 
626                                free(etitle), etitle = NULL;   
627                        }
628                }
629        }
630        free(tmpstr), tmpstr = NULL;
631
632        if(line != NULL)
633        {
634                line = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", line, 1);
635                if(series == 0)
636                        tmpstr = ostrcat("/tmp/tithek/solarmovie.hoster.list", NULL, 0, 0);
637                else
638                        tmpstr = ostrcat("/tmp/tithek/solarmovie.hoster.ser.list", NULL, 0, 0);
639                writesys(tmpstr, line, 0);
640
641                titheklog(debuglevel, "/tmp/solarmovie8_line", NULL, NULL, NULL, line);
642                free(line); line = NULL;
643                                       
644                struct tithek* tnode = (struct tithek*)listbox->select->handle;
645                createtithek(tnode, tnode->title,  tmpstr, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
646                ret = 0;
647        }
648end:
649        free(tmphost), tmphost = NULL;
650//      free(tmppath), tmppath = NULL;
651               
652        return ret;
653}
654#endif
Note: See TracBrowser for help on using the repository browser.