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

Last change on this file since 41291 was 41291, checked in by obi, 6 years ago

update tithek add hlsdl support

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