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

Last change on this file since 18028 was 18028, checked in by obi, 12 years ago

[titan] update tithek add StreamCloud.eu hoster optimize other hoster

File size: 24.3 KB
Line 
1#ifndef TITHEK_H
2#define TITHEK_H
3
4#define TITHEKPATH "/tmp/tithek"
5
6//flag 0        - menu
7//flag 1        - menu pay hidden tithek_pay=0/1 0=hidden
8//flag 2        - http (default streamurl)
9//flag 4        - youtube
10//flag 5        - rtl2now
11//flag 6        - superrtlnow
12//flag 7        - rtlnow
13//flag 8        - voxnow
14//flag 9        - youtube suche 10
15//flag 10       - youtube suche 25
16//flag 11       - youtube suche 50
17//flag 12       - myvideo
18//flag 13       - myvideo search 50
19//flag 14       - kinox putlocker/sockshare
20//flag 15       - kinox filenuke
21//flag 16       - superrtlnow pay
22//flag 17       - rtlnow pay
23//flag 18       - voxnow pay
24//flag 19       - rtl2now pay
25//flag 20       - kinox StreamCloud
26//flag 1000 - menu pincode
27//flag 9999 - menu hidden codecpack
28
29struct tithek
30{
31        char* title;
32        char* link;
33        char* pic;
34        char* localname;
35        char* menutitle;       
36        int flag;
37        struct tithek* prev;
38        struct tithek* next;
39};
40struct tithek *tithek = NULL;
41
42struct tithek* addtithek(char *line, int count, struct tithek* last)
43{
44        //debug(1000, "in");
45        struct tithek *newnode = NULL, *prev = NULL, *node = tithek;
46        char *link = NULL, *pic = NULL, *title = NULL, *localname = NULL, *menutitle = NULL, *cmd = NULL;
47        int ret = 0, skip = 0;
48
49        if(line == NULL) return NULL;
50
51        newnode = (struct tithek*)malloc(sizeof(struct tithek));       
52        if(newnode == NULL)
53        {
54                err("no memory");
55                return NULL;
56        }
57
58        link = malloc(MINMALLOC);
59        if(link == NULL)
60        {
61                err("no memory");
62                free(newnode);
63                return NULL;
64        }
65
66        pic = malloc(MINMALLOC);
67        if(pic == NULL)
68        {
69                err("no memory");
70                free(newnode);
71                free(link);
72                return NULL;
73        }
74
75        title = malloc(MINMALLOC);
76        if(title == NULL)
77        {
78                err("no memory");
79                free(newnode);
80                free(link);
81                free(pic);
82                return NULL;
83        }
84
85        localname = malloc(MINMALLOC);
86        if(localname == NULL)
87        {
88                err("no memory");
89                free(newnode);
90                free(link);
91                free(pic);
92                free(title);
93                return NULL;
94        }
95
96        menutitle = malloc(MINMALLOC);
97        if(menutitle == NULL)
98        {
99                err("no memory");
100                free(newnode);
101                free(link);
102                free(pic);
103                free(title);
104                free(localname);               
105                return NULL;
106        }
107
108        int pay = getconfigint("tithek_pay", NULL);
109
110        memset(newnode, 0, sizeof(struct tithek));
111                       
112        ret = sscanf(line, "%[^#]#%[^#]#%[^#]#%[^#]#%[^#]#%d", title, link, pic, localname, menutitle, &newnode->flag);
113                               
114        if(newnode->flag == 9999 && !file_exist("/var/swap/etc/.codecpack"))
115        {
116                skip = 1;
117        }
118        else if(newnode->flag == 16 && pay == 0)
119        {
120                skip = 1;
121        }
122        else if(newnode->flag == 17 && pay == 0)
123        {
124                skip = 1;
125        }
126        else if(newnode->flag == 18 && pay == 0)
127        {
128                skip = 1;
129        }
130        else if(newnode->flag == 19 && pay == 0)
131        {
132                skip = 1;
133        }
134        else if(newnode->flag == 1 && pay == 0)
135        {
136                skip = 1;
137        }               
138        else if(newnode->flag == 9999)
139        {
140                cmd = ostrcat(cmd, "wget -s http://", 1, 0);
141                cmd = ostrcat(cmd, "kin", 1, 0);
142                cmd = ostrcat(cmd, "ox", 1, 0);
143                cmd = ostrcat(cmd, ".", 1, 0);
144                cmd = ostrcat(cmd, "to", 1, 0);
145
146                if(system(cmd) != 0)
147                        skip = 1;
148
149                free(cmd), cmd = NULL;
150        }
151
152        if(skip == 1)
153        {
154                free(link);
155                free(pic);
156                free(title);
157                free(localname);
158                free(menutitle);
159                free(newnode);
160                return NULL;
161        }
162
163        if(ret != 6)
164        {
165                if(count > 0)
166                {
167                        err("tithek line %d not ok or double", count);
168                }
169                else
170                {
171                        err("add tithek");
172                }
173                free(link);
174                free(pic);
175                free(title);
176                free(localname);
177                free(menutitle);
178                free(newnode);
179                return NULL;
180        }
181
182        newnode->link = ostrcat(link, "", 1, 0);
183        newnode->pic = ostrcat(pic, "", 1, 0);
184        newnode->title = ostrcat(title, "", 1, 0);
185        newnode->localname = ostrcat(localname, "", 1, 0);
186        newnode->menutitle = ostrcat(menutitle, "", 1, 0);
187
188        if(last == NULL)
189        {
190                while(node != NULL)
191                {
192                        prev = node;
193                        node = node->next;
194                }
195        }
196        else
197        {
198                prev = last;
199                node = last->next;
200        }
201
202        if(prev == NULL)
203                tithek = newnode;
204        else
205        {
206                prev->next = newnode;
207                newnode->prev = prev;
208        }
209        newnode->next = node;
210        if(node != NULL) node->prev = newnode;
211       
212        //debug(1000, "out");
213        return newnode;
214}
215
216int readtithek(const char* filename)
217{
218        debug(1000, "in");
219        FILE *fd = NULL;
220        char *fileline = NULL;
221        int linecount = 0;
222        struct tithek* last = NULL, *tmplast = NULL;
223
224        fileline = malloc(MINMALLOC);
225        if(fileline == NULL)
226        {
227                err("no memory");
228                return 0;
229        }
230
231        fd = fopen(filename, "r");
232        if(fd == NULL)
233        {
234                perr("can't open %s", filename);
235                free(fileline);
236                return 0;
237        }
238
239        while(fgets(fileline, MINMALLOC, fd) != NULL)
240        {
241                if(fileline[0] == '#' || fileline[0] == '\n')
242                        continue;
243                if(fileline[strlen(fileline) - 1] == '\n')
244                        fileline[strlen(fileline) - 1] = '\0';
245                if(fileline[strlen(fileline) - 1] == '\r')
246                        fileline[strlen(fileline) - 1] = '\0';
247
248                linecount++;
249
250                if(last == NULL) last = tmplast;
251                last = addtithek(fileline, linecount, last);
252                if(last != NULL) tmplast = last;
253        }
254
255        free(fileline);
256        fclose(fd);
257        return linecount;
258}
259
260int deltithek(char* link)
261{
262        debug(1000, "in");
263        int ret = 1;
264        struct tithek *node = tithek, *prev = tithek;
265
266        while(node != NULL)
267        {
268                if(ostrcmp(link, node->link) == 0)
269                {
270                        ret = 0;
271                        if(node == tithek)
272                        {
273                                tithek = node->next;
274                                if(tithek != NULL)
275                                        tithek->prev = NULL;
276                        }
277                        else
278                        {
279                                prev->next = node->next;
280                                if(node->next != NULL)
281                                        node->next->prev = prev;
282                        }
283
284                        free(node->link);
285                        node->link = NULL;
286
287                        free(node->pic);
288                        node->pic = NULL;
289
290                        free(node->title);
291                        node->title = NULL;
292
293                        free(node->localname);
294                        node->localname = NULL;
295
296                        free(node->menutitle);
297                        node->menutitle = NULL;
298
299                        free(node);
300                        node = NULL;
301
302                        break;
303                }
304
305                prev = node;
306                node = node->next;
307        }
308
309        debug(1000, "out");
310        return ret;
311}
312
313void freetithek()
314{
315        debug(1000, "in");
316        struct tithek *node = tithek, *prev = tithek;
317
318        while(node != NULL)
319        {
320                prev = node;
321                node = node->next;
322                if(prev != NULL)
323                        deltithek(prev->link);
324        }
325        debug(1000, "out");
326}
327
328char* tithekdownload(char* link, char* localname, char* pw, int pic, int flag)
329{
330        int ret = 1;
331        char* ip = NULL, *pos = NULL, *path = NULL;
332        char* tmpstr = NULL, *localfile = NULL;
333
334        if(link == NULL) return NULL;
335
336        ip = string_replace("http://", "", (char*)link, 0);
337
338        if(ip != NULL)
339                pos = strchr(ip, '/');
340        if(pos != NULL)
341        {
342                pos[0] = '\0';
343                path = pos + 1;
344        }
345
346        tmpstr = ostrcat(path, NULL, 0, 0);
347
348        if(flag == 0)
349        {
350                localfile = ostrcat(TITHEKPATH, "/", 0, 0);
351                if(localname == NULL)
352                        localfile = ostrcat(localfile, basename(tmpstr), 1, 0);
353                else
354                        localfile = ostrcat(localfile, localname, 1, 0);
355        }
356        else
357        {
358                localfile = ostrcat(getconfig("rec_path", NULL), "/", 0, 0);
359                if(localname == NULL)
360                        localfile = ostrcat(localfile, basename(tmpstr), 1, 0);
361                else
362                        localfile = ostrcat(localfile, localname, 1, 0);
363        }
364
365        if(flag == 0)
366        {
367                if(!file_exist(localfile))
368                {
369                        if(pic == 1)
370                                gethttp(ip, path, 80, localfile, pw, NULL, 0);
371                        else
372                                gethttp(ip, path, 80, localfile, pw, NULL, 0);                 
373                }
374        }
375        else
376        {
377                if(file_exist(localfile))
378                        ret = textbox(_("Message"), _("File exist, overwrite?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
379
380                if(ret == 1)
381                        screendownload("Download", ip, path, 80, localfile, pw, 0);
382        }
383
384        free(ip); ip = NULL;
385        free(tmpstr); tmpstr = NULL;
386
387        return localfile;
388}
389
390int createtithekplay(char* titheklink, struct skin* grid, struct skin* listbox, struct skin* countlabel)
391{
392        int gridbr = 0, posx = 0, count = 0, sumcount = 0, count1 = 0, pagecount = 0, skip = 0;
393        struct skin* tmp = NULL;
394        char* tithekfile = NULL;
395        char* tmpstr = NULL;
396
397        if(ostrstr(titheklink, "http://") != NULL)
398                tithekfile = tithekdownload(titheklink, NULL, HTTPAUTH, 0, 0);
399        else
400                tithekfile = ostrcat(titheklink, NULL, 0, 0);
401
402        delmarkedscreennodes(grid, 1);
403        freetithek();
404//      if(readtithek(tithekfile) != 0) return 1;
405        int linecount = readtithek(tithekfile);
406        if(linecount == 0) return 1;
407       
408        struct tithek* titheknode = tithek;
409
410        int height = 280;
411        int width = 390;
412        int picheight = 230;
413        int picwidth = 370;
414        int zcount = 3;
415        int fontsize = 20;
416        int pcount = 6;
417         
418        if(linecount > 8 && getconfigint("tithek_view", NULL) == 1)
419        {
420                height = 180;
421                width = 295;
422                picheight = 130;
423                picwidth = 270;
424                zcount = 4;
425                fontsize = 18;
426                pcount = 12;
427        }
428
429        while(titheknode != NULL)
430        {
431                tmp = addlistbox(grid, listbox, tmp, 1);
432                if(tmp != NULL)
433                {
434                        skip = 0;
435                        sumcount++;
436                        count++;
437                        count1++;
438                        if(gridbr == 0)
439                                tmp->type = GRIDBR;
440                        gridbr = 1;
441                        tmp->wrap = YES;
442
443                        tmp->picheight = picheight;
444                        tmp->picwidth = picwidth;
445
446                        tmp->fontsize = fontsize;
447                        tmp->height = height;
448                        tmp->width = width;
449                        tmp->prozwidth = 0;
450                        //tmp->bgcol = 0xffffff;
451                        tmp->bgspace = 1;
452                        tmp->vspace = 10;
453                        tmp->hspace = 10;
454                        tmp->posx = posx;
455                        //tmp->fontcol = 0x0000ff;
456                        tmp->halign = CENTER;
457                        tmp->valign = TEXTBOTTOM;
458                        changetext(tmp, titheknode->title);
459                        tmp->handle = (char*)titheknode;
460                        posx += tmp->width;
461                        if(count >= zcount)
462                        {
463                                count = 0;
464                                posx = 0;
465                                gridbr = 0;
466                        }
467                       
468                        if(count1 >= pcount)
469                        {
470                                count1 = 0;
471                                pagecount++;
472                                skip = 1;
473                        }
474                }
475                titheknode = titheknode->next;
476        }
477
478        if(skip == 0)
479                pagecount++;
480
481        tmpstr = oitoa(sumcount);
482
483        char* tmpstr1 = ostrcat(_("found"), NULL, 0, 0);
484        tmpstr1 = ostrcat(tmpstr1, " ", 1, 0);
485        tmpstr1 = ostrcat(tmpstr1, tmpstr, 1, 0);
486        free(tmpstr); tmpstr = NULL;
487        tmpstr1 = ostrcat(tmpstr1, " ", 1, 0);
488        tmpstr1 = ostrcat(tmpstr1, _("Results"), 1, 0);
489        changetext(countlabel, tmpstr1);
490        free(tmpstr1); tmpstr1 = NULL;
491       
492        free(tithekfile); tithekfile = NULL;
493        return pagecount;
494}
495
496void removefav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
497{
498        int count = 0, i = 0;
499        char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL;
500        struct splitstr* ret = NULL;
501
502        input = ostrcat(input, title, 1, 0);
503        input = ostrcat(input, "#", 1, 0);
504        input = ostrcat(input, link, 1, 0);
505        input = ostrcat(input, "#", 1, 0);
506        input = ostrcat(input, pic, 1, 0);
507        input = ostrcat(input, "#", 1, 0);
508        input = ostrcat(input, localname, 1, 0);
509        input = ostrcat(input, "#", 1, 0);
510        input = ostrcat(input, menutitle, 1, 0);
511        input = ostrcat(input, "#", 1, 0);
512        input = ostrcat(input, oitoa(flag), 1, 0);
513       
514        tmpstr = readfiletomem(getconfig("tithek_fav", NULL), 0);
515       
516        ret = strsplit(tmpstr, "\n", &count);
517
518        if(ret != NULL)
519        {
520                for(i = 0; i < count; i++)
521                {
522                        if(ostrcmp((ret[i]).part, input) != 0)
523                        {
524                                tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0);
525                                tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
526                        }
527                        else
528                                printf("remove: %s\n", ret[i].part);
529                }
530        }
531
532        if(tmpstr1 != NULL && strlen(tmpstr1) > 0)
533                tmpstr1[strlen(tmpstr1) - 1] = '\0';
534
535        writesys(getconfig("tithek_fav", NULL), tmpstr1, 0);
536
537        free(ret); ret = NULL;
538        free(tmpstr); tmpstr = NULL;
539        free(tmpstr1); tmpstr1 = NULL;
540        free(input); input = NULL;
541}
542
543void addfav(char* title, char* link, char* pic, char* localname, char* menutitle, int flag)
544{
545        int count = 0, i = 0;
546        char* tmpstr = NULL, *tmpstr1 = NULL, *input = NULL;
547        struct splitstr* ret = NULL;
548
549        input = ostrcat(input, title, 1, 0);
550        input = ostrcat(input, "#", 1, 0);
551        input = ostrcat(input, link, 1, 0);
552        input = ostrcat(input, "#", 1, 0);
553        input = ostrcat(input, pic, 1, 0);
554        input = ostrcat(input, "#", 1, 0);
555        input = ostrcat(input, localname, 1, 0);
556        input = ostrcat(input, "#", 1, 0);
557        input = ostrcat(input, menutitle, 1, 0);
558        input = ostrcat(input, "#", 1, 0);
559        input = ostrcat(input, oitoa(flag), 1, 0);
560       
561        tmpstr1 = ostrcat(tmpstr1, input, 1, 0);
562        tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
563
564        tmpstr = readfiletomem(getconfig("tithek_fav", NULL), 0);
565       
566        ret = strsplit(tmpstr, "\n", &count);
567
568        if(ret != NULL)
569        {
570                for(i = 0; i < count; i++)
571                {
572                        if(ostrcmp((ret[i]).part, input) != 0)
573                        {
574                                tmpstr1 = ostrcat(tmpstr1, ret[i].part, 1, 0);
575                                tmpstr1 = ostrcat(tmpstr1, "\n", 1, 0);
576                        }
577                }
578        }
579
580        if(tmpstr1 != NULL && strlen(tmpstr1) > 0)
581                tmpstr1[strlen(tmpstr1) - 1] = '\0';
582
583        writesys(getconfig("tithek_fav", NULL), tmpstr1, 0);
584
585        free(ret); ret = NULL;
586        free(tmpstr); tmpstr = NULL;
587        free(tmpstr1); tmpstr1 = NULL;
588        free(input); input = NULL;
589}
590
591void submenu(struct skin* listbox, struct skin* load)
592{
593        if(status.security == 1)
594        {
595                drawscreen(load, 0, 0);
596                char* tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0);
597                char* tmpstr1 = NULL;
598
599                if(((struct tithek*)listbox->select->handle)->flag == 4)
600                {
601                        if(tmpstr != NULL) tmpstr1 = youtube(tmpstr, NULL, NULL, 1);
602                }                                               
603                else if(((struct tithek*)listbox->select->handle)->flag == 5)
604                {
605                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl2now.rtl2.de", "rtl2now", 1);
606                }
607                else if(((struct tithek*)listbox->select->handle)->flag == 6)
608                {
609                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.superrtlnow.de", "superrtlnow", 1);
610                }
611                else if(((struct tithek*)listbox->select->handle)->flag == 7)
612                {
613                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl-now.rtl.de", "rtlnow", 1);
614                }
615                else if(((struct tithek*)listbox->select->handle)->flag == 8)
616                {
617                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.voxnow.de", "voxnow", 1);
618                }
619                else if(((struct tithek*)listbox->select->handle)->flag == 12)
620                {
621                        if(tmpstr != NULL) tmpstr1 = myvideo(tmpstr, NULL, NULL, 1);
622                }
623                else if(((struct tithek*)listbox->select->handle)->flag == 14)
624                {
625                        if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 1);
626                }
627                else if(((struct tithek*)listbox->select->handle)->flag == 15)
628                {
629                        if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 2);
630                }
631                else if(((struct tithek*)listbox->select->handle)->flag == 16)
632                {
633                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.superrtlnow.de", "superrtlnow", 1);
634                }
635                else if(((struct tithek*)listbox->select->handle)->flag == 17)
636                {
637                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl-now.rtl.de", "rtlnow", 1);
638                }
639                else if(((struct tithek*)listbox->select->handle)->flag == 18)
640                {
641                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://www.voxnow.de", "voxnow", 1);
642                }
643                else if(((struct tithek*)listbox->select->handle)->flag == 19)
644                {
645                        if(tmpstr != NULL) tmpstr1 = rtl2now(tmpstr, "http://rtl2now.rtl2.de", "rtl2now", 1);
646                }
647                else if(((struct tithek*)listbox->select->handle)->flag == 20)
648                {
649                        if(tmpstr != NULL) tmpstr1 = kinox(tmpstr, NULL, NULL, 3);
650                }
651
652                free(tmpstr); tmpstr = NULL;
653                       
654                if(tmpstr1 != NULL)
655                {
656                        if(textbox(_("Message"), _("Start playback"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
657                                screenplay(tmpstr1, 2, 0);                             
658                }
659                else
660                        textbox(_("Message"), _("Can't get Streamurl !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
661
662                free(tmpstr1); tmpstr1 = NULL;
663        }
664        else
665                textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
666}
667
668void screentithekplay(char* titheklink, char* title, int first)
669{
670        int rcret = -1, oaktline = 1, oaktpage = -1, ogridcol = 0;
671
672        if(file_exist("/var/bin/audio.elf") || file_exist("/var/swap/bin/audio.elf"))
673                textbox(_("Message"), _("Alternativ Audio Firmware not working korrekt with all videos (DTSDOWNMIX)!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
674
675        if(!file_exist("/mnt/player"))   
676                mkdir("/mnt/player", 0777);
677       
678        if(first == 1)
679        {
680                delallfiles("/tmp/tithek", NULL);
681                mkdir("/tmp/tithek", 777);
682                rcret = servicestop(status.aktservice, 1, 1);
683                if(rcret == 1) return;
684        }
685        status.hangtime = 99999;
686
687        struct skin* grid = getscreen("titheklist");
688        struct skin* listbox = getscreennode(grid, "listbox");
689        struct skin* countlabel = getscreennode(grid, "countlabel");
690        struct skin* countpage = getscreennode(grid, "countpage");
691        struct skin* load = getscreen("loading");
692        struct skin* tmp = NULL;
693        char* tithekpic = NULL;
694       
695        if(titheklink == NULL) return;
696       
697        listbox->aktpage = -1;
698        listbox->aktline = 1;
699        listbox->gridcol = 0;
700        listbox->select = NULL;
701
702//      if(createtithekplay(titheklink, grid, listbox, countlabel) != 0) return;
703        int pagecount = createtithekplay(titheklink, grid, listbox, countlabel);
704        if(pagecount == 0) return;
705
706        drawscreen(grid, 0, 0);
707        addscreenrc(grid, listbox);
708                               
709        while(1)
710        {
711                changetitle(grid, _(title));
712                if(listbox->select != NULL && listbox->select->handle != NULL)
713                {
714                        tmp = listbox->select;
715                        while(tmp != NULL)
716                        {
717
718                                if(tmp->pagecount != listbox->aktpage) break;
719
720                                char* tmpstr = ostrcat(_("Page"), NULL, 0, 0);
721                                tmpstr = ostrcat(tmpstr, " ( ", 1, 0);
722                                tmpstr = ostrcat(tmpstr, oitoa(tmp->pagecount), 1, 0);
723                                tmpstr = ostrcat(tmpstr, " / ", 1, 0);
724                                tmpstr = ostrcat(tmpstr, oitoa(pagecount), 1, 0);       
725                                tmpstr = ostrcat(tmpstr, _(" )"), 1, 0);
726                                changetext(countpage, tmpstr);
727                                free(tmpstr); tmpstr = NULL;
728       
729                                if(tmp->handle != NULL)
730                                {
731                                        tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0);
732
733                                        off64_t checkpic = getfilesize(tithekpic);
734                                        printf("getfilesize1: %d\n", checkpic);
735                       
736                                        if(checkpic < 1000)
737                                        {
738                                                free(tithekpic); tithekpic = NULL;
739                                                tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0);
740                                        }
741                       
742                                        changepic(tmp, tithekpic);
743                                        free(tithekpic); tithekpic = NULL;
744                                }
745                                tmp = tmp->prev;
746                        }
747                        tmp = listbox->select;
748                        while(tmp != NULL)
749                        {
750                                if(tmp->pagecount != listbox->aktpage) break;
751                                if(tmp->handle != NULL)
752                                {
753                                        tithekpic = tithekdownload(((struct tithek*)tmp->handle)->pic, ((struct tithek*)tmp->handle)->localname, "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=", 1, 0);
754
755                                        off64_t checkpic = getfilesize(tithekpic);
756                                        printf("getfilesize2: %d\n", checkpic);
757
758                                        if(checkpic < 1000)
759                                        {
760                                                free(tithekpic); tithekpic = NULL;
761                                                tithekpic = ostrcat("/var/usr/local/share/titan/plugins/tithek/default.jpg", NULL, 0, 0);
762                                        }
763
764                                        changepic(tmp, tithekpic);
765                                        free(tithekpic); tithekpic = NULL;
766                                }
767                                tmp = tmp->next;
768                        }
769
770                        drawscreen(grid, 0, 0);
771                }
772               
773                int count = getfilecount(TITHEKPATH);
774                if(count > 500)
775                        delallfiles(TITHEKPATH, ".jpg");
776               
777                rcret = waitrc(grid, 0, 0);
778
779                if(rcret == getrcconfigint("rcexit", NULL)) break;
780                if(rcret == getrcconfigint("rcmenu", NULL))
781                {
782                        screentithek_settings();
783                }
784               
785                if(rcret == getrcconfigint("rcred", NULL))
786                {
787                        if(listbox->select != NULL && listbox->select->handle != NULL)
788                        {
789                                if(((struct tithek*)listbox->select->handle)->flag == 2)
790                                {
791                                        if(status.security == 1)
792                                        {
793                                                char* tmpstr = tithekdownload((((struct tithek*)listbox->select->handle)->link), NULL, NULL, 0, 1);
794                                                free(tmpstr); tmpstr = NULL;
795                                                drawscreen(grid, 0, 0);
796                                        }
797                                        else
798                                                textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
799                                }
800                                else if(((struct tithek*)listbox->select->handle)->flag == 4)
801                                {
802                                        if(status.security == 1)
803                                        {
804                                                char* tmpstr = NULL, *tmpstr1 = NULL, *tmpstr2 = NULL;
805                                                tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0);
806                                                if(tmpstr != NULL) tmpstr1 = youtube(tmpstr, NULL, NULL, 1);
807                                                tmpstr2 = changefilenameext(((struct tithek*)tmp->handle)->localname, ".mp4");
808                                                free(tmpstr); tmpstr = NULL;
809                                                       
810                                                if(tmpstr1 != NULL)
811                                                {
812                                                        char* tmpstr = tithekdownload(tmpstr1, tmpstr2, NULL, 0, 1);
813                                                        free(tmpstr); tmpstr = NULL;
814                                                        drawscreen(grid, 0, 0);
815                                                }
816                                                else
817                                                        textbox(_("Message"), _("Can't get Streamurl !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
818                                                free(tmpstr1); tmpstr1 = NULL;
819                                                free(tmpstr2); tmpstr2 = NULL;
820                                        }
821                                        else
822                                                textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
823                                }
824                        }
825                }
826                else if(rcret == getrcconfigint("rcok", NULL))
827                {
828                        if(listbox->select != NULL && listbox->select->handle != NULL)
829                        {
830                                clearscreen(grid);
831
832                                if(((struct tithek*)listbox->select->handle)->flag == 2)
833                                {
834                                        if(status.security == 1)
835                                        {
836                                                if(textbox(_("Message"), _("Start playback"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0) == 1)
837                                                {
838                                                        if(ostrcmp(title, "TiThek - Internet Radio") == 0)
839                                                        {
840                                                                screenplay((((struct tithek*)listbox->select->handle)->link), 2, 4);
841                                                        }
842                                                        else
843                                                                screenplay((((struct tithek*)listbox->select->handle)->link), 2, 0);
844                                                }                       
845                                        }
846                                        else
847                                                textbox(_("Message"), _("Registration needed, please contact Atemio !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0);
848                                }
849                                else if((((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 == 7) || (((struct tithek*)listbox->select->handle)->flag == 8) || (((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 == 16) || (((struct tithek*)listbox->select->handle)->flag == 17) || (((struct tithek*)listbox->select->handle)->flag == 18) || (((struct tithek*)listbox->select->handle)->flag == 19) || (((struct tithek*)listbox->select->handle)->flag == 20))
850                                {
851                                        submenu(listbox, load);
852                                }
853                                else if((((struct tithek*)listbox->select->handle)->flag == 9) || (((struct tithek*)listbox->select->handle)->flag == 10) || (((struct tithek*)listbox->select->handle)->flag == 11))
854                                {
855                                        youtube_search(grid, listbox, countlabel, load);
856                                        continue;
857                                }
858                                else if((((struct tithek*)listbox->select->handle)->flag == 13))
859                                {
860                                        myvideo_search(grid, listbox, countlabel, load);
861                                        continue;
862                                }
863                                else
864                                {
865                                        int pincheck = 0;
866                                        if(((struct tithek*)listbox->select->handle)->flag == 1000)
867                                                pincheck = screenpincheck(0, NULL);
868                                        if(pincheck == 0)
869                                        {
870                                                oaktpage = listbox->aktpage;
871                                                oaktline = listbox->aktline;
872                                                ogridcol = listbox->gridcol;
873                                                char* tmpstr = ostrcat(((struct tithek*)listbox->select->handle)->link, NULL, 0, 0);
874                                                char* tmpstr1 = ostrcat(((struct tithek*)listbox->select->handle)->menutitle, " - ", 0, 0);                                     
875                                                char* tmpstr2 = ostrcat(tmpstr1, ((struct tithek*)listbox->select->handle)->title, 1, 0);
876                                                screentithekplay(tmpstr, tmpstr2, 0);
877                                                free(tmpstr); tmpstr = NULL;
878                                                free(tmpstr2); tmpstr2 = NULL;                                 
879//                                              if(createtithekplay(titheklink, grid, listbox, countlabel) != 0) break;
880                                                int pagecount = createtithekplay(titheklink, grid, listbox, countlabel);
881                                                if(pagecount == 0) break;
882
883                                                listbox->aktpage = oaktpage;
884                                                listbox->aktline = oaktline;
885                                                listbox->gridcol = ogridcol;
886                                                addscreenrc(grid, listbox);
887                                        }
888                                }
889                                drawscreen(grid, 0, 0);
890                                sleep(1);
891                        }                       
892                }
893                else if(rcret == getrcconfigint("rcyellow", NULL) && ostrcmp(title, "TiThek - Favoriten") == 0)
894                {
895                        if(textbox(_("Message"), _("Remove this Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1)
896                        {
897                                removefav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag);             
898                                int pagecount = createtithekplay(getconfig("tithek_fav", NULL), grid, listbox, countlabel);
899                                if(pagecount == 0) return;
900                                       
901                                drawscreen(grid, 0, 0);
902                        }
903                }
904                else if(rcret == getrcconfigint("rcgreen", NULL) && ostrcmp(title, "TiThek - Favoriten") != 0)
905                {
906                        if(textbox(_("Message"), _("Add this link as Favorite ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 5, 0) == 1)
907                        {
908                                addfav(((struct tithek*)listbox->select->handle)->title, ((struct tithek*)listbox->select->handle)->link, ((struct tithek*)listbox->select->handle)->pic, ((struct tithek*)listbox->select->handle)->localname, ((struct tithek*)listbox->select->handle)->menutitle, ((struct tithek*)listbox->select->handle)->flag);         
909                        }
910                }
911        }
912
913        freetithek();
914        delmarkedscreennodes(grid, 1);
915        delownerrc(grid);
916        clearscreen(grid);
917
918        if(first == 1)
919        {
920                delallfiles("/tmp/tithek", ".list");
921                servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0);
922        }
923        status.hangtime = getconfigint("hangtime", NULL);
924}
925
926#endif
Note: See TracBrowser for help on using the repository browser.