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

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

fix

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