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

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

[tithek] ad movie2k local search

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