source: titan/plugins/tithek/tithek.h @ 40848

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

fix

File size: 95.3 KB
Line 
1
2#ifndef TITHEK_H
3#define TITHEK_H
4
5#define TITHEKPATH "/tmp/tithek"
6int tithekdownloadrun = 0;
7int tithekdownloadcount = 0;
8int tithekrun = 0;
9int tithekexit = 0;
10int tithekmovie4k = 0;
11int tithekkinox = 0;
12int titheksolarmovie = 0;
13int tithekmlehd = 0;
14int amazonlogin = 0;
15int python = 0;
16
17//flag 0        - menu
18//flag 1        - menu pay hidden tithek_pay=0/1 0=hidden
19//flag 2        - http (default streamurl)
20//flag 3        - http radio
21//flag 4        - youtube
22//flag 5        - nowtv //rtl2now
23//flag 6        - nowtv pay //superrtlnow
24//flag 7        - nowtv local serach //rtlnow
25//flag 8        - nowtv search //voxnow
26//flag 9        - youtube suche 10
27//flag 10       - youtube suche 25
28//flag 11       - youtube suche 50
29//flag 12       - myvideo
30//flag 13       - myvideo search 50
31//flag 14       - kinox play
32//flag 15       - giga old: hoster filenuke
33//flag 16       - superrtlnow pay
34//flag 17       - rtlnow pay
35//flag 18       - voxnow pay
36//flag 19       - rtl2now pay
37//flag 20       - netstream old: hoster StreamCloud
38//flag 21       - kinox search
39//flag 22       - kinox hoster
40//flag 23       - kinox hoster serie
41//flag 24       - internetradio local serach
42//flag 25       - kinox local serach
43//flag 26       - movie4k local serach
44//flag 27       - solarmovie local serach
45//flag 28       - solarmovie hoster
46//flag 29       - solarmovie search movie
47//flag 30       - solarmovie search serie
48//flag 31       - kinox search cast
49//flag 32       - kinox search cast results
50//flag 33       - movie4k search : serie > open seasons and list episode flag=40 > hoster listed flag=34
51//flag 34       - movie4k hoster de
52//flag 35       - movie4k hoster other
53//flag 36       - movie4k series de > open seasons and list episode flag=39 > hoster listed flag=34
54//flag 37       - movie4k series other > open seasons and list episode flag=39 > hoster listed flag=34
55//flag 38       - mlehd
56//flag 39   - movie4k_hoster_listed
57//flag 40   - movie4k_hoster_series
58//flag 41   - movie4k
59//flag 42   - xvideos
60//flag 43       - solarmovie
61//flag 44       - myvideo Single charts
62//flag 45       - ard
63//flag 46       - ard
64//flag 47   - internettv local serach
65//flag 48   - youtube local serach
66//flag 49   - myvideo local serach
67//flag 50       - beeg
68//flag 51   - ard local serach
69//flag 52   - zdf local serach
70//flag 53   - tectime local serach
71//flag 54   - giga local serach
72//flag 55   - beeg local serach
73//flag 56   - rtl2now local serach
74//flag 57   - rtlnow local serach
75//flag 58   - superrtlnow local serach
76//flag 59   - voxnow local serach
77//flag 60   - xvideos local serach
78//flag 61   - mlehd local serach
79//flag 62   - netzkino local serach
80//flag 63   - filmon local serach
81//flag 64   - tvtoast
82//flag 65   - tvtoast local serach
83//flag 66   - coming soon dummy
84//flag 67   - rtlnitronow
85//flag 68   - rtlnitronow pay
86//flag 69   - rtlnitronow local search
87//flag 70   - ntvnow
88//flag 71   - ntvnow pay
89//flag 72   - ntvnow local search
90//flag 73   - watchmovies movie
91//flag 74   - watchmovies series
92//flag 75   - watchmovies local search
93//flag 75   - amazon
94//flag 76   - amazon movie search
95//flag 77   - amazon series search
96//flag 78   - amazon series listed search
97//flag 79   - amazon watchlist movie
98//flag 80   - amazon watchlist tv
99//flag 81   - amazon popularity.rank movie
100//flag 82   - amazon next page
101//flag 83   - amazon popularity.rank tv
102//flag 84   - amazon popularity.kids movie
103//flag 85   - amazon popularity.kids tv
104//flag 86   - amazon currently movie
105//flag 87   - amazon genre movie
106//flag 88   - amazon genre movie listed
107//flag 89   - amazon genre tv
108//flag 90   - amazon genre tv listed
109//flag 91   - streamlive
110//flag 92   - cricfree
111//flag 93   - liveonlinetv
112//flag 94   - movie2k 41 movie4k
113//flag 95       - movie2k 34 movie4k hoster de
114//flag 96       - movie2k 35 movie4k hoster other
115//flag 97   - movie2k 26 movie4k local serach
116//flag 98   - nbaondemand
117
118//flag 100  - all local search
119//flag 111  - local parser parser.sh hoster/play
120//flag 112  - local parser parser.sh search
121//flag 1000 - menu pincode
122//flag 9999 - menu hidden codecpack
123
124// redmenu
125//check 1       - screenbgdownload(1)
126//check 2       - Search on KinoX
127//check 8       - Search on KinoX (local)
128//check 3       - Search on Solarmovies (movie)
129//check 4       - Search on Solarmovies (serie)
130//check 9       - Search on Solarmovies (local)
131//check 5       - Search on Youtube
132//check 10  - Search on Youtube (local)
133//check 6       - Search on MyVideo
134//check 11  - Search on MyVideo (local)
135//check 7       - Search on Movie4k
136//check 12  - Search on Movie4k (local)
137//check 13  - Search on InternetRadio (local)
138//check 14  - Search on InternetTv (local)
139//check 15      - Search on ARD (local)
140//check 16      - Search on ZDF (local)"
141//check 17      - Search on TecTime (local)
142//check 18      - Search on Giga (local)
143//check 19      - Search on Beeg (local)
144//check 20      - Search on NowTv (local)
145//check 21      - Search on All (local)
146
147//check 24      - Search on Xvideos (local)
148//check 25      - Search on Mle-HD (local)
149//check 26      - Search on Netzkino (local)
150//check 27      - Search on FilmOn (local)
151
152//removed
153//check 20      - Search on Rtl2-Now (local)
154//check 21      - Search on Rtl-Now (local)
155//check 22      - Search on SuperRTL-Now (local)
156//check 23      - Search on VOX-Now (local)
157//check 28      - Search on RtlNitro-Now (local)
158//check 29      - Search on NTV-Now (local)
159
160struct tithek
161{
162        char* title;
163        char* link;
164        char* pic;
165        char* localname;
166        char* menutitle;
167        int flag;
168        struct tithek* prev;
169        struct tithek* next;
170};
171struct tithek *tithek = NULL;
172
173
174void freetithekcontent(struct tithek* node)
175{
176        if(node == NULL) return;
177
178        free(node->title); node->title = NULL;
179        node->link = NULL;
180        node->pic = NULL;
181        node->localname = NULL;
182        node->menutitle = NULL;
183        node->flag = 0;
184}
185
186int addtithekcontent(struct tithek* node, char *line, int len, int count, int pay)
187{
188        int ret = 0, i = 0, skip = 0, hid = 0, sos = 0;
189        char* tmpstr = NULL, *flag = NULL, *cmd = NULL, *tmp = NULL;
190        if(node == NULL) return 1;
191
192        if(len > 0) tmpstr = malloc(len + 1);
193        if(tmpstr != NULL)
194        {
195                memcpy(tmpstr, line, len);
196                tmpstr[len] = '\0';
197
198                node->title = tmpstr;
199
200                while(tmpstr[0] != '\0')
201                {
202                        if(tmpstr[0] == '#')
203                        {
204                                tmpstr[0] = '\0';
205                                tmpstr++;
206                                switch(ret)
207                                {
208                                        case 0: node->link = tmpstr; break;
209                                        case 1: node->pic = tmpstr; break;
210                                        case 2: node->localname = tmpstr; break;
211                                        case 3: node->menutitle = tmpstr; break;
212                                        case 4: flag = tmpstr; break;
213                                }
214
215                                ret++;
216                        }
217                        else
218                                tmpstr++;
219                }
220        }
221
222        if(ret != 5)
223        {
224                if(count > 0)
225                {
226                        err("tithek line %d not ok (ret=%d)", count, ret);
227                }
228                else
229                {
230                        err("add tithek (ret=%d)", ret);
231                }
232                freetithekcontent(node);
233                return 1;
234        }
235
236        if(flag != NULL) node->flag = atoi(flag);
237
238        sos = getconfigint("sos", NULL);
239        hid = getconfigint("tithek_hid_xxx", NULL);
240        if(node->flag == 1000 && hid == 1)
241                skip = 1;
242        else if((node->flag == 9996 || node->flag == 9997 || node->flag == 9998 || node->flag == 9999) && !file_exist("/mnt/swapextensions/etc/.codecpack") && !file_exist("/var/swap/etc/.codecpack") && !file_exist("/var/etc/.codecpack"))
243                skip = 1;
244        else if(node->flag == 6 && pay == 0)
245                skip = 1;
246        else if(node->flag == 1 && pay == 0)
247                skip = 1;
248        else if(node->flag == 35 && pay == 0)
249                skip = 1;
250        else if(node->flag == 96 && pay == 0)
251                skip = 1;
252        else if(titheksolarmovie == 1 && node->flag == 9996 && sos == 0)
253        {
254                cmd = ostrcat(cmd, "www.thesolarmovie.me", 1, 0);
255
256                for(i = 0; i < 3; i++)
257                {
258                        free(tmp); tmp = NULL;
259                        tmp = gethttpreal(cmd, "/", 80, NULL, NULL, NULL, 0, NULL, NULL, 5000, 2);
260                        if(tmp != NULL) break;
261                }
262                if(tmp == NULL)
263                        skip = 1;
264
265                titheksolarmovie = 0;
266        }
267        else if(tithekmovie4k == 1 && node->flag == 9997 && sos == 0)
268        {
269                cmd = ostrcat(cmd, "www.movie4k.to", 1, 0);
270
271                for(i = 0; i < 3; i++)
272                {
273                        free(tmp); tmp = NULL;
274                        tmp = gethttpreal(cmd, "/", 80, NULL, NULL, NULL, 0, NULL, NULL, 5000, 2);
275                        if(tmp != NULL) break;
276                }
277                if(tmp == NULL)
278                        skip = 1;
279
280                tithekmovie4k = 0;
281        }
282        else if(tithekmlehd == 1 && node->flag == 9998 && sos == 0)
283        {
284                cmd = ostrcat(cmd, "www.mle-hd.se", 1, 0);
285
286                for(i = 0; i < 3; i++)
287                {
288                        free(tmp); tmp = NULL;
289                        tmp = gethttpreal(cmd, "/", 80, NULL, NULL, NULL, 0, NULL, NULL, 5000, 2);
290                        if(tmp != NULL) break;
291                }
292                if(tmp == NULL)
293                        skip = 1;
294
295                tithekmlehd = 0;
296        }
297        else if(tithekkinox == 1 && node->flag == 9999 && sos == 0)
298        {
299                cmd = ostrcat(cmd, "kinox.me", 1, 0);
300
301                for(i = 0; i < 3; i++)
302                {
303                        free(tmp); tmp = NULL;
304                        tmp = gethttpreal(cmd, "/", 80, NULL, NULL, NULL, 0, NULL, NULL, 5000, 2);
305                        if(tmp != NULL) break;
306                }
307                if(tmp == NULL)
308                        skip = 1;
309
310                tithekkinox = 0;
311        }
312
313        if(skip == 1)
314        {
315                freetithekcontent(node);
316                return 1;
317        }
318
319        free(tmp); tmp = NULL;
320        free(cmd), cmd = NULL;
321
322        return 0;
323}
324
325struct tithek* addtithek(char *line, int len, int count, struct tithek* last, int pay)
326{
327        //debug(1000, "in");
328        struct tithek *newnode = NULL, *prev = NULL, *node = NULL;
329        int ret = 0;
330
331        if(line == NULL) return NULL;
332
333        newnode = (struct tithek*)calloc(1, sizeof(struct tithek));
334        if(newnode == NULL)
335        {
336                err("no memory");
337                return NULL;
338        }
339
340        ret = addtithekcontent(newnode, line, len, count, pay);
341        if(ret == 1)
342        {
343                free(newnode);
344                return NULL;
345        }
346
347        node = tithek;
348
349        if(last == NULL)
350        {
351                while(node != NULL)
352                {
353                        prev = node;
354                        node = node->next;
355                }
356        }
357        else
358        {
359                prev = last;
360                node = last->next;
361        }
362
363        if(prev == NULL)
364                tithek = newnode;
365        else
366        {
367                prev->next = newnode;
368                newnode->prev = prev;
369        }
370        newnode->next = node;
371        if(node != NULL) node->prev = newnode;
372
373        //debug(1000, "out");
374        return newnode;
375}
376
377struct tithek* createtithek(struct tithek* update, char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
378{
379        int pay = 0;
380        struct tithek* tnode = NULL;
381        char* tmpstr = NULL;
382
383        pay = getconfigint("tithek_pay", NULL);
384
385        title = stringreplacechar(title, '#', ' ');
386        link = stringreplacechar(link, '#', ' ');
387        pic = stringreplacechar(pic, '#', ' ');
388        localname = stringreplacechar(localname, '#', ' ');
389        menutitle = stringreplacechar(menutitle, '#', ' ');
390
391        tmpstr = ostrcat(tmpstr, title, 1, 0);
392        tmpstr = ostrcat(tmpstr, "#", 1, 0);
393        tmpstr = ostrcat(tmpstr, link, 1, 0);
394        tmpstr = ostrcat(tmpstr, "#", 1, 0);
395        tmpstr = ostrcat(tmpstr, pic, 1, 0);
396        tmpstr = ostrcat(tmpstr, "#", 1, 0);
397        tmpstr = ostrcat(tmpstr, localname, 1, 0);
398        tmpstr = ostrcat(tmpstr, "#", 1, 0);
399        tmpstr = ostrcat(tmpstr, menutitle, 1, 0);
400        tmpstr = ostrcat(tmpstr, "#", 1, 0);
401        tmpstr = ostrcat(tmpstr, oitoa(flag), 1, 1);
402
403        tmpstr = string_replace_all("\n", "", tmpstr, 1);
404        tmpstr = string_replace_all("\r", "", tmpstr, 1);
405
406        if(update != NULL)
407        {
408                freetithekcontent(update);
409                addtithekcontent(update, tmpstr, strlen(tmpstr), 1, pay);
410                tnode = update;
411        }
412        else
413                tnode = addtithek(tmpstr, strlen(tmpstr), 1, NULL, pay);
414
415        free(tmpstr);
416
417        return tnode;
418}
419
420int readtithek(char* filename)
421{
422        debug(1000, "in");
423        FILE *fd = NULL;
424        char *fileline = NULL, *file = NULL;
425        int linecount = 0, len = 0, pay = 0;
426        struct tithek* last = NULL, *tmplast = NULL;
427
428        fileline = malloc(MINMALLOC);
429        if(fileline == NULL)
430        {
431                err("no memory");
432                return 1;
433        }
434
435//      if(cmpfilenameext(filename, ".sh") == 0)
436        if(ostrstr(filename, ".sh ") != NULL && ostrstr(filename, ".sh init") == NULL)
437        {
438                printf("[tithek] cmd: %s\n", filename);
439                debug(10, "cmd: %s", filename);
440                file = command(filename);
441                file = string_newline(file);
442                printf("[tithek] file: %s\n", file);
443                debug(10, "file: %s", file);
444        }
445        else
446                file = ostrcat(filename, NULL, 0, 0);
447
448        fd = fopen(file, "r");
449        if(fd == NULL)
450        {
451                perr("can't open %s", file);
452                free(fileline);
453                return 1;
454        }
455
456        pay = getconfigint("tithek_pay", NULL);
457
458        char* tmpstr = NULL;
459
460        while(fgets(fileline, MINMALLOC, fd) != NULL)
461        {
462                if(fileline[0] == '\n')
463                        continue;
464
465                len = strlen(fileline) - 1;
466                if(fileline[len] == '\n')
467                        fileline[len] = '\0';
468                if(fileline[len - 1] == '\r')
469                        fileline[len - 1] = '\0';
470
471                linecount++;
472
473                if(last == NULL) last = tmplast;
474                last = addtithek(fileline, len + 2, linecount, last, pay);
475                if(last != NULL) tmplast = last;
476                free(tmpstr), tmpstr = NULL;
477        }
478
479        free(fileline);
480        fclose(fd);
481        return linecount;
482}
483
484int deltithek(char* link)
485{
486        debug(1000, "in");
487        int ret = 1;
488
489        struct tithek *node = tithek, *prev = tithek;
490
491        while(node != NULL)
492        {
493                if(ostrcmp(link, node->link) == 0)
494                {
495                        ret = 0;
496                        if(node == tithek)
497                        {
498                                tithek = node->next;
499                                if(tithek != NULL)
500                                        tithek->prev = NULL;
501                        }
502                        else
503                        {
504                                prev->next = node->next;
505                                if(node->next != NULL)
506                                        node->next->prev = prev;
507                        }
508
509                        freetithekcontent(node);
510
511                        free(node);
512                        node = NULL;
513
514                        break;
515                }
516
517                prev = node;
518                node = node->next;
519        }
520
521        debug(1000, "out");
522        return ret;
523}
524
525void freetithek()
526{
527        debug(1000, "in");
528        struct tithek *node = tithek, *prev = tithek;
529
530        while(node != NULL)
531        {
532                prev = node;
533                node = node->next;
534                if(prev != NULL)
535                        deltithek(prev->link);
536        }
537
538        debug(1000, "out");
539}
540
541void tithekdownloadthread(struct stimerthread* timernode, struct download* node, int flag)
542{
543        int defpic = 0;
544        tithekdownloadcount++;
545
546        if(node != NULL)
547        {
548                m_lock(&status.tithekmutex, 20);
549                if(file_exist(node->filename))
550                {
551                        m_unlock(&status.tithekmutex, 20);
552                        goto end;
553                }
554
555                FILE *fd; fd = fopen(node->filename, "w");
556                if(fd != NULL) fclose(fd);
557                m_unlock(&status.tithekmutex, 20);
558
559                if(ostrcmp(node->filename, "/media/hdd/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/var/swap/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/mnt/.tithek/python.tar") == 0)
560                {
561                        printf("[tithek] download start in: 10s\n");
562                        sleep(10);
563                        printf("[tithek] download start: %s\n", node->filename);
564                }
565
566                gethttpreal(node->host, node->page, node->port, node->filename, node->auth, NULL, 0, NULL, NULL, node->timeout, 0);
567                if(ostrcmp(node->filename, "/media/hdd/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/var/swap/.tithek/python.tar") == 0 || ostrcmp(node->filename, "/mnt/.tithek/python.tar") == 0)
568                        printf("[tithek] download done: %s\n", node->filename);
569
570                char* cmd = NULL;
571
572
573
574                if(ostrcmp(node->filename, "/media/hdd/.tithek/python.tar") == 0)
575                        cmd = ostrcat("rm -rf `find /media/hdd/.tithek/lib -type f -name '*.py' -size +1k`; tar -xf /media/hdd/.tithek/python.tar -C /media/hdd/.tithek/", NULL, 0, 0);
576                else if(ostrcmp(node->filename, "/var/swap/.tithek/python.tar") == 0)
577                        cmd = ostrcat("rm -rf `find /var/swap/.tithek/lib -type f -name '*.py' -size +1k`; tar -xf /var/swap/.tithek/python.tar -C /var/swap/.tithek/", NULL, 0, 0);
578                else if(ostrcmp(node->filename, "/mnt/.tithek/python.tar") == 0)
579                        cmd = ostrcat("rm -rf `find /mnt/.tithek/lib -type f -name '*.py' -size +1k`; tar -xf /mnt/.tithek/python.tar -C /mnt/.tithek/", NULL, 0, 0);
580                else if(ostrcmp(node->filename, "/tmp/python.tar") == 0)
581                        cmd = ostrcat("tar -xf /tmp/python.tar -C /tmp/localhoster/", NULL, 0, 0);
582
583                if(cmd != NULL)
584                {
585                        printf("[tithek] untar start cmd: %s\n", cmd);
586                        system(cmd);
587                        printf("[tithek] untar ende cmd: %s\n", cmd);
588                        python = 1;
589                        free(cmd), cmd = NULL;
590
591                        if(ostrcmp(node->filename, "/tmp/python.tar") == 0 || getconfigint("tithek_autoupdate", NULL) == 1)
592                        {
593                                printf("[tithek] remove: %s\n", node->filename);
594                                unlink(node->filename);
595                        }
596                }
597                if(tithekrun == 0)
598                        unlink(node->filename);
599                else
600                {
601                        //check file size
602                        /*
603                        off64_t checkpic = getfilesize(node->filename);
604                        if(checkpic < 200) defpic = 1;
605                        */
606
607                        //check file is gif or html
608                        if(defpic == 0)
609                        {
610                                char* tmp = NULL;
611                                tmp = readbintomem(node->filename, 3);
612                                if(ostrncmp("GIF", tmp, 3) == 0) defpic = 1; //gif
613                                if(ostrncmp("<", tmp, 1) == 0) defpic = 1; //html
614                                free(tmp); tmp = NULL;
615                        }
616
617                        if(defpic == 1)
618                        {
619                                m_lock(&status.tithekmutex, 20);
620                                unlink(node->filename);
621                                symlink("/var/usr/local/share/titan/plugins/tithek/default.jpg", node->filename);
622                                m_unlock(&status.tithekmutex, 20);
623                        }
624                }
625
626end:
627                free(node->host); node->host = NULL;
628                free(node->page); node->page = NULL;
629                free(node->filename); node->filename = NULL;
630                free(node->auth); node->auth = NULL;
631        }
632
633        free(node); node = NULL;
634
635        tithekdownloadcount--;
636        tithekdownloadrun = 1;
637}
638
639char* tithekdownload(char* link, char* localname, char* pw, int pic, int flag)
640{
641        int ret = 1, port = 80, timeout = 10000, ssl = 0;
642        char* ip = NULL, *pos = NULL, *path = NULL;
643        char* tmpstr = NULL, *localfile = NULL;
644
645        if(link == NULL) return NULL;
646        if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8)) return NULL;
647
648        if(!ostrncmp("https://", link, 8))
649                ssl = 1;
650        else
651        {
652                ip = string_replace("http://", "", (char*)link, 0);
653
654                // tithek security
655                ip = string_replace_all("imageshack.us/md/up/grd/", "atemio.dyndns.tv/", ip, 1);
656
657                ip = string_replace_all("kinox.to", "kinox.me", ip, 1);
658                //ip = string_replace_all("movie4k.to", "movie4k.me", ip, 1);
659
660                if(ip != NULL)
661                        pos = strchr(ip, '/');
662                if(pos != NULL)
663                {
664                        pos[0] = '\0';
665                        path = pos + 1;
666                }
667
668                if(ostrstr(ip, ":") != NULL)
669                {
670                        ip = oregex("http://(.*):.*", link);
671                        port = atoi(oregex("http://.*:(.*)/.*", link));
672                }
673        }
674
675        tmpstr = ostrcat(path, NULL, 0, 0);
676
677        if(flag == 0)
678        {
679                localfile = ostrcat(TITHEKPATH, "/", 0, 0);
680                if(localname == NULL)
681                        localfile = ostrcat(localfile, basename(tmpstr), 1, 0);
682                else
683                        localfile = ostrcat(localfile, localname, 1, 0);
684        }
685        else
686        {
687                localfile = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0);
688                if(localname == NULL)
689                        localfile = ostrcat(localfile, basename(tmpstr), 1, 0);
690                else
691                        localfile = ostrcat(localfile, localname, 1, 0);
692        }
693        free(tmpstr); tmpstr = NULL;
694
695/*
696        debug(99, "---------------------------------------");
697        debug(99, "link: %s", link);
698        debug(99, "localname: %s", localname);
699        debug(99, "---------------------------------------");
700        debug(99, "ip: %s", ip);
701        debug(99, "port: %d", port);
702        debug(99, "path: %s", path);
703        debug(99, "localfile: %s", localfile);
704        debug(99, "pw: %s", pw);
705        debug(99, "---------------------------------------");
706*/
707        if(flag == 0)
708        {
709                if(localfile != NULL && !file_exist(localfile))
710                {
711                        if(pic == 1)
712                        {
713                                if(ssl == 1)
714                                        gethttps(link, localfile, NULL, NULL, NULL, NULL, 0);
715                                else if(tithekdownloadcount >= 24) //start max 24 threads
716                                        gethttp(ip, path, port, localfile, pw, timeout, NULL, 0);
717                                else
718                                {
719                                        //dnode is freed in thread
720                                        struct download* dnode = calloc(1, sizeof(struct download));
721                                        if(dnode != NULL)
722                                        {
723                                                dnode->host = ostrcat(ip, NULL, 0, 0);
724                                                dnode->page = ostrcat(path, NULL, 0, 0);
725                                                dnode->port = port;
726                                                dnode->filename = ostrcat(localfile, NULL, 0, 0);
727                                                dnode->auth = ostrcat(pw, NULL, 0, 0);
728                                                dnode->connfd = -1;
729                                                dnode->ret = -1;
730                                                dnode->timeout = timeout;
731                                                addtimer(&tithekdownloadthread, START, 100, 1, (void*)dnode, NULL, NULL);
732                                        }
733                                }
734                        }
735                        else
736                        {
737                                if(ssl == 1)
738                                        gethttps(link, localfile, NULL, NULL, NULL, NULL, 0);
739                                else
740                                        gethttp(ip, path, port, localfile, pw, timeout, NULL, 0);
741                        }
742                }
743        }
744        else
745        {
746
747                if(localfile != NULL && file_exist(localfile))
748                        ret = textbox(_("Message"), _("File exist, overwrite?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
749
750                if(localfile != NULL && ret == 1)
751                        screendownload("Download", ip, path, port, localfile, pw, timeout, 0);
752        }
753
754        free(ip); ip = NULL;
755        free(tmpstr); tmpstr = NULL;
756
757        return localfile;
758}
759
760int createtithekplay(char* titheklink, struct skin* grid, struct skin* listbox, struct skin* countlabel, int flag)
761{
762        int gridbr = 0, posx = 0, count = 0, sumcount = 0, count1 = 0, pagecount = 0, skip = 0;
763        int localfile = 0;
764        struct skin* tmp = NULL;
765        char* tithekfile = NULL;
766        char* tmpstr = NULL;
767
768        if(!ostrncmp("http://", titheklink, 7))
769                tithekfile = tithekdownload(titheklink, NULL, HTTPAUTH, 0, 0);
770        else
771        {
772                tithekfile = ostrcat(titheklink, NULL, 0, 0);
773                localfile = 1;
774        }
775
776//      amazon_init(titheklink, tithekfile);
777//init locale parser
778        localparser_init(titheklink, tithekfile, flag);
779
780        delmarkedscreennodes(grid, 1);
781        freetithek();
782//      if(readtithek(tithekfile) != 0) return 1;
783        int linecount = readtithek(tithekfile);
784//      if(linecount == 0) return 1;
785
786        struct tithek* titheknode = tithek;
787
788        int height = 500;
789        int width = 590;
790        int picheight = 480;
791        int picwidth = 570;
792        int zcount = 2;
793        int fontsize = 25;
794        int pcount = 2;
795
796        if(getconfigint("tithek_cover", NULL) == 0 || getconfigint("tithek_view", NULL) == 0)
797        {
798                if(linecount > 2)
799                {
800                        height = 280;
801                        width = 390;
802                        picheight = 230;
803                        picwidth = 370;
804                        zcount = 3;
805                        fontsize = 20;
806                        pcount = 6;
807                }
808
809                if(linecount > 8)
810                {
811                        height = 180;
812                        width = 295;
813                        picheight = 130;
814                        picwidth = 270;
815                        zcount = 4;
816                        fontsize = 18;
817                        pcount = 12;
818                }
819
820                if(linecount > 19)
821                {
822                        height = 140;
823                        width = 235;
824                        picheight = 90;
825                        picwidth = 210;
826                        zcount = 5;
827                        fontsize = 16;
828                        pcount = 20;
829                }
830
831                if(linecount > 25)
832                {
833                        height = 111;
834                        width = 196;
835                        picheight = 60;
836                        picwidth = 150;
837                        zcount = 6;
838                        fontsize = 14;
839                        pcount = 30;
840                }
841        }
842
843        if((getconfigint("tithek_cover", NULL) == 1 && flag == 0) || (getconfigint("tithek_view", NULL) == 1 && flag != 0))
844        {
845                height = 500;
846                width = 590;
847                picheight = 480;
848                picwidth = 570;
849                zcount = 2;
850                fontsize = 25;
851                pcount = 2;
852        }
853
854        if((getconfigint("tithek_cover", NULL) == 2 && flag == 0) || (getconfigint("tithek_view", NULL) == 2 && flag != 0))
855        {
856                height = 280;
857                width = 390;
858                picheight = 230;
859                picwidth = 370;
860                zcount = 3;
861                fontsize = 20;
862                pcount = 6;
863        }
864
865        if((getconfigint("tithek_cover", NULL) == 3 && flag == 0) || (getconfigint("tithek_view", NULL) == 3 && flag != 0))
866        {
867                height = 180;
868                width = 295;
869                picheight = 130;
870                picwidth = 270;
871                zcount = 4;
872                fontsize = 18;
873                pcount = 12;
874        }
875
876        if((getconfigint("tithek_cover", NULL) == 4 && flag == 0) || (getconfigint("tithek_view", NULL) == 4 && flag != 0))
877        {
878                height = 140;
879                width = 235;
880                picheight = 90;
881                picwidth = 210;
882                zcount = 5;
883                fontsize = 16;
884                pcount = 20;
885        }
886
887        if((getconfigint("tithek_cover", NULL) == 5 && flag == 0) || (getconfigint("tithek_view", NULL) == 5 && flag != 0))
888        {
889                height = 111;
890                width = 196;
891                picheight = 60;
892                picwidth = 150;
893                zcount = 6;
894                fontsize = 14;
895                pcount = 30;
896        }
897
898        if((getconfigint("tithek_cover", NULL) == 6 && flag == 0) || (getconfigint("tithek_view", NULL) == 6 && flag != 0))
899        {
900                height = 50;
901                width = 1160;
902                picheight = 48;
903                picwidth = 1100;
904                zcount = 1;
905                fontsize = 25;
906                pcount = 1;
907                height += status.fontsizeadjust;
908        }
909
910        fontsize += status.fontsizeadjust;
911        height += status.fontsizeadjust;
912
913        if(getconfigint("tithek_pic_ratio", NULL) == 1)
914        {
915                picwidth = 2;
916                picheight = 2;
917        }
918
919        while(titheknode != NULL)
920        {
921                tmp = addlistbox(grid, listbox, tmp, 1);
922                if(tmp != NULL)
923                {
924                        skip = 0;
925                        sumcount++;
926                        count++;
927                        count1++;
928                        if(gridbr == 0)
929                                tmp->type = GRIDBR;
930                        gridbr = 1;
931                        tmp->wrap = YES;
932
933                        tmp->picheight = picheight;
934                        tmp->picwidth = picwidth;
935
936                        tmp->fontsize = fontsize;
937                        tmp->height = height;
938                        tmp->width = width;
939                        tmp->prozwidth = 0;
940                        //tmp->bgcol = 0xffffff;
941                        tmp->bgspace = 1;
942                        tmp->vspace = 10;
943                        tmp->hspace = 10;
944                        tmp->posx = posx;
945                        if(python = 0 && flag == 14)
946                                tmp->fontcol = ff0000;
947                        else if(python = 1 && flag == 14)
948                                tmp->fontcol = 00ff00;
949                        else
950                                tmp->fontcol = ffffff;
951
952                        //tmp->fontcol = 0x0000ff;
953
954                        tmp->halign = CENTER;
955                        tmp->valign = TEXTBOTTOM;
956                        changetext(tmp, titheknode->title);
957                        tmp->handle = (char*)titheknode;
958                        posx += tmp->width;
959                        if(count >= zcount)
960                        {
961                                count = 0;
962                                posx = 0;
963                                gridbr = 0;
964                        }
965
966                        if(count1 >= pcount)
967                        {
968                                count1 = 0;
969                                pagecount++;
970                                skip = 1;
971                        }
972                }
973                titheknode = titheknode->next;
974        }
975
976        if(skip == 0)
977                pagecount++;
978
979        tmpstr = oitoa(sumcount);
980
981        char* tmpstr1 = ostrcat(_("found"), NULL, 0, 0);
982        tmpstr1 = ostrcat(tmpstr1, " ", 1, 0);
983        tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0);
984        free(tmpstr); tmpstr = NULL;
985        tmpstr1 = ostrcat(tmpstr1, " ", 1, 0);
986        tmpstr1 = ostrcat(tmpstr1, _("Results"), 1, 0);
987        changetext(countlabel, tmpstr1);
988        free(tmpstr1); tmpstr1 = NULL;
989
990        if(localfile == 0)
991                unlink(tithekfile);
992
993        free(tithekfile); tithekfile = NULL;
994        return pagecount;
995}
996
997void removefav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
998{
999        int count = 0, i = 0;
1000        char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL;
1001        struct splitstr* ret = NULL;
1002
1003        input = ostrcat(input, title, 1, 0);
1004        input = ostrcat(input, "#", 1, 0);
1005        input = ostrcat(input, link, 1, 0);
1006        input = ostrcat(input, "#", 1, 0);
1007        input = ostrcat(input, pic, 1, 0);
1008        input = ostrcat(input, "#", 1, 0);
1009        input = ostrcat(input, localname, 1, 0);
1010        input = ostrcat(input, "#", 1, 0);
1011        input = ostrcat(input, menutitle, 1, 0);
1012        input = ostrcat(input, "#", 1, 0);
1013        input = ostrcat(input, oitoa(flag), 1, 1);
1014
1015        tmpstr = readfiletomem(getconfig("tithek_fav", NULL), 0);
1016
1017        ret = strsplit(tmpstr, "\n", &count);
1018
1019        if(ret != NULL)
1020        {
1021                for(i = 0; i < count; i++)
1022                {
1023                        if(ostrcmp((ret[i]).part, input) != 0)
1024                        {
1025                                tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0);
1026                                tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
1027                        }
1028                        else
1029                                printf("remove: %s\n", ret[i].part);
1030                }
1031        }
1032
1033        if(tmpstr1 != NULL && strlen(tmpstr1) > 0)
1034                tmpstr1[strlen(tmpstr1) - 1] = '\0';
1035
1036        if(tmpstr1 == NULL)
1037                writesys(getconfig("tithek_fav", NULL), "", 0);
1038        else
1039                writesys(getconfig("tithek_fav", NULL), tmpstr1, 0);
1040
1041        if(!ostrncmp("/", link, 1))
1042        {
1043                free(tmpstr1); tmpstr1 = NULL;
1044                tmpstr1 = ostrcat("rm -f ", link, 0, 0);
1045                system(tmpstr1);
1046        }
1047
1048        free(ret); ret = NULL;
1049        free(tmpstr); tmpstr = NULL;
1050        free(tmpstr1); tmpstr1 = NULL;
1051        free(input); input = NULL;
1052}
1053
1054void addfav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
1055{
1056        int count = 0, i = 0;
1057        char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL;
1058        struct splitstr* ret = NULL;
1059
1060        char* savefile = NULL;
1061
1062        struct menulist* mlist = NULL, *mbox = NULL;
1063        char* favlist = command("ls -1 /mnt/config/favorite*");
1064        printf("favlist: %s\n", favlist);
1065        ret = strsplit(favlist, "\n", &count);
1066
1067        if(ret != NULL)
1068        {
1069                for(i = 0; i < count; i++)
1070                {
1071                        char* cmd = ostrcat("cat ", getconfig("tithek_fav", NULL), 0, 0);
1072                        cmd = ostrcat(cmd, " | grep '#", 1, 0);
1073                        cmd = ostrcat(cmd, (ret[i]).part, 1, 0);
1074
1075                        cmd = ostrcat(cmd, "#' | cut -d'#' -f1", 1, 0);
1076                        printf("cmd: %s\n", cmd);
1077                        tmpstr = command(cmd);
1078                        if(tmpstr == NULL)
1079                                tmpstr = ostrcat(_("Favorites"), NULL, 0, 0);
1080                        addmenulist(&mlist, tmpstr, (ret[i]).part, NULL, 0, 0);
1081                        printf("(ret[i]).part: %s\n", (ret[i]).part);
1082                        printf("tmpstr: %s\n", tmpstr);
1083                        free(tmpstr), tmpstr = NULL;
1084                        free(cmd), cmd = NULL;
1085                }
1086
1087        }
1088        else
1089                addmenulist(&mlist, "Favorites", getconfig("tithek_fav", NULL), NULL, 0, 0);
1090
1091        free(ret), ret = NULL;
1092
1093        mbox = menulistbox(mlist, NULL, NULL, NULL, NULL, NULL, 1, 0);
1094        if(mbox != NULL)
1095        {
1096                printf("mbox->name %s\n", mbox->name);
1097                printf("mbox->text %s\n", mbox->text);
1098                savefile = ostrcat(mbox->text, NULL, 0, 0);
1099        }
1100        else
1101                savefile = ostrcat(getconfig("tithek_fav", NULL), NULL, 0, 0);
1102
1103        input = ostrcat(input, title, 1, 0);
1104        input = ostrcat(input, "#", 1, 0);
1105        input = ostrcat(input, link, 1, 0);
1106        input = ostrcat(input, "#", 1, 0);
1107        input = ostrcat(input, pic, 1, 0);
1108        input = ostrcat(input, "#", 1, 0);
1109        input = ostrcat(input, localname, 1, 0);
1110        input = ostrcat(input, "#", 1, 0);
1111        input = ostrcat(input, menutitle, 1, 0);
1112        input = ostrcat(input, "#", 1, 0);
1113        input = ostrcat(input, oitoa(flag), 1, 1);
1114        // tithek security
1115        input = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", input, 1);
1116
1117        tmpstr1 = ostrcat(tmpstr1, input, 1, 0);
1118        tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
1119
1120        tmpstr = readfiletomem(savefile, 0);
1121
1122        ret = strsplit(tmpstr, "\n", &count);
1123
1124        if(ret != NULL)
1125        {
1126                for(i = 0; i < count; i++)
1127                {
1128                        if(ostrcmp((ret[i]).part, input) != 0)
1129                        {
1130                                tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0);
1131                                tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
1132                        }
1133                }
1134        }
1135
1136        if(tmpstr1 != NULL && strlen(tmpstr1) > 0)
1137                tmpstr1[strlen(tmpstr1) - 1] = '\0';
1138
1139        writesys(savefile, tmpstr1, 0);
1140
1141        if(!ostrncmp("/", link, 1))
1142        {
1143                free(tmpstr1); tmpstr1 = NULL;
1144                tmpstr1 = ostrcat("touch ", link, 0, 0);
1145                system(tmpstr1);
1146        }
1147
1148        free(mbox); mbox = NULL;
1149        free(ret); ret = NULL;
1150        free(tmpstr); tmpstr = NULL;
1151        free(tmpstr1); tmpstr1 = NULL;
1152        free(input); input = NULL;
1153}
1154
1155void editfav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
1156{
1157        int rcret = 0, type = 0;
1158        struct skin* tithekedit = getscreen("tithekedit");
1159        struct skin* listbox = getscreennode(tithekedit, "listbox");
1160        struct skin* skin_title = getscreennode(tithekedit, "title");
1161        struct skin* skin_link = getscreennode(tithekedit, "link");
1162        struct skin* skin_pic = getscreennode(tithekedit, "pic");
1163        struct skin* skin_localname = getscreennode(tithekedit, "localname");
1164        struct skin* skin_menutitle = getscreennode(tithekedit, "menutitle");
1165        struct skin* skin_type = getscreennode(tithekedit, "type");
1166
1167        struct skin* tmp = NULL;
1168        struct skin* load = getscreen("loading");
1169
1170        changeinput(skin_title, title);
1171        changeinput(skin_link, link);
1172        changeinput(skin_pic, pic);
1173        changeinput(skin_localname, localname);
1174        changeinput(skin_menutitle, menutitle);
1175        changeinput(skin_type, oitoa(type));
1176
1177        addscreenrc(tithekedit, listbox);
1178        drawscreen(tithekedit, 0, 0);
1179
1180        tmp = listbox->select;
1181        while(1)
1182        {
1183                addscreenrc(tithekedit, tmp);
1184                rcret = waitrcext(tithekedit, 0, 0, 1000);
1185                delownerrc(tithekedit);
1186                addscreenrc(tithekedit, listbox);
1187                tmp = listbox->select;
1188
1189                if(rcret == getrcconfigint("rcexit", NULL)) break;
1190                if(rcret == getrcconfigint("rcok", NULL))
1191                {
1192                        drawscreen(load, 0, 0);
1193                        addfav(skin_title->ret, skin_link->ret, skin_pic->ret, skin_localname->ret, skin_menutitle->ret, atoi(skin_type->ret));
1194                        clearscreen(load);
1195                        break;
1196                }
1197        }
1198
1199        delownerrc(tithekedit);
1200        clearscreen(tithekedit);
1201}
1202
1203int showinfo(struct skin* listbox, char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
1204{
1205        int ret = 1;
1206        char* tmpstr = NULL;
1207        tmpstr = ostrcat(tmpstr, title, 1, 0);
1208        tmpstr = ostrcat(tmpstr, "#", 1, 0);
1209        tmpstr = ostrcat(tmpstr, link, 1, 0);
1210        tmpstr = ostrcat(tmpstr, "#", 1, 0);
1211        tmpstr = ostrcat(tmpstr, pic, 1, 0);
1212        tmpstr = ostrcat(tmpstr, "#", 1, 0);
1213        tmpstr = ostrcat(tmpstr, localname, 1, 0);
1214        tmpstr = ostrcat(tmpstr, "#", 1, 0);
1215        tmpstr = ostrcat(tmpstr, menutitle, 1, 0);
1216        tmpstr = ostrcat(tmpstr, "#", 1, 0);
1217        tmpstr = ostrcat(tmpstr, oitoa(flag), 1, 1);
1218        // tithek security
1219//      tmpstr = string_replace_all("http://atemio.dyndns.tv/", "http://imageshack.us/md/up/grd/", tmpstr, 1);
1220        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
1221       
1222        char* savefile = ostrcat("/tmp/tithek/infomenu.list", NULL, 0, 0);
1223
1224        writesys(savefile, tmpstr, 0);
1225        free(tmpstr), tmpstr = NULL;
1226
1227        if(file_exist(savefile))
1228        {
1229                struct tithek* tnode = (struct tithek*)listbox->select->handle;
1230                createtithek(tnode, tnode->title, savefile, tnode->pic, tnode->localname, tnode->menutitle, tnode->flag);
1231                ret = 0;
1232        }
1233
1234        return ret;
1235}
1236
1237void cacheplay(char* link, char* filename, int flag)
1238{
1239        struct skin* load = getscreen("loadingproz");
1240        struct skin* proztext = getscreennode(load, "proztext");
1241
1242        drawscreen(load, 0, 0);
1243        int port = 80, count = 0, mcount = 0;
1244        off64_t size = 0, msize = 0;
1245        char* host = NULL, *pos = NULL, *path = NULL, *file = NULL, *tmpstr = NULL;
1246        host = string_replace("http://", "", (char*)link, 0);
1247
1248        if(host != NULL)
1249                pos = strchr(host, '/');
1250        if(pos != NULL)
1251        {
1252                pos[0] = '\0';
1253                path = pos + 1;
1254        }
1255
1256        file = ostrcat(getconfig("rec_streampath", NULL), "/.cache.", 0, 0);
1257        file = ostrcat(file, filename, 1, 0);
1258
1259        if(ostrstr(host, ":") != NULL)
1260        {
1261                host = oregex("http://(.*):.*", link);
1262                port = atoi(oregex("http://.*:(.*)/.*", link));
1263        }
1264
1265        debug(99, "---------------------------------------");
1266        debug(99, "link: %s", link);
1267        debug(99, "---------------------------------------");
1268        debug(99, "host: %s", host);
1269        debug(99, "port: %d", port);
1270        debug(99, "path: %s", path);
1271        debug(99, "local: %s", file);
1272        debug(99, "---------------------------------------");
1273
1274
1275        struct download* dnode = NULL;
1276        dnode = calloc(1, sizeof(struct download));
1277        if(dnode == NULL)
1278        {
1279                err("no mem");
1280                return;
1281        }
1282        dnode->host = host;
1283        dnode->page = path;
1284        dnode->port = port;
1285        dnode->filename = file;
1286        dnode->auth = NULL;
1287        dnode->connfd = -1;
1288        dnode->ret = -1;
1289        dnode->timeout = 30000;
1290
1291        addtimer(&gethttpstruct, START, 1000, 1, (void*)dnode, NULL, NULL);
1292
1293        if(flag == 1)
1294        {
1295                mcount = 120;
1296                msize = 10485760;
1297        }
1298        else if(flag == 2)
1299        {
1300                mcount = 240;
1301                msize = 20971520;
1302        }
1303        else if(flag == 3)
1304        {
1305                mcount = 360;
1306                msize = 31457280;
1307        }
1308
1309        while(count < mcount || size >= msize)
1310        {
1311                sleep(1);
1312                count++;
1313                if(file_exist(file))
1314                        size = getfilesize(file);
1315
1316                int proz = 0;
1317                int proz1 = size * 100 / msize;
1318                debug(99, "size (%dprozent)", proz1);
1319
1320                int proz2 = count * 100 / mcount;
1321                debug(99, "time (%dprozent)", proz2);
1322
1323                if(proz1 > proz2)
1324                        proz = proz1;
1325                else
1326                        proz = proz2;
1327
1328                debug(99, "cacheing...(%lldkb) (%dprozent)", size / 1024, proz);
1329
1330                if(size >= msize)
1331                        break;
1332                if(count >= mcount)
1333                        break;
1334
1335                tmpstr = ostrcat(_("please wait..."), " (", 0, 0);
1336                tmpstr = ostrcat(tmpstr, oitoa(proz), 1, 1);
1337                tmpstr = ostrcat(tmpstr, "%)", 1, 0);
1338                clearscreen(load);
1339                changetext(proztext, tmpstr);
1340                drawscreen(load, 0, 0);
1341                free(tmpstr), tmpstr = NULL;
1342        }
1343
1344        screenplay(file, filename, 2, 0);
1345        sockclose(&dnode->connfd);
1346        free(dnode); dnode = NULL;
1347
1348        tmpstr = ostrcat(tmpstr, _("Remove Cachefile ?"), 1, 0);
1349        tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
1350        tmpstr = ostrcat(tmpstr, file, 1, 0);
1351
1352        if(textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
1353        {
1354                unlink(file);
1355        }
1356        free(tmpstr), tmpstr = NULL;
1357        free(file), file = NULL;
1358        free(host), host = NULL;
1359}
1360
1361
1362void backgroundytdl(char* link, char* filename)
1363{
1364        int ret = 0;
1365        char *file = NULL, *cmd = NULL;
1366
1367        file = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0);
1368        file = ostrcat(file, filename, 1, 0);
1369
1370        cmd = ostrcat("/tmp/localhoster/hoster.sh youtube_dlbg \"", link, 0, 0);
1371        cmd = ostrcat(cmd, "\" \"", 1, 0);
1372        cmd = ostrcat(cmd, file, 1, 0);
1373        cmd = ostrcat(cmd, "\" &", 1, 0);
1374
1375        printf("cmd: %s\n", cmd);
1376        ret = system(cmd);
1377        free(cmd), cmd = NULL;
1378        if(ret == 1)
1379                textbox(_("Message"), _("Can't start download.\nPlease try later."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
1380
1381}
1382
1383void backgrounddl(char* link, char* filename)
1384{
1385        int port = 80, ret = 0;
1386        char* host = NULL, *pos = NULL, *path = NULL, *file = NULL, *tmpstr = NULL;
1387        host = string_replace("http://", "", (char*)link, 0);
1388
1389        if(host != NULL)
1390                pos = strchr(host, '/');
1391        if(pos != NULL)
1392        {
1393                pos[0] = '\0';
1394                path = pos + 1;
1395        }
1396
1397        file = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0);
1398        file = ostrcat(file, filename, 1, 0);
1399
1400        if(ostrstr(host, ":") != NULL)
1401        {
1402                host = oregex("http://(.*):.*", link);
1403                port = atoi(oregex("http://.*:(.*)/.*", link));
1404        }
1405
1406        debug(99, "---------------------------------------");
1407        debug(99, "link: %s", link);
1408        debug(99, "---------------------------------------");
1409        debug(99, "host: %s", host);
1410        debug(99, "port: %d", port);
1411        debug(99, "path: %s", path);
1412        debug(99, "local: %s", file);
1413        debug(99, "---------------------------------------");
1414
1415        if(ostrstr(path, "|User-Agent=") != NULL)
1416        {
1417                stringreplacechar(path, '|', '\0');
1418                printf("page changed: %s\n", path);
1419
1420                char* cmd = NULL;
1421                cmd = ostrcat("wget --user-agent=\'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0\' \'http://", host, 0, 0);
1422                cmd = ostrcat(cmd, "/", 1, 0);
1423                cmd = ostrcat(cmd, path, 1, 0);
1424                cmd = ostrcat(cmd, "\' -O \'", 1, 0);
1425                cmd = ostrcat(cmd, file, 1, 0);
1426                cmd = ostrcat(cmd, "\' &", 1, 0);
1427                printf("cmd: %s\n", cmd);
1428                ret = system(cmd);
1429                free(cmd), cmd = NULL;
1430        }
1431        else
1432                ret = startbgdownload(host, path, port, file, NULL, 30000, 1);
1433
1434        if(ret == 1)
1435                textbox(_("Message"), _("Can't start download.\nPlease try later."), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
1436
1437        free(tmpstr), tmpstr = NULL;
1438        free(file), file = NULL;
1439        free(host), host = NULL;
1440}
1441
1442void submenu(struct skin* listbox, struct skin* load, char* title)
1443{
1444        int flag = 0;
1445        char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL;
1446        drawscreen(load, 0, 0);
1447        tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0);
1448        tmpstr2 = ostrcat(((struct tithek*)listbox->select->handle)->title, NULL, 0, 0);
1449
1450        if(((struct tithek*)listbox->select->handle)->flag == 2)
1451        {
1452                if(tmpstr != NULL) tmpstr1 = ostrcat(tmpstr, NULL, 0, 0);
1453        }
1454        else if(((struct tithek*)listbox->select->handle)->flag == 3)
1455        {
1456                flag = 4;
1457                if(tmpstr != NULL) tmpstr1 = ostrcat(tmpstr, NULL, 0, 0);
1458        }
1459        else if(((struct tithek*)listbox->select->handle)->flag == 4)
1460        {
1461                if(tmpstr != NULL) tmpstr1 = youtube_hoster(tmpstr);
1462        }
1463        else if(((struct tithek*)listbox->select->handle)->flag == 5)
1464        {
1465                if(tmpstr != NULL) tmpstr1 = nowtv(tmpstr);
1466        }
1467        else if(((struct tithek*)listbox->select->handle)->flag == 6)
1468        {
1469                if(tmpstr != NULL) tmpstr1 = nowtv(tmpstr);
1470        }
1471        else if(((struct tithek*)listbox->select->handle)->flag == 12)
1472        {
1473                if(tmpstr != NULL) tmpstr1 = myvideo_hoster(tmpstr);
1474        }
1475        else if(((struct tithek*)listbox->select->handle)->flag == 14)
1476        {
1477                if(tmpstr != NULL) tmpstr1 = kinox(tmpstr);
1478        }
1479        else if(((struct tithek*)listbox->select->handle)->flag == 15)
1480        {
1481                if(tmpstr != NULL) tmpstr1 = giga(tmpstr);
1482        }
1483        else if(((struct tithek*)listbox->select->handle)->flag == 20)
1484        {
1485                if(tmpstr != NULL) tmpstr1 = nbastream(tmpstr);
1486        }
1487        else if(((struct tithek*)listbox->select->handle)->flag == 38)
1488        {
1489                if(tmpstr != NULL) tmpstr1 = mlehd(tmpstr);
1490        }
1491        else if(((struct tithek*)listbox->select->handle)->flag == 41)
1492        {
1493                if(tmpstr != NULL) tmpstr1 = movie4k(tmpstr);
1494        }
1495        else if(((struct tithek*)listbox->select->handle)->flag == 42)
1496        {
1497                if(tmpstr != NULL) tmpstr1 = xvideos(tmpstr);
1498        }
1499        else if(((struct tithek*)listbox->select->handle)->flag == 43)
1500        {
1501                if(tmpstr != NULL) tmpstr1 = solarmovie(tmpstr);
1502        }
1503        else if(((struct tithek*)listbox->select->handle)->flag == 45)
1504        {
1505                if(tmpstr != NULL) tmpstr1 = ard(tmpstr);
1506        }
1507        else if(((struct tithek*)listbox->select->handle)->flag == 46)
1508        {
1509                if(tmpstr != NULL) tmpstr1 = zdf(tmpstr);
1510        }
1511        else if(((struct tithek*)listbox->select->handle)->flag == 50)
1512        {
1513                if(tmpstr != NULL) tmpstr1 = beeg(tmpstr);
1514        }
1515        else if(((struct tithek*)listbox->select->handle)->flag == 64)
1516        {
1517                if(tmpstr != NULL) tmpstr1 = tvtoast(tmpstr);
1518        }
1519        else if(((struct tithek*)listbox->select->handle)->flag == 75)
1520        {
1521                if(tmpstr != NULL) tmpstr1 = amazon(tmpstr);
1522        }
1523        else if(((struct tithek*)listbox->select->handle)->flag == 91)
1524        {
1525                if(tmpstr != NULL) tmpstr1 = streamlive(tmpstr, -1);
1526        }
1527        else if(((struct tithek*)listbox->select->handle)->flag == 92)
1528        {
1529                if(tmpstr != NULL) tmpstr1 = cricfree(tmpstr, -1);
1530        }
1531        else if(((struct tithek*)listbox->select->handle)->flag == 93)
1532        {
1533                if(tmpstr != NULL) tmpstr1 = liveonlinetv(tmpstr, -1);
1534        }
1535        else if(((struct tithek*)listbox->select->handle)->flag == 94)
1536        {
1537                if(tmpstr != NULL) tmpstr1 = movie2k(tmpstr);
1538        }
1539        else if(((struct tithek*)listbox->select->handle)->flag == 98)
1540        {
1541                if(tmpstr != NULL) tmpstr1 = nbaondemand(tmpstr);
1542        }
1543        else if(((struct tithek*)listbox->select->handle)->flag == 111)
1544        {
1545                if(tmpstr != NULL) tmpstr1 = localparser_hoster(tmpstr);
1546        }
1547
1548        free(tmpstr); tmpstr = NULL;
1549        free(tmpstr2); tmpstr2 = NULL;
1550
1551        if(ostrstr(title, "Internet Radio") != NULL)
1552                flag = 4;
1553
1554        if(ostrstr(tmpstr1, "&amp;") != NULL)
1555        {
1556                debug(99, "change streamurl from: %s", tmpstr1);
1557                tmpstr1 = string_replace_all("&amp;", "&", tmpstr1, 1);
1558                debug(99, "change streamurl to: %s", tmpstr1);
1559        }
1560
1561        if(!ostrncmp("errormsg=", tmpstr1, 9))
1562        {
1563                tmpstr = ostrcat(_("Found error Msg:"), "\n\n", 0, 0);
1564                tmpstr = ostrcat(tmpstr, tmpstr1, 1, 0);
1565                tmpstr = string_replace("errormsg=", "", tmpstr, 1);
1566
1567                debug(99, "Found error Msg: %s", tmpstr1);
1568                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 300, 0, 2);
1569                free(tmpstr); tmpstr = NULL;
1570                free(tmpstr1); tmpstr1 = NULL;
1571        }
1572        else if(ostrncmp("http", tmpstr1, 4) && ostrncmp("rtmp", tmpstr1, 4) && ostrncmp("mms", tmpstr1, 3) && ostrncmp("rtsp", tmpstr1, 4))
1573        {
1574                tmpstr = ostrcat(_("Parsing Error cant find http*|rtmp*|mms*|rtsp* Stream Link"), "\n\n", 0, 0);
1575                tmpstr = ostrcat(tmpstr, tmpstr1, 1, 0);
1576                debug(99, "Parsing Error cant find http*|rtmp*|mms*|rtsp* Stream Link: %s", tmpstr1);
1577                textbox(_("Message"), tmpstr, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 600, 0, 2);
1578                free(tmpstr); tmpstr = NULL;
1579                free(tmpstr1); tmpstr1 = NULL;
1580        }
1581        else if(tmpstr1 != NULL)
1582        {
1583                char* filename = ostrcat(title, "_", 0, 0);
1584
1585                tmpstr2 = ostrcat(_("Tithek - Mainmenu - Favoriten"), " - ", 0, 0);
1586                filename = string_replace_all(tmpstr2, "", filename, 1);
1587                free(tmpstr2); tmpstr2 = NULL;
1588
1589                tmpstr2 = ostrcat(_("Tithek - Mainmenu"), " - ", 0, 0);
1590                filename = string_replace_all(tmpstr2, "", filename, 1);
1591                free(tmpstr2); tmpstr2 = NULL;
1592
1593                filename = string_replace_all("Tips und Tricks - ", "", filename, 1);
1594                filename = string_replace_all("Internet TV - ", "", filename, 1);
1595                filename = string_replace_all("Internet Radio - ", "", filename, 1);
1596                filename = string_replace_all("ARD - ", "", filename, 1);
1597                filename = string_replace_all("ZDF - ", "", filename, 1);
1598                filename = string_replace_all("FilmOn - ", "", filename, 1);
1599                filename = string_replace_all("MyVideo - ", "", filename, 1);
1600                filename = string_replace_all("Netzkino - ", "", filename, 1);
1601                filename = string_replace_all("KinoX - ", "", filename, 1);
1602                filename = string_replace_all("Movie4k - ", "", filename, 1);
1603                filename = string_replace_all("Movie2k - ", "", filename, 1);
1604
1605                filename = string_replace_all("Beeg ", "", filename, 1);
1606                filename = string_replace_all("Burning Series ", "", filename, 1);
1607                filename = string_replace_all("CricFree ", "", filename, 1);
1608                filename = string_replace_all("Giga ", "", filename, 1);
1609                filename = string_replace_all("KKiste ", "", filename, 1);
1610                filename = string_replace_all("NBA-On-Demand ", "", filename, 1);
1611                filename = string_replace_all("StreamLive ", "", filename, 1);
1612                filename = string_replace_all("TheSolarMovie ", "", filename, 1);
1613                filename = string_replace_all("Youtube ", "", filename, 1);
1614
1615                tmpstr2 = ostrcat(_("Category"), " - ", 0, 0);
1616                filename = string_replace_all(tmpstr2, "", filename, 1);
1617                free(tmpstr2); tmpstr2 = NULL;
1618
1619                tmpstr2 = ostrcat(_("Search (local)"), " - ", 0, 0);
1620                filename = string_replace_all(tmpstr2, "", filename, 1);
1621                free(tmpstr2); tmpstr2 = NULL;
1622
1623                tmpstr2 = ostrcat(_("Search (20)"), " - ", 0, 0);
1624                filename = string_replace_all(tmpstr2, "", filename, 1);
1625                free(tmpstr2); tmpstr2 = NULL;
1626
1627                tmpstr2 = ostrcat(_("Search Cast"), " - ", 0, 0);
1628                filename = string_replace_all(tmpstr2, "", filename, 1);
1629                free(tmpstr2); tmpstr2 = NULL;
1630
1631                tmpstr2 = ostrcat(_("Search"), " - ", 0, 0);
1632                filename = string_replace_all(tmpstr2, "", filename, 1);
1633                free(tmpstr2); tmpstr2 = NULL;
1634
1635                tmpstr2 = ostrcat(_("All Sorted"), " - ", 0, 0);
1636                filename = string_replace_all(tmpstr2, "", filename, 1);
1637                free(tmpstr2); tmpstr2 = NULL;
1638
1639                tmpstr2 = ostrcat(_("A-Z"), " - ", 0, 0);
1640                filename = string_replace_all(tmpstr2, "", filename, 1);
1641                free(tmpstr2); tmpstr2 = NULL;
1642
1643                filename = string_replace_all("(Flash - Shell script) - ", "", filename, 1);
1644                filename = string_replace_all("Genres - ", "", filename, 1);
1645                filename = string_replace_all("All Series - ", "", filename, 1);
1646                filename = string_replace_all("Channels - ", "", filename, 1);
1647                filename = string_replace_all("Kinofilme - ", "", filename, 1);
1648                filename = string_replace_all("Neue Filme - ", "", filename, 1);
1649                filename = string_replace_all("Movies (Year) - ", "", filename, 1);
1650                filename = string_replace_all("Movies (Genre) - ", "", filename, 1);
1651                filename = string_replace_all("Series - ", "", filename, 1);
1652
1653                filename = ostrcat(filename, ((struct tithek*)listbox->select->handle)->title, 1, 0);
1654                filename = ostrcat(filename, ".mp4", 1, 0);
1655                filename = string_replace_all(" ", ".", filename, 1);
1656                filename = string_replace_all("-", "_", filename, 1);
1657                filename = string_replace_all("._.", "_", filename, 1);
1658                filename = string_replace_all(".._", "_", filename, 1);
1659                debug(99, "filename: %s", filename);
1660
1661                char* keyconf = NULL;
1662                char* skintitle = _("Choice Playback");
1663                struct menulist* mlist = NULL, *mbox = NULL;
1664
1665#ifdef MIPSEL
1666                if(checkbox("VUSOLO2") == 0)
1667                        addmenulist(&mlist, "Streaming Playback (default)", _("Streaming Playback (default)"), NULL, 0, 0);
1668#endif
1669
1670#ifndef MIPSEL
1671                addmenulist(&mlist, "Streaming Playback (default)", _("Streaming Playback (default)"), NULL, 0, 0);
1672#else
1673                // mipsel work, disable http direct streams without buffer, after 3mins no memory (memleak in player.h ?)
1674                if(ostrncmp("http://", tmpstr1, 7) && ostrncmp("https://", tmpstr1, 8))
1675                        addmenulist(&mlist, "Streaming Playback (default)", _("Streaming Playback (default)"), NULL, 0, 0);
1676#endif
1677                if(!ostrncmp("http://", tmpstr1, 7) || !ostrncmp("https://", tmpstr1, 8))
1678                {
1679                        // wakeup hdd for downloading
1680                        wakeup_record_device();
1681                        if(flag == 4)
1682                        {
1683//#ifdef EPLAYER3
1684//                              addmenulist(&mlist, "Streaming Playback Caching (1MB)", _("Streaming Playback Caching (1MB)"), NULL, 0, 0);
1685//#else
1686#ifdef MIPSEL
1687                                // mipsel work for radio
1688                                addmenulist(&mlist, "Streaming Playback (default)", _("Streaming Playback (default)"), NULL, 0, 0);
1689#endif
1690//#endif
1691                        }
1692                        else if(!ostrncmp("http://", tmpstr1, 7) || !ostrncmp("https://", tmpstr1, 8))
1693                        {
1694//#ifdef EPLAYER3
1695                                if(checkbox("UFS910") == 1 && !file_exist("/var/swapdir/swapfile"))
1696                                        addmenulist(&mlist, "Streaming Playback Caching (5MB)", _("Streaming Playback Caching (5MB)"), NULL, 0, 0);
1697                                else
1698                                {
1699                                        addmenulist(&mlist, "Streaming Playback Caching (10MB)", _("Streaming Playback Caching (10MB)"), NULL, 0, 0);
1700                                }
1701//#endif
1702                                if(!ostrncmp("http://", tmpstr1, 7) && (file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))))
1703                                {
1704/*
1705#ifndef EPLAYER3
1706                                        addmenulist(&mlist, "File Caching Playback (10MB / 120s)", _("File Caching Playback (10MB / 120s)"), NULL, 0, 0);
1707                                        addmenulist(&mlist, "File Caching Playback (20MB / 240s)", _("File Caching Playback (20MB / 240s)"), NULL, 0, 0);
1708                                        addmenulist(&mlist, "File Caching Playback (30MB / 360s)", _("File Caching Playback (30MB / 360s)"), NULL, 0, 0);
1709#endif
1710*/
1711                                        addmenulist(&mlist, "Download Full File", _("Download Full File"), NULL, 0, 0);
1712                                        addmenulist(&mlist, "Download Full File (background)", _("Download Full File (background)"), NULL, 0, 0);
1713                                }
1714
1715                                if(file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack")))
1716                                        addmenulist(&mlist, "Download via Youtube_DL (background)", _("Download Full File (youtube_dl)"), NULL, 0, 0);
1717                        }
1718                }
1719                mbox = menulistbox(mlist, NULL, skintitle, _("Choose your Streaming Playback Modus from the following list"), NULL, NULL, 1, 0);
1720                if(mbox != NULL) keyconf = mbox->name;
1721                debug(99, "tmpstr1: %s filename: %s flag: %d", tmpstr1, filename, flag);
1722                if(ostrcmp(keyconf, "Streaming Playback (default)") == 0)
1723                {
1724                        addconfigtmp("playerbuffersize", "0");
1725                        screenplay(tmpstr1, filename, 2, flag);
1726                        delconfigtmp("playerbuffersize");
1727                }
1728                else if(ostrcmp(keyconf, "Streaming Playback Caching (0.5MB)") == 0)
1729                {
1730                        addconfigtmp("playerbuffersize", "524288");
1731                        screenplay(tmpstr1, filename, 2, flag);
1732                        delconfigtmp("playerbuffersize");
1733                }
1734                else if(ostrcmp(keyconf, "Streaming Playback Caching (1MB)") == 0)
1735                {
1736                        addconfigtmp("playerbuffersize", "1048576");
1737                        screenplay(tmpstr1, filename, 2, flag);
1738                        delconfigtmp("playerbuffersize");
1739                }
1740                else if(ostrcmp(keyconf, "Streaming Playback Caching (2MB)") == 0)
1741                {
1742                        addconfigtmp("playerbuffersize", "2097152");
1743                        screenplay(tmpstr1, filename, 2, flag);
1744                        delconfigtmp("playerbuffersize");
1745                }
1746                else if(ostrcmp(keyconf, "Streaming Playback Caching (3MB)") == 0)
1747                {
1748                        addconfigtmp("playerbuffersize", "3145728");
1749                        screenplay(tmpstr1, filename, 2, flag);
1750                        delconfigtmp("playerbuffersize");
1751                }
1752                else if(ostrcmp(keyconf, "Streaming Playback Caching (4MB)") == 0)
1753                {
1754                        addconfigtmp("playerbuffersize", "4194304");
1755                        screenplay(tmpstr1, filename, 2, flag);
1756                        delconfigtmp("playerbuffersize");
1757                }
1758                else if(ostrcmp(keyconf, "Streaming Playback Caching (5MB)") == 0)
1759                {
1760                        addconfigtmp("playerbuffersize", "5242880");
1761                        screenplay(tmpstr1, filename, 2, flag);
1762                        delconfigtmp("playerbuffersize");
1763                }
1764                else if(ostrcmp(keyconf, "Streaming Playback Caching (7.5MB)") == 0)
1765                {
1766                        addconfigtmp("playerbuffersize", "7864320");
1767                        screenplay(tmpstr1, filename, 2, flag);
1768                        delconfigtmp("playerbuffersize");
1769                }
1770                else if(ostrcmp(keyconf, "Streaming Playback Caching (10MB)") == 0)
1771                {
1772                        addconfigtmp("playerbuffersize", "10485760");
1773                        screenplay(tmpstr1, filename, 2, flag);
1774                        delconfigtmp("playerbuffersize");
1775                }
1776                else if(ostrcmp(keyconf, "File Caching Playback (10MB / 120s)") == 0)
1777                {
1778                        cacheplay(tmpstr1, filename, 1);
1779                }
1780                else if(ostrcmp(keyconf, "File Caching Playback (20MB / 240s)") == 0)
1781                {
1782                        cacheplay(tmpstr1, filename, 2);
1783                }
1784                else if(ostrcmp(keyconf, "File Caching Playback (30MB / 360s)") == 0)
1785                {
1786                        cacheplay(tmpstr1, filename, 3);
1787                }
1788                else if(ostrcmp(keyconf, "Download Full File") == 0)
1789                {
1790                        char* search = textinput(_("Filename"), filename);
1791                        if(search != NULL)
1792                        {
1793                                char* tmpstr2 = tithekdownload(tmpstr1, search, NULL, 0, 1);
1794//                                              drawscreen(grid, 0, 0);
1795                                free(tmpstr2); tmpstr2 = NULL;
1796
1797                                if(textbox(_("Message"), _("Start playback"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
1798                                {
1799                                        tmpstr2 = ostrcat(getconfig("rec_streampath", NULL), "/", 0, 0);
1800                                        tmpstr2 = ostrcat(tmpstr2, search, 1, 0);
1801                                        screenplay(tmpstr2, filename, 2, flag);
1802                                        free(tmpstr2); tmpstr2 = NULL;
1803                                }
1804                        }
1805                        free(search), search = NULL;
1806                }
1807                else if(ostrcmp(keyconf, "Download Full File (background)") == 0)
1808                {
1809                        char* search = textinput(_("Filename"), filename);
1810                        if(search != NULL)
1811                                backgrounddl(tmpstr1, search);
1812                        free(search), search = NULL;
1813                }
1814                else if(ostrcmp(keyconf, "Download via Youtube_DL (background)") == 0)
1815                {
1816                        char* search = textinput(_("Filename"), filename);
1817                        if(search != NULL)
1818                                backgroundytdl(tmpstr1, search);
1819                        free(search), search = NULL;
1820                }
1821
1822                free(filename), filename = NULL;
1823                freemenulist(mlist, 1); mlist = NULL;
1824        }
1825        else
1826                textbox(_("Message"), _("Can't get Streamurl !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
1827
1828        free(tmpstr1); tmpstr1 = NULL;
1829}
1830
1831void screentithekplay(char* titheklink, char* title, int first)
1832{
1833        int savevol = 0;
1834        if(!file_exist("/mnt/swapextensions/player"))
1835                mkdir("/mnt/swapextensions/player", 0777);
1836
1837        char* disclaimer = NULL;
1838        disclaimer = ostrcat(disclaimer, "/mnt/swapextensions/player/tithek_disclaimer_accepted", 1, 0);
1839
1840        if(!file_exist(disclaimer))
1841        {
1842                char* tmpstr = gethttp("atemio.dyndns.tv", "/mediathek/disclaimer.txt", 80, NULL, HTTPAUTH, 5000, NULL, 0);
1843                if(textbox(_("TitanNit Tithek disclaimer"), _(tmpstr), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1100, 650, 0, 0) == 1)
1844                {
1845                        writesys(disclaimer, tmpstr, 0);
1846                        free(tmpstr), tmpstr = NULL;
1847                }
1848                else
1849                {
1850                        free(tmpstr), tmpstr = NULL;
1851                        free(disclaimer), disclaimer = NULL;
1852                        return;
1853                }
1854        }
1855        free(disclaimer), disclaimer = NULL;
1856
1857        int rcret = -1, oaktline = 1, oaktpage = -1, ogridcol = 0, pagecount = 0;
1858
1859        writesysint("/proc/sys/vm/drop_caches", 3, 0);
1860
1861        if(first == 1)
1862        {
1863                savevol = getvol();
1864
1865                mkdir("/tmp/tithek", 777);
1866                if(status.mcaktiv == 0)
1867                {
1868                        rcret = servicestop(status.aktservice, 1, 1);
1869                        if(rcret == 1) return;
1870                }
1871        }
1872
1873        struct skin* grid = getscreen("titheklist");
1874        struct skin* listbox = getscreennode(grid, "listbox");
1875        struct skin* countlabel = getscreennode(grid, "countlabel");
1876        struct skin* countpage = getscreennode(grid, "countpage");
1877        struct skin* b4 = getscreennode(grid, "b4");
1878        struct skin* b5 = getscreennode(grid, "b5");
1879        struct skin* load = getscreen("loading");
1880        struct skin* tmp = NULL;
1881        char* tithekpic = NULL;
1882
1883        b4->usesavebg = 1;
1884        b5->usesavebg = 1;
1885        drawscreen(grid, 2, 0);
1886
1887//      if(ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0)
1888        if(ostrstr(title, _("Tithek - Mainmenu - Favoriten")) != NULL)
1889        {
1890                changetext(b4, _("EDIT FAV"));
1891                b5->hidden = NO;
1892        }
1893        else
1894        {
1895                changetext(b4, _("ADD FAV"));
1896                b5->hidden = YES;
1897        }
1898
1899        drawscreen(load, 0, 0);
1900
1901        if(titheklink == NULL) return;
1902
1903        listbox->aktpage = -1;
1904        listbox->aktline = 1;
1905        listbox->gridcol = 0;
1906        listbox->select = NULL;
1907
1908        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, first);
1909        if(pagecount == 0) return;
1910
1911        changetitle(grid, _(title));
1912        drawscreen(grid, 0, 0);
1913        addscreenrc(grid, listbox);
1914
1915        while(1)
1916        {
1917                changetitle(grid, _(title));
1918                changetext(countpage, NULL);
1919                if(listbox->select != NULL && listbox->select->handle != NULL)
1920                {
1921                        tmp = listbox->select;
1922                        while(tmp != NULL)
1923                        {
1924
1925                                if(tmp->pagecount != listbox->aktpage) break;
1926
1927                                char* tmpstr = ostrcat(_("Page"), NULL, 0, 0);
1928                                tmpstr = ostrcat(tmpstr, " ( ", 1, 0);
1929                                tmpstr = ostrcat(tmpstr, oitoa(tmp->pagecount), 1, 1);
1930                                tmpstr = ostrcat(tmpstr, " / ", 1, 0);
1931                                tmpstr = ostrcat(tmpstr, oitoa(pagecount), 1, 1);
1932                                tmpstr = ostrcat(tmpstr, " )", 1, 0);
1933                                changetext(countpage, tmpstr);
1934                                free(tmpstr); tmpstr = NULL;
1935
1936                                if(tmp->handle != NULL && getconfigint("tithek_view", NULL) != 6 && getconfigint("tithek_cover", NULL) != 6)
1937                                {
1938                                        tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0);
1939
1940                                        /* not working with thread download
1941                                        off64_t checkpic = getfilesize(tithekpic);
1942
1943                                        if(checkpic < 1000)
1944                                        {
1945                                                free(tithekpic); tithekpic = NULL;
1946                                                tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0);
1947                                        }
1948                                        */
1949
1950                                        changepic(tmp, tithekpic);
1951                                        free(tithekpic); tithekpic = NULL;
1952                                }
1953                                tmp = tmp->prev;
1954                        }
1955                        tmp = listbox->select;
1956                        if(tmp != NULL) tmp = tmp->next;
1957                        while(tmp != NULL)
1958                        {
1959                                if(tmp->pagecount != listbox->aktpage) break;
1960                                if(tmp->handle != NULL && getconfigint("tithek_view", NULL) != 6 && getconfigint("tithek_cover", NULL) != 6)
1961                                {
1962                                        tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0);
1963
1964                                        /* not working with thread download
1965                                        off64_t checkpic = getfilesize(tithekpic);
1966
1967                                        if(checkpic < 1000)
1968                                        {
1969                                                free(tithekpic); tithekpic = NULL;
1970                                                tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0);
1971                                        }
1972                                        */
1973
1974                                        changepic(tmp, tithekpic);
1975                                        free(tithekpic); tithekpic = NULL;
1976                                }
1977                                tmp = tmp->next;
1978                        }
1979                }
1980
1981                int count = getfilecount(TITHEKPATH);
1982                if(count > 500)
1983                        delallfiles(TITHEKPATH, ".jpg");
1984
1985waitrcstart:
1986                drawscreen(grid, 0, 0);
1987
1988                rcret = waitrc(grid, 2000, 2);
1989
1990                if(rcret == RCTIMEOUT)
1991                {
1992                        if(tithekdownloadrun == 1)
1993                        {
1994                                tithekdownloadrun = 0;
1995                                drawscreen(grid, 0, 0);
1996                        }
1997                        goto waitrcstart;
1998                }
1999
2000                if(rcret == getrcconfigint("rcblue", NULL))
2001                {
2002                        tithekexit = 1;
2003                        break;
2004                }
2005
2006                if(rcret == getrcconfigint("rcexit", NULL)) break;
2007                if(rcret == getrcconfigint("rcmenu", NULL))
2008                {
2009                        screentithek_settings();
2010
2011                        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, first);
2012                        if(pagecount == 0 || tithekexit == 1) break;
2013
2014                        listbox->aktpage = -1;
2015                        listbox->aktline = 1;
2016                        listbox->gridcol = 1;
2017                        addscreenrc(grid, listbox);
2018//                      drawscreen(grid, 0, 0);
2019                }
2020
2021//              if(ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0)
2022                if(ostrstr(title, _("Tithek - Mainmenu - Favoriten")) != NULL)
2023                {
2024//                      changetext(b4, _("EDIT FAV"));
2025                        b5->hidden = NO;
2026                }
2027                else
2028                {
2029//                      changetext(b4, _("ADD FAV"));
2030                        b5->hidden = YES;
2031                }
2032
2033                if(rcret == getrcconfigint("rcred", NULL))
2034                {
2035                        if(listbox->select != NULL && listbox->select->handle != NULL)
2036                        {
2037
2038                                char* tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->title, NULL, 0, 0);
2039                                debug(99, "tmpstr: %s", tmpstr);
2040                                tmpstr = string_replace("-1 (de)", "", tmpstr, 1);
2041                                tmpstr = string_replace("-1 (en)", "", tmpstr, 1);
2042                                tmpstr = string_replace("-1 (\?\?)", "", tmpstr, 1);
2043                                tmpstr = string_replace("-2 (de)", "", tmpstr, 1);
2044                                tmpstr = string_replace("-2 (en)", "", tmpstr, 1);
2045                                tmpstr = string_replace("-2 (\?\?)", "", tmpstr, 1);
2046                                tmpstr = string_replace("-3 (de)", "", tmpstr, 1);
2047                                tmpstr = string_replace("-3 (en)", "", tmpstr, 1);
2048                                tmpstr = string_replace("-3 (\?\?)", "", tmpstr, 1);
2049                                tmpstr = string_replace(" (de)", "", tmpstr, 1);
2050                                tmpstr = string_replace(" (en)", "", tmpstr, 1);
2051                                tmpstr = string_replace(" (\?\?)", "", tmpstr, 1);
2052                                tmpstr = string_replace_all("_", " ", tmpstr, 1);
2053                                tmpstr = string_replace_all("-", " ", tmpstr, 1);
2054                                tmpstr = string_replace_all(".", " ", tmpstr, 1);
2055                                debug(99, "tmpstr: %s", tmpstr);
2056
2057                                int check = playrcred(tmpstr, NULL, 1, 0, 99);
2058                                if(check == 0 || check == 1000)
2059                                {
2060                                        char* search = textinputhist(_("Create sub folder"), " ", "searchhist");
2061                                        if(search != NULL)
2062                                        {
2063                                                strstrip(search);
2064                                                char* tmpstr = ostrcat(search, NULL, 0, 0);
2065                                                tmpstr = string_replace_all(" ", "_", tmpstr, 1);
2066                                                tmpstr = string_replace_all(".", "_", tmpstr, 1);
2067                                                tmpstr = string_replace_all("-", "_", tmpstr, 1);
2068                                                tmpstr = string_replace_all("._.", "_", tmpstr, 1);
2069                                                tmpstr = string_replace_all("__", "_", tmpstr, 1);
2070                                                string_tolower(tmpstr);
2071                                                strstrip(tmpstr);
2072                                                char* tmpstr1 = NULL;
2073                                                tmpstr1 = ostrcat(getconfig("tithek_fav", NULL), "_", 0, 0);
2074                                                tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0);
2075                                                if(textbox(_("Message"), _("Add this sub folder as Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1)
2076                                                        addfav(search, tmpstr1, "http://imageshack.us/md/up/grd/mediathek/menu/default.jpg", tmpstr, title, check);
2077                                                free(tmpstr), tmpstr = NULL;
2078                                                free(tmpstr1), tmpstr1 = NULL;
2079                                        }
2080                                        free(search), search = NULL;
2081
2082                                        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, 0);
2083                                        if(pagecount == 0) return;
2084                                }
2085                                else if(check == 2)
2086                                {
2087                                        if(kinox_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "KinoX - Search", tmpstr, 0) == 0)
2088                                                if(screenlistbox(grid, listbox, countlabel, "KinoX - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2089                                }
2090                                else if(check == 3)
2091                                {
2092                                        if(solarmovie_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "SolarMovies - Movie - Search", tmpstr, 0) == 0)
2093                                                if(screenlistbox(grid, listbox, countlabel, "SolarMovies - Movie - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2094                                }
2095                                else if(check == 4)
2096                                {
2097                                        if(solarmovie_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "SolarMovies - Tv - Search", tmpstr, 1) == 0)
2098                                                if(screenlistbox(grid, listbox, countlabel, "SolarMovies - Tv - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2099                                }
2100                                else if(check == 5)
2101                                {
2102                                        if(youtube_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Youtube - Search", tmpstr) == 0)
2103                                                if(screenlistbox(grid, listbox, countlabel, "Youtube - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2104                                }
2105                                else if(check == 6)
2106                                {
2107                                        if(myvideo_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "MyVideo - Search", tmpstr, 0) == 0)
2108                                                if(screenlistbox(grid, listbox, countlabel, "MyVideo - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2109                                }
2110                                else if(check == 7)
2111                                {
2112                                        if(movie4k_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "KinoX - Search", tmpstr, 0) == 0)
2113                                                if(screenlistbox(grid, listbox, countlabel, "Movie4k - Search", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2114                                }
2115                                else if(check == 8)
2116                                {
2117                                        if(kinox_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "KinoX - Search (local)", tmpstr, 0) == 0)
2118                                                if(screenlistbox(grid, listbox, countlabel, "KinoX - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2119                                }
2120                                else if(check == 9)
2121                                {
2122                                        if(solarmovie_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Solarmovies - Search (local)", tmpstr, 0) == 0)
2123                                                if(screenlistbox(grid, listbox, countlabel, "Solarmovies - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2124                                }
2125                                else if(check == 10)
2126                                {
2127                                        if(youtube_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Youtube - Search (local)", tmpstr, 0) == 0)
2128                                                if(screenlistbox(grid, listbox, countlabel, "Youtube - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2129                                }
2130                                else if(check == 11)
2131                                {
2132                                        if(myvideo_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "MyVideo - Search (local)", tmpstr, 0) == 0)
2133                                                if(screenlistbox(grid, listbox, countlabel, "MyVideo - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2134                                }
2135                                else if(check == 12)
2136                                {
2137                                        if(movie4k_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Movie4k - Search (local)", tmpstr, 0) == 0)
2138                                                if(screenlistbox(grid, listbox, countlabel, "Movie4k - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2139                                }
2140                                else if(check == 13)
2141                                {
2142                                        if(internetradio_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Internetradio - Search (local)", tmpstr, 0) == 0)
2143                                                if(screenlistbox(grid, listbox, countlabel, "Internetradio - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2144                                }
2145                                else if(check == 14)
2146                                {
2147                                        if(internettv_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Internettv - Search (local)", tmpstr, 0) == 0)
2148                                                if(screenlistbox(grid, listbox, countlabel, "Internettv - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2149                                }
2150                                else if(check == 15)
2151                                {
2152                                        if(ard_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "ARD - Search (local)", tmpstr, 0) == 0)
2153                                                if(screenlistbox(grid, listbox, countlabel, "ARD - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2154                                }
2155                                else if(check == 16)
2156                                {
2157                                        if(zdf_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "ZDF - Search (local)", tmpstr, 0) == 0)
2158                                                if(screenlistbox(grid, listbox, countlabel, "ZDF - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2159                                }
2160                                else if(check == 17)
2161                                {
2162                                        if(tectime_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "TecTime - Search (local)", tmpstr, 0) == 0)
2163                                                if(screenlistbox(grid, listbox, countlabel, "TecTime - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2164                                }
2165                                else if(check == 18)
2166                                {
2167                                        if(giga_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Giga - Search (local)", tmpstr, 0) == 0)
2168                                                if(screenlistbox(grid, listbox, countlabel, "Giga - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2169                                }
2170                                else if(check == 19)
2171                                {
2172                                        if(beeg_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Beeg - Search (local)", tmpstr, 0) == 0)
2173                                                if(screenlistbox(grid, listbox, countlabel, "Beeg - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2174                                }
2175                                else if(check == 20)
2176                                {
2177                                        if(nowtv_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Rtl2Now - Search (local)", tmpstr, 0) == 0)
2178                                                if(screenlistbox(grid, listbox, countlabel, "NowTv - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2179                                }
2180                                else if(check == 21)
2181                                {
2182                                        if(all_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Rtl-Now - Search (local)", tmpstr, 0) == 0)
2183                                                if(screenlistbox(grid, listbox, countlabel, "All - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2184                                }
2185                                else if(check == 24)
2186                                {
2187                                        if(xvideos_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Xvideos - Search (local)", tmpstr, 0) == 0)
2188                                                if(screenlistbox(grid, listbox, countlabel, "Xvideos - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2189                                }
2190                                else if(check == 25)
2191                                {
2192                                        if(mlehd_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Mle-HD - Search (local)", tmpstr, 0) == 0)
2193                                                if(screenlistbox(grid, listbox, countlabel, "Mle-HD - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2194                                }
2195                                else if(check == 26)
2196                                {
2197                                        if(netzkino_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "Netzkino - Search (local)", tmpstr, 0) == 0)
2198                                                if(screenlistbox(grid, listbox, countlabel, "Netzkino - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2199                                }
2200                                else if(check == 27)
2201                                {
2202                                        if(filmon_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "FilmOn - Search (local)", tmpstr, 0) == 0)
2203                                                if(screenlistbox(grid, listbox, countlabel, "FilmOn - Search (local)", titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2204                                }
2205/*
2206why ?
2207                                else if((((struct tithek*)listbox->select->handle)->flag == 13))
2208                                {
2209                                        if(myvideo_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, "MyVideo - Search", tmpstr, 0) == 0)
2210                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2211                                }
2212*/
2213                                free(tmpstr), tmpstr = NULL;
2214                        }
2215                        else
2216                        {
2217                                int check = playrcred(NULL, NULL, 1, 0, 199);
2218                                if(check == 0 || check == 1000)
2219                                {
2220                                        char* search = textinputhist(_("Create sub folder"), " ", "searchhist");
2221                                        if(search != NULL)
2222                                        {
2223                                                strstrip(search);
2224                                                char* tmpstr = ostrcat(search, NULL, 0, 0);
2225                                                tmpstr = string_replace_all(" ", "_", tmpstr, 1);
2226                                                tmpstr = string_replace_all(".", "_", tmpstr, 1);
2227                                                tmpstr = string_replace_all("-", "_", tmpstr, 1);
2228                                                tmpstr = string_replace_all("._.", "_", tmpstr, 1);
2229                                                tmpstr = string_replace_all("__", "_", tmpstr, 1);
2230                                                string_tolower(tmpstr);
2231                                                strstrip(tmpstr);
2232                                                char* tmpstr1 = NULL;
2233                                                tmpstr1 = ostrcat(getconfig("tithek_fav", NULL), "_", 0, 0);
2234                                                tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0);
2235                                                if(textbox(_("Message"), _("Add this sub folder as Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1)
2236                                                        addfav(search, tmpstr1, "http://imageshack.us/md/up/grd/mediathek/menu/default.jpg", tmpstr, title, check);
2237                                                free(tmpstr), tmpstr = NULL;
2238                                                free(tmpstr1), tmpstr1 = NULL;
2239                                        }
2240                                        free(search), search = NULL;
2241
2242                                        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, 0);
2243                                        if(pagecount == 0) return;
2244                                }
2245                        }
2246                }
2247                else if(rcret == getrcconfigint("rcok", NULL))
2248                {
2249                        if(listbox->select != NULL && listbox->select->handle != NULL)
2250                        {
2251                                clearscreen(grid);
2252
2253                                if(((struct tithek*)listbox->select->handle)->flag == 2 || ((struct tithek*)listbox->select->handle)->flag == 3 || ((struct tithek*)listbox->select->handle)->flag == 4 || ((struct tithek*)listbox->select->handle)->flag == 5 || ((struct tithek*)listbox->select->handle)->flag == 6 || ((struct tithek*)listbox->select->handle)->flag == 12 || ((struct tithek*)listbox->select->handle)->flag == 14 || ((struct tithek*)listbox->select->handle)->flag == 15 || ((struct tithek*)listbox->select->handle)->flag == 20 || ((struct tithek*)listbox->select->handle)->flag == 38 || ((struct tithek*)listbox->select->handle)->flag == 42 || ((struct tithek*)listbox->select->handle)->flag == 45 || ((struct tithek*)listbox->select->handle)->flag == 46 || ((struct tithek*)listbox->select->handle)->flag == 64 || ((struct tithek*)listbox->select->handle)->flag == 50 || ((struct tithek*)listbox->select->handle)->flag == 41 || ((struct tithek*)listbox->select->handle)->flag == 43 || ((struct tithek*)listbox->select->handle)->flag == 75 || ((struct tithek*)listbox->select->handle)->flag == 91 || ((struct tithek*)listbox->select->handle)->flag == 92 || ((struct tithek*)listbox->select->handle)->flag == 93 || ((struct tithek*)listbox->select->handle)->flag == 94 || ((struct tithek*)listbox->select->handle)->flag == 98 || ((struct tithek*)listbox->select->handle)->flag == 111)
2254                                {
2255                                        submenu(listbox, load, title);
2256//                                      drawscreen(grid, 0, 0);
2257                                }
2258                                else if((((struct tithek*)listbox->select->handle)->flag == 9) || (((struct tithek*)listbox->select->handle)->flag == 10) || (((struct tithek*)listbox->select->handle)->flag == 11))
2259                                {
2260                                        if(youtube_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL) == 0)
2261                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2262                                }
2263                                else if(((struct tithek*)listbox->select->handle)->flag == 13)
2264                                {
2265                                        if(myvideo_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2266                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2267                                }
2268                                else if(((struct tithek*)listbox->select->handle)->flag == 24)
2269                                {
2270                                        if(internetradio_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2271                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2272                                }
2273                                else if(((struct tithek*)listbox->select->handle)->flag == 25)
2274                                {
2275                                        if(kinox_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2276                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2277                                }
2278                                else if(((struct tithek*)listbox->select->handle)->flag == 26)
2279                                {
2280                                        if(movie4k_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2281                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2282                                }
2283                                else if(((struct tithek*)listbox->select->handle)->flag == 27)
2284                                {
2285                                        if(solarmovie_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2286                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2287                                }
2288                                else if(((struct tithek*)listbox->select->handle)->flag == 47)
2289                                {
2290                                        if(internettv_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2291                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2292                                }
2293                                else if(((struct tithek*)listbox->select->handle)->flag == 48)
2294                                {
2295                                        if(youtube_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2296                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2297                                }
2298                                else if(((struct tithek*)listbox->select->handle)->flag == 49)
2299                                {
2300                                        if(myvideo_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2301                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2302                                }
2303                                else if(((struct tithek*)listbox->select->handle)->flag == 51)
2304                                {
2305                                        if(ard_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2306                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2307                                }
2308                                else if(((struct tithek*)listbox->select->handle)->flag == 52)
2309                                {
2310                                        if(zdf_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2311                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2312                                }
2313                                else if(((struct tithek*)listbox->select->handle)->flag == 53)
2314                                {
2315                                        if(tectime_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2316                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2317                                }
2318                                else if(((struct tithek*)listbox->select->handle)->flag == 54)
2319                                {
2320                                        if(giga_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2321                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2322                                }
2323                                else if(((struct tithek*)listbox->select->handle)->flag == 55)
2324                                {
2325                                        if(beeg_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2326                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2327                                }
2328                                else if(((struct tithek*)listbox->select->handle)->flag == 100)
2329                                {
2330                                        if(all_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2331                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2332                                }
2333                                else if(((struct tithek*)listbox->select->handle)->flag == 60)
2334                                {
2335                                        if(xvideos_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2336                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2337                                }
2338                                else if(((struct tithek*)listbox->select->handle)->flag == 61)
2339                                {
2340                                        if(mlehd_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2341                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2342                                }
2343                                else if(((struct tithek*)listbox->select->handle)->flag == 62)
2344                                {
2345                                        if(netzkino_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2346                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2347                                }
2348                                else if(((struct tithek*)listbox->select->handle)->flag == 63)
2349                                {
2350                                        if(filmon_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2351                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2352                                }
2353                                else if(((struct tithek*)listbox->select->handle)->flag == 65)
2354                                {
2355                                        if(tvtoast_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2356                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2357                                }
2358                                else if(((struct tithek*)listbox->select->handle)->flag == 44)
2359                                {
2360                                        if(myvideo_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
2361                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2362                                }
2363                                else if((((struct tithek*)listbox->select->handle)->flag == 21))
2364                                {
2365                                        if(kinox_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2366                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2367                                }
2368                                else if((((struct tithek*)listbox->select->handle)->flag == 33))
2369                                {
2370                                        if(movie4k_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2371                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2372                                }
2373                                else if(((struct tithek*)listbox->select->handle)->flag == 29)
2374                                {
2375                                        if(solarmovie_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2376                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2377                                }
2378                                else if(((struct tithek*)listbox->select->handle)->flag == 30)
2379                                {
2380                                        if(solarmovie_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
2381                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2382                                }
2383                                else if((((struct tithek*)listbox->select->handle)->flag == 31))
2384                                {
2385                                        if(kinox_search_cast(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL) == 0)
2386                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2387                                }
2388                                else if((((struct tithek*)listbox->select->handle)->flag == 32))
2389                                {
2390                                        if(kinox_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
2391                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2392                                }
2393                                else if((((struct tithek*)listbox->select->handle)->flag == 33))
2394                                {
2395                                        if(movie4k_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
2396                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 3) == 0) break;
2397                                }
2398                                else if((((struct tithek*)listbox->select->handle)->flag == 34) || (((struct tithek*)listbox->select->handle)->flag == 35))
2399                                {
2400                                        if(movie4k_hoster(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2401                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2402                                }
2403                                else if((((struct tithek*)listbox->select->handle)->flag == 22))
2404                                {
2405                                        if(kinox_hoster(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2406                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 3) == 0) break;
2407                                }
2408                                else if((((struct tithek*)listbox->select->handle)->flag == 28))
2409                                {
2410                                        if(solarmovie_hoster(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2411                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 3) == 0) break;
2412                                }
2413                                else if((((struct tithek*)listbox->select->handle)->flag == 23))
2414                                {
2415                                        if(kinox_hoster_series(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2416                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2417                                }
2418                                else if((((struct tithek*)listbox->select->handle)->flag == 36) || (((struct tithek*)listbox->select->handle)->flag == 37))
2419                                {
2420                                        if(movie4k_series(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2421                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2422                                }
2423                                else if((((struct tithek*)listbox->select->handle)->flag == 39))
2424                                {
2425                                        if(movie4k_series_listed(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2426                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2427                                }
2428                                else if((((struct tithek*)listbox->select->handle)->flag == 40))
2429                                {
2430                                        if(movie4k_hoster_series(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2431                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2432                                }
2433                                else if(((struct tithek*)listbox->select->handle)->flag == 76)
2434                                {
2435                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2436                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2437                                }
2438                                else if(((struct tithek*)listbox->select->handle)->flag == 77)
2439                                {
2440                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 1) == 0)
2441                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2442                                }
2443                                else if(((struct tithek*)listbox->select->handle)->flag == 78)
2444                                {
2445                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 2) == 0)
2446                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2447                                }
2448                                else if(((struct tithek*)listbox->select->handle)->flag == 79)
2449                                {
2450                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 3) == 0)
2451                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2452                                }
2453                                else if(((struct tithek*)listbox->select->handle)->flag == 80)
2454                                {
2455                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 4) == 0)
2456                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2457                                }
2458                                else if(((struct tithek*)listbox->select->handle)->flag == 81)
2459                                {
2460                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 5) == 0)
2461                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2462                                }
2463                                else if(((struct tithek*)listbox->select->handle)->flag == 82)
2464                                {
2465                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 6) == 0)
2466                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2467                                }
2468                                else if(((struct tithek*)listbox->select->handle)->flag == 83)
2469                                {
2470                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 7) == 0)
2471                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2472                                }
2473                                else if(((struct tithek*)listbox->select->handle)->flag == 84)
2474                                {
2475                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 8) == 0)
2476                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2477                                }
2478                                else if(((struct tithek*)listbox->select->handle)->flag == 85)
2479                                {
2480                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 9) == 0)
2481                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2482                                }
2483                                else if(((struct tithek*)listbox->select->handle)->flag == 86)
2484                                {
2485                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 10) == 0)
2486                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2487                                }
2488                                else if(((struct tithek*)listbox->select->handle)->flag == 87)
2489                                {
2490                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 11) == 0)
2491                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2492                                }
2493                                else if(((struct tithek*)listbox->select->handle)->flag == 88)
2494                                {
2495                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 12) == 0)
2496                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2497                                }
2498                                else if(((struct tithek*)listbox->select->handle)->flag == 89)
2499                                {
2500                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 13) == 0)
2501                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2502                                }
2503                                else if(((struct tithek*)listbox->select->handle)->flag == 90)
2504                                {
2505                                        if(amazon_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 14) == 0)
2506                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2507                                }
2508                                else if((((struct tithek*)listbox->select->handle)->flag == 95) || (((struct tithek*)listbox->select->handle)->flag == 96))
2509                                {
2510                                        if(movie2k_hoster(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2511                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2512                                }
2513                                else if(((struct tithek*)listbox->select->handle)->flag == 97)
2514                                {
2515                                        if(movie2k_search_local(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2516                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2517                                }
2518                                else if((((struct tithek*)listbox->select->handle)->flag == 66))
2519                                {
2520                                        textbox(_("Message"), _("The hoster is not yet supported !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0);
2521                                        continue;
2522                                }
2523                                else if((((struct tithek*)listbox->select->handle)->flag == 112))
2524                                {
2525//                                      if(localparser_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title) == 0)
2526//                                              if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2527                                        if(localparser_search(grid, listbox, countlabel, load, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->title, NULL, 0) == 0)
2528                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2529                                }
2530                                else if((((struct tithek*)listbox->select->handle)->flag == 3))
2531                                {
2532                                        int pincheck = 0;
2533                                        if(((struct tithek*)listbox->select->handle)->flag == 1000)
2534                                                pincheck = screenpincheck(0, NULL);
2535                                        if(pincheck == 0)
2536                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 3, 0) == 0) break;
2537                                }
2538                                else
2539                                {
2540                                        int pincheck = 0;
2541                                        if(((struct tithek*)listbox->select->handle)->flag == 1000)
2542                                                pincheck = screenpincheck(0, NULL);
2543                                        if(pincheck == 0)
2544                                                if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 3) == 0) break;
2545                                }
2546// new osd musst disable this
2547                                drawscreen(grid, 0, 0);
2548                        }
2549                }
2550                else if(rcret == getrcconfigint("rcinfo", NULL))
2551                {
2552                        if(listbox->select != NULL && listbox->select->handle != NULL)
2553                        {
2554                                if(showinfo(listbox, ((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag) == 0)
2555                                        if(screenlistbox(grid, listbox, countlabel, title, titheklink, &pagecount, &tithekexit, &oaktpage, &oaktline, &ogridcol, 0, 0) == 0) break;
2556                        }
2557
2558                }
2559//              else if(rcret == getrcconfigint("rcyellow", NULL) && ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0)
2560                else if(rcret == getrcconfigint("rcyellow", NULL) && ostrstr(title, _("Tithek - Mainmenu - Favoriten")) != NULL)
2561                {
2562                        if(listbox->select != NULL && listbox->select->handle != NULL)
2563                        {
2564                                if(textbox(_("Message"), _("Remove this Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0) == 1)
2565                                {
2566                                        removefav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag);
2567                                        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, 0);
2568                                        if(pagecount == 0) return;
2569
2570//                                      drawscreen(grid, 0, 0);
2571                                }
2572                        }
2573                }
2574//              else if(rcret == getrcconfigint("rcgreen", NULL) && ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) != 0)
2575//              else if(rcret == getrcconfigint("rcgreen", NULL) && (ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0 || !ostrncmp("/", ((struct tithek*)listbox->select->handle)->link, 1)))
2576                else if(rcret == getrcconfigint("rcgreen", NULL) && ostrstr(title, _("Tithek - Mainmenu - Favoriten")) == NULL)
2577                {
2578                        if(listbox->select != NULL && listbox->select->handle != NULL)
2579                        {
2580                                if(textbox(_("Message"), _("Add this link as Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0) == 1)
2581                                {
2582                                        addfav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag);
2583                                }
2584                        }
2585                }
2586//              else if(rcret == getrcconfigint("rcgreen", NULL) && ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0)
2587//              else if(rcret == getrcconfigint("rcgreen", NULL) && (ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0 || !ostrncmp("/", ((struct tithek*)listbox->select->handle)->link, 1)))
2588                else if(rcret == getrcconfigint("rcgreen", NULL) && ostrstr(title, _("Tithek - Mainmenu - Favoriten")) != NULL)
2589                {
2590                        if(listbox->select != NULL && listbox->select->handle != NULL)
2591                        {
2592                                if(textbox(_("Message"), _("Edit this Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 5, 0) == 1)
2593                                {
2594                                        editfav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag);
2595                                        pagecount = createtithekplay(titheklink, grid, listbox, countlabel, 0);
2596                                        if(pagecount == 0) return;
2597
2598//                                      drawscreen(grid, 0, 0);
2599                                }
2600                        }
2601                }
2602
2603//              if(ostrcmp(title, _("Tithek - Mainmenu - Favoriten")) == 0)
2604                if(ostrstr(title, _("Tithek - Mainmenu - Favoriten")) != NULL)
2605                {
2606                        changetext(b4, _("EDIT FAV"));
2607                        b5->hidden = NO;
2608                }
2609                else
2610                {
2611                        changetext(b4, _("ADD FAV"));
2612                        b5->hidden = YES;
2613                }
2614
2615// new osd musst disable this
2616                drawscreen(grid, 0, 0);
2617
2618        }
2619
2620//      amazon_deinit();
2621
2622        delmarkedscreennodes(grid, 1);
2623        delownerrc(grid);
2624        clearscreen(grid);
2625
2626        if(first == 1)
2627        {
2628                setvol(savevol);
2629
2630                freetithek();
2631                delallfiles("/tmp/tithek", NULL);
2632                system("rm -rf /tmp/localhoster");
2633                system("rm -rf /tmp/localparser");
2634                system("rm -rf /tmp/localcache");
2635                system("rm -rf /tmp/parser");
2636
2637                python = 0;
2638
2639                if(status.mcaktiv == 0)
2640                        servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0);
2641        }
2642}
2643
2644#endif
Note: See TracBrowser for help on using the repository browser.