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

Last change on this file since 44846 was 44846, checked in by obi, 4 years ago

tithek add debug

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