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

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

[tithek] amazon add watchlist and optimize login add logout

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