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

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

update tithek

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