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

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

fix

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