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

Last change on this file since 41544 was 41544, checked in by obi, 5 years ago

enable https downloads

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