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

Last change on this file since 35495 was 35495, checked in by obi, 9 years ago

update tithek

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