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

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

tithek show streamed files green, show fav files blue and show python not ready status red in hoster list and fiy kino mirroe 1 only files

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