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

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

optimize msg size

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