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

Last change on this file since 36944 was 36944, checked in by obi, 8 years ago

fix

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