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

Last change on this file since 36605 was 36605, checked in by obi, 8 years ago

fix

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