source: titan/titan/gmultiepg.h @ 35220

Last change on this file since 35220 was 35220, checked in by obi, 8 years ago

fix

File size: 29.5 KB
Line 
1#ifndef GMULTIEPG_H
2#define GMULTIEPG_H
3
4time_t calcprimetime(time_t akttime)
5{
6        struct tm *loctime = NULL;
7        time_t ret = 0;
8
9        char* primetime = getconfig("epg_primetime", NULL);
10        int count = 0, hour = 20, min = 15;
11        struct splitstr* ret1 = NULL;
12        ret1 = strsplit(primetime, ":", &count);
13
14        if(ret1 != NULL && count > 1)
15        {
16                hour = atoi(ret1[0].part);
17                min = atoi(ret1[1].part);
18        }
19        free(ret1), ret1 = NULL;
20                                       
21        loctime = olocaltime(&akttime);
22        if(loctime != NULL)
23        {
24                loctime->tm_hour = hour; // 20;
25                loctime->tm_min = min; // 15;
26                ret = mktime(loctime);
27                if(ret < akttime) // add 1 day
28                {
29                        free(loctime);
30                        ret += 86400;
31                        loctime = olocaltime(&ret);
32                        if(loctime != NULL)
33                                ret = mktime(loctime);
34                        else
35                                ret = akttime;
36                }
37        }
38
39        free(loctime);
40        return ret;
41}
42
43void createtimeline(struct skin* gmultiepg, struct skin* timeline, time_t akttime, int zoom)
44{
45        struct skin* node = NULL;
46        struct tm *loctime = NULL;
47        int posx = 0;
48        char* buf = NULL;
49
50        buf = malloc(6);
51        if(buf == NULL)
52        {
53                err("no mem");
54                return;
55        }
56
57        delmarkedscreennodes(gmultiepg, 3);
58
59        while(posx < timeline->iwidth)
60        {
61                node = addlistbox(gmultiepg, timeline, node, 3);
62                if(node != NULL)
63                {
64
65                        loctime = olocaltime(&akttime);
66                        if(loctime != NULL)
67                                strftime(buf, 6, "%H:%M", loctime);
68                        else
69                                snprintf(buf, 6, "00:00");
70                        free(loctime); loctime = NULL;
71
72                        akttime += 30 * 60;
73                        changetext(node, buf);
74                        node->prozwidth = 0;
75                        node->posx = posx;
76                        node->width = 30 * zoom; //30 min * zoom pixel
77                        node->bordersize = 1;
78                        posx += node->width;
79                        if(posx > timeline->iwidth)
80                                node->width -= (posx - timeline->iwidth);
81                }
82        }
83
84        free(buf);
85}
86
87int selectchannelgmepg(struct skin* listbox)
88{
89        struct skin* node = listbox;
90        struct channel* chnode = NULL;
91        listbox->aktpage = -1;
92        listbox->aktline = 1;
93
94        listbox->select = NULL;
95
96        if(status.servicetype == 0)
97                chnode = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
98        else
99                chnode = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
100
101        if(chnode == NULL)
102        {
103                err("NULL detect");
104                return 1;
105        }
106
107        while(node != NULL)
108        {
109                if(node->deaktivcol > -1)
110                {
111                        node = node->next;
112                        continue;
113                }
114                if(chnode == (struct channel*)node->handle)
115                        return 0;
116
117                if(node->del == 1) listbox->aktline++;
118                node = node->next;
119        }
120        listbox->aktline = 1;
121        return 1;
122}
123
124int calcgmultiepg(struct channel* tmpchannel, struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int linecol1, int linecol2, int linecol3, int* aktline, struct skin** pchnode, struct skin** pchnode1, int height, int picheight, int epgpicon, long deaktivcol, int marklast)
125{
126        int treffer = 0, gridbr = 0, aktcol = 0, nottuneable = 0;
127        struct epg* epgnode = NULL;
128        struct skin* chnode = NULL, *chnode1 = NULL;
129        char* tmpstr = NULL;
130        time_t nowtime = time(NULL);
131
132        if(tmpchannel != NULL && tmpchannel->servicetype == status.servicetype)
133        {
134                if(channelnottunable(tmpchannel) == 1) nottuneable = 1;
135                *pchnode = addlistbox(gmultiepg, channellistbox, *pchnode, 1);
136                chnode = *pchnode;
137                if(chnode != NULL)
138                {
139                        chnode->bgspace = 1;
140                       
141                        if(epgpicon == 1) tmpstr = createpiconpath(tmpchannel, 0);
142                        if(tmpstr != NULL && ostrstr(tmpstr, "default.png") == NULL)
143                        {
144                                changepic(chnode, tmpstr);
145                                chnode->height = picheight;
146                        }
147                        else
148                        {
149                                changetext(chnode, tmpchannel->name);
150                                chnode->height = height;
151                        }
152                        free(tmpstr); tmpstr = NULL;
153
154                        epgnode = getepgakt(tmpchannel);
155                        if(epgnode == NULL) epgnode = getepgnext(tmpchannel);
156
157                        while(epgnode != NULL)
158                        {
159                                if(epgnode->endtime <= akttime)
160                                {
161                                        epgnode = epgnode->next;
162                                        continue;
163                                }
164                                if(epgnode->starttime >= akttime + ((listbox->iwidth * 60) / zoom))
165                                        break;
166
167                                *pchnode1 = addlistbox(gmultiepg, listbox, *pchnode1, 1);
168                                chnode1 = *pchnode1;
169                                if(chnode1 != NULL)
170                                {
171                                        /*if(nottuneable != 1)*/ (*aktline)++;
172                                        if(gridbr == 0)
173                                        {
174                                                //used for left/right scroll
175                                                chnode1->titlealign = 1;
176                                                chnode1->type = TEXTBOX | GRIDBR | MULTIPROGRESSBAR;
177                                                if(tmpchannel == aktchannel)
178                                                {
179                                                        listbox->aktline = *aktline;
180                                                        listbox->gridcol = 0;
181                                                }
182                                        }
183                                        else
184                                                chnode1->type = TEXTBOX | MULTIPROGRESSBAR;
185                                        chnode1->wrap = YES;
186                                        gridbr = 1;
187                                        treffer = 1;
188                                        chnode1->height = chnode->height;
189                                        chnode1->width = ((epgnode->endtime - epgnode->starttime) / 60) * zoom;
190                                        chnode1->posx = ((epgnode->starttime - akttime) / 60) * zoom;
191                                        if(chnode1->posx < 0)
192                                        {
193                                                chnode1->width += chnode1->posx;
194                                                chnode1->posx = 0;
195                                        }
196                                        chnode1->prozwidth = 0;
197                                        if(aktcol == linecol1)
198                                                aktcol = linecol2;
199                                        else
200                                                aktcol = linecol1;
201                                        if(nowtime >= epgnode->starttime && nowtime < epgnode->endtime)
202                                                aktcol = linecol3;
203                                        chnode1->bgcol = aktcol;
204                                        chnode1->bgspace = 1;
205                                        chnode1->vspace = 2;
206                                        chnode1->hspace = 2;
207                                        /*if(nottuneable == 1) chnode1->deaktivcol = deaktivcol;*/
208                                       
209                                        //record timeline
210                                        chnode1->progresscol = listbox->progresscol;
211                                        chnode1->epgrecord = getepgrecord(tmpchannel, epgnode);
212               
213                                        changetext(chnode1, epgnode->title);
214                                        chnode1->handle = (char*)tmpchannel;
215                                        chnode1->handle1 = (char*)epgnode;
216                                        if(chnode1->posx + chnode1->width >= listbox->iwidth)
217                                        {
218                                                if(marklast == 1 && tmpchannel == aktchannel)
219                                                        listbox->aktline = *aktline;
220                                                //used for left/right scroll
221                                                chnode1->titlealign += 2;
222                                                chnode1->width = listbox->iwidth - chnode1->posx;
223                                                break;
224                                        }
225                                }
226                                epgnode = epgnode->next;
227                        }
228                       
229                        if(chnode1 != NULL && chnode1->titlealign < 2) chnode1->titlealign += 2;
230                       
231                        if(gridbr == 0)
232                        {
233                                *pchnode1 = addlistbox(gmultiepg, listbox, *pchnode1, 1);
234                                chnode1 = *pchnode1;
235                                if(chnode1 != NULL)
236                                {
237                                        //used for left/right scroll
238                                        chnode1->titlealign = 3;
239                                        if(nottuneable == 1)
240                                                chnode1->deaktivcol = deaktivcol;
241                                        else
242                                                (*aktline)++;
243                                        if(tmpchannel == aktchannel)
244                                                listbox->aktline = *aktline;
245                                        if(gridbr == 0) chnode1->type = GRIDBR;
246                                        gridbr = 1;
247                                        chnode1->height = chnode->height;
248                                        chnode1->handle = (char*)tmpchannel;
249                                        chnode1->bgspace = 1;
250                                }
251                        }
252
253                        chnode->handle = (char*)tmpchannel;
254                        if(nottuneable == 1)
255                                chnode->deaktivcol = deaktivcol;
256                }
257        }
258        return treffer;
259}
260
261int showallgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
262{
263        int treffer = 0, aktline = 0;
264        struct skin* chnode = NULL, *chnode1 = NULL;
265        struct channel* tmpchannel = channel;
266
267        int linecol1 = convertcol("epgcol1");
268        int linecol2 = convertcol("epgcol2");
269        int linecol3 = convertcol("epgcol3");
270        int height = getskinconfigint("epgheight", NULL);
271        int picheight = getskinconfigint("epgpicheight", NULL);
272        int epgpicon = getconfigint("epgpicon", NULL);
273        long deaktivcol = convertcol("deaktivcol");
274
275        if(height < 1) height = 35;
276        if(picheight < 1) picheight = 35;
277
278        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
279        if(listbox != NULL) listbox->aktline = 1;
280
281        while(tmpchannel != NULL)
282        {
283                if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
284                        treffer = 1;
285                tmpchannel = tmpchannel->next;
286        }
287        return treffer;
288}
289
290int showbouquetgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct bouquet* firstbouquet, struct mainbouquet* mbouquet, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
291{
292        int treffer = 0, aktline = 0;
293        struct skin* chnode = NULL, *chnode1 = NULL;
294        struct bouquet* tmpbouquet = firstbouquet;
295
296        int linecol1 = convertcol("epgcol1");
297        int linecol2 = convertcol("epgcol2");
298        int linecol3 = convertcol("epgcol3");
299        int height = getskinconfigint("epgheight", NULL);
300        int picheight = getskinconfigint("epgpicheight", NULL);
301        int epgpicon = getconfigint("epgpicon", NULL);
302        long deaktivcol = convertcol("deaktivcol");
303
304        if(height < 1) height = 35;
305        if(picheight < 1) picheight = 35;
306
307        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
308        if(listbox != NULL) listbox->aktline = 1;
309
310        if(mbouquet != NULL && ostrcmp(mbouquet->filename, "0") == 0)
311        {
312                mostzaptobouquet(mbouquet);
313                tmpbouquet = mbouquet->bouquet;
314        }
315
316        while(tmpbouquet != NULL)
317        {
318                if(calcgmultiepg(tmpbouquet->channel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
319                        treffer = 1;
320                tmpbouquet = tmpbouquet->next;
321        }
322        return treffer;
323}
324
325int showprovidergmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct provider* providernode, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
326{
327        int treffer = 0, aktline = 0;
328        struct skin* chnode = NULL, *chnode1 = NULL;
329        struct channel* tmpchannel = channel;
330
331        int linecol1 = convertcol("epgcol1");
332        int linecol2 = convertcol("epgcol2");
333        int linecol3 = convertcol("epgcol3");
334        int height = getskinconfigint("epgheight", NULL);
335        int picheight = getskinconfigint("epgpicheight", NULL);
336        int epgpicon = getconfigint("epgpicon", NULL);
337        long deaktivcol = convertcol("deaktivcol");
338
339        if(height < 1) height = 35;
340        if(picheight < 1) picheight = 35;
341
342        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
343
344        while(tmpchannel != NULL)
345        {
346                if(tmpchannel->provider == providernode)
347                {
348                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
349                                treffer = 1;
350                }
351                tmpchannel = tmpchannel->next;
352        }
353        return treffer;
354}
355
356int showsatgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, struct sat* satnode, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
357{
358        int treffer = 0, aktline = 0;
359        struct skin* chnode = NULL, *chnode1 = NULL;
360        struct channel* tmpchannel = channel;
361       
362        if(satnode == NULL) return 1;
363
364        int linecol1 = convertcol("epgcol1");
365        int linecol2 = convertcol("epgcol2");
366        int linecol3 = convertcol("epgcol3");
367        int height = getskinconfigint("epgheight", NULL);
368        int picheight = getskinconfigint("epgpicheight", NULL);
369        int epgpicon = getconfigint("epgpicon", NULL);
370        long deaktivcol = convertcol("deaktivcol");
371
372        if(height < 1) height = 35;
373        if(picheight < 1) picheight = 35;
374
375        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
376
377        while(tmpchannel != NULL)
378        {
379                if(tmpchannel->transponder != NULL && tmpchannel->transponder->orbitalpos == satnode->orbitalpos)
380                {
381                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
382                                treffer = 1;
383                }
384                tmpchannel = tmpchannel->next;
385        }
386        return treffer;
387}
388
389int showazgmepgchannel(struct skin* gmultiepg, struct skin* channellistbox, struct skin* listbox, struct skin* timeline, int character, int zoom, time_t akttime, struct channel* aktchannel, int marklast)
390{
391        int treffer = 0, aktline = 0;
392        struct skin* chnode = NULL, *chnode1 = NULL;
393        struct channel* tmpchannel = channel;
394
395        int linecol1 = convertcol("epgcol1");
396        int linecol2 = convertcol("epgcol2");
397        int linecol3 = convertcol("epgcol3");
398        int height = getskinconfigint("epgheight", NULL);
399        int picheight = getskinconfigint("epgpicheight", NULL);
400        int epgpicon = getconfigint("epgpicon", NULL);
401        long deaktivcol = convertcol("deaktivcol");
402
403        if(height < 1) height = 35;
404        if(picheight < 1) picheight = 35;
405
406        if(gmultiepg != NULL) delmarkedscreennodes(gmultiepg, 1);
407
408        while(tmpchannel != NULL)
409        {
410                if(tmpchannel->name != NULL && (tmpchannel->name[0] == character || tmpchannel->name[0] == character + 32))
411                {
412                        if(calcgmultiepg(tmpchannel, gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, linecol1, linecol2, linecol3, &aktline, &chnode, &chnode1, height, picheight, epgpicon, deaktivcol, marklast) == 1)
413                                treffer = 1;
414                }
415                tmpchannel = tmpchannel->next;
416        }
417        return treffer;
418}
419
420void drawchannellistgmepg(struct skin* gmultiepg, int list, struct skin* listbox)
421{
422        status.markedchannel = NULL;
423
424        if(list == ALLCHANNEL || list == SATCHANNEL || list == PROVIDERCHANNEL || list == AZCHANNEL || list == BOUQUETCHANNEL)
425        {
426                if(listbox->select == NULL)
427                        drawscreen(gmultiepg, 2, 0);
428
429                if(listbox->select != NULL)
430                        status.markedchannel = (struct channel*)listbox->select->handle;
431        }
432        drawscreen(gmultiepg, 0, 0);
433}
434
435//flag 0: epg from listbox
436//flag 1: epg from param or aktepg
437void gmultiepgfilldesc(struct skin* listbox, struct skin* epgdesc, struct skin* epgdate, struct epg* epgnode, struct channel* chnode, int flag)
438{
439        char* tmpstr = NULL;
440
441        changetext(epgdesc, NULL);
442        changetext(epgdate, NULL);
443
444        if(flag == 0)
445        {
446                if(listbox->select != NULL)
447                        epgnode = (struct epg*)listbox->select->handle1;
448        }
449        else
450                if(chnode != NULL && epgnode == NULL) epgnode = getepgakt(chnode);
451
452        if(epgnode != NULL)
453        {
454                char* buf2 = malloc(50);
455                struct tm* loctime = olocaltime(&epgnode->starttime);
456                if(loctime != NULL)
457                        strftime(buf2, 50, "%d.%m. (%a) %H:%M", loctime);
458                free(loctime); loctime = NULL;
459
460                char* buf3 = malloc(50);
461                loctime = olocaltime(&epgnode->endtime);
462                if(loctime != NULL)
463                        strftime(buf3, 50, "%H:%M", loctime);
464                free(loctime); loctime = NULL;
465
466                buf2 = translate_time(buf2, 1);
467                //buf3 = translate_time(buf3, 1);
468                buf2 = ostrcat(buf2, "-", 1, 0);
469                buf2 = ostrcat(buf2, buf3, 1, 0);
470                changetext(epgdate, buf2);
471                tmpstr = ostrcat(buf2, " - ", 0, 0);
472                free(buf2); buf2 = NULL;
473                free(buf3); buf3 = NULL;
474
475                if(epgnode->title != NULL)
476                {
477                        tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
478                        tmpstr = ostrcat(tmpstr, " - ", 1, 0);
479                }
480                tmpstr = ostrcat(tmpstr, epgdescunzip(epgnode), 1, 1);
481                changetext(epgdesc, tmpstr);
482                free(tmpstr); tmpstr = NULL;
483        }
484}
485
486void gmultiepgchangesize(struct skin* gmultiepg, struct skin* listbox, struct skin* channellistbox, struct skin* timeline)
487{
488        int chboxwidth = 0;
489        int epgpicon = getconfigint("epgpicon", NULL);
490
491        if(epgpicon == 1)
492                chboxwidth = getskinconfigint("epgchannelpiconwidth", NULL);
493        else
494                chboxwidth = getskinconfigint("epgchannelwidth", NULL);
495                       
496        if(chboxwidth != 0)
497        {
498                channellistbox->width = chboxwidth;
499               
500                listbox->width = gmultiepg->iwidth - (channellistbox->width + channellistbox->posx);
501                listbox->posx = channellistbox->width + channellistbox->posx;
502                listbox->prozwidth = 0;
503
504                timeline->width = gmultiepg->iwidth - (channellistbox->width + channellistbox->posx);
505                timeline->posx = channellistbox->width + channellistbox->posx;
506                timeline->prozwidth = 0;
507        }
508}
509
510int screengmultiepg(struct channel* chnode, struct epg* epgnode, int flag)
511{
512        int rcret = 0, ret = 0, epgscreenconf = 0, end = 0;
513        struct skin* gmultiepg = getscreen("gmultiepg");
514        struct skin* listbox = getscreennode(gmultiepg, "listbox");
515        struct skin* channellistbox = getscreennode(gmultiepg, "channellistbox");
516        struct skin* epgdesc = getscreennode(gmultiepg, "epgdesc");
517        struct skin* epgdate = getscreennode(gmultiepg, "epgdate");
518        struct skin* timeline = getscreennode(gmultiepg, "timeline");
519        struct skin* b2 = getscreennode(gmultiepg, "b2");
520        struct skin* b3 = getscreennode(gmultiepg, "b3");
521        struct skin* b4 = getscreennode(gmultiepg, "b4");
522       
523        int list = ALLCHANNEL;
524        char* tmpstr = NULL, *tmpstr1 = NULL;
525        void* aktlist = NULL;
526        int character = 0;
527        struct sat* satnode = NULL;
528        struct provider* providernode = NULL;
529        struct channel* aktchannel = NULL;
530#ifdef SIMULATE
531        time_t akttime = time(NULL);
532        //time_t akttime = 1307871000;
533        //akttime = 1315614900;
534        //akttime = 1317926400;
535#else
536        time_t akttime = time(NULL);
537#endif
538        int zoom = getconfigint("gmultiepgzoom", NULL);
539        if(zoom < 1) zoom = 4;
540        int nochanneltitle = getskinconfigint("nochanneltitle", NULL);
541
542        akttime -= (((akttime / 60) % 15) * 60);
543        akttime -= (((akttime) % 60));
544        time_t starttime = akttime;
545
546        if(chnode == NULL) chnode = status.aktservice->channel;
547        gmultiepgfilldesc(listbox, epgdesc, epgdate, epgnode, chnode, 1);
548
549        //chalc screen, so we have all infos
550        drawscreen(gmultiepg, 2, 0);
551
552        time_t addtime = (listbox->iwidth / zoom) * 60;
553        addtime -= (((addtime / 60) % 15) * 60);
554        addtime -= (((addtime) % 60));
555        epgscreenconf = getconfigint("epg_screen", NULL);
556
557        if(status.servicetype == 0)
558        {
559                tmpstr = getconfig("channellist", NULL);
560                aktchannel = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
561        }
562        else
563        {
564                tmpstr = getconfig("rchannellist", NULL);
565                aktchannel = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
566        }
567
568        if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10)
569        {
570                struct mainbouquet* mainbouquetnode = NULL;
571                mainbouquetnode = getmainbouquet(tmpstr + 10);
572                if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL)
573                {
574                        tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Bouquets"), 0, 0);
575                        tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
576                        tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0);
577                        if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
578                        free(tmpstr1); tmpstr1 = NULL;
579                        list = BOUQUETCHANNEL;
580                        aktlist = (void*)mainbouquetnode;
581                        showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, mainbouquetnode->bouquet, mainbouquetnode, zoom, akttime, aktchannel, 0);
582                        selectchannelgmepg(channellistbox);
583                }
584        }
585        else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
586        {
587                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Channel"), 0, 0);
588                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
589                tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
590                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
591                free(tmpstr1); tmpstr1 = NULL;
592                list = AZCHANNEL;
593                character = (int)tmpstr[6];
594                aktlist = (void*)(int)tmpstr[6];
595                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0);
596                selectchannelgmepg(channellistbox);
597        }
598        else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6)
599        {
600                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Satellites"), 0, 0);
601                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
602                tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0);
603                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
604                free(tmpstr1); tmpstr1 = NULL;
605                satnode = getsat(tmpstr + 6);
606                list = SATCHANNEL;
607                aktlist = (void*)satnode;
608                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0);
609                selectchannelgmepg(channellistbox);
610        }
611        else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6)
612        {
613                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Provider"), 0, 0);
614                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
615                tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0);
616                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
617                free(tmpstr1); tmpstr1 = NULL;
618                providernode = getproviderbyname(tmpstr + 11);
619                list = PROVIDERCHANNEL;
620                aktlist = (void*)providernode;
621                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0);
622                selectchannelgmepg(channellistbox);
623        }
624        else
625        {
626                if(nochanneltitle == 0) changetitle(gmultiepg, _("GRAPHIC MULTI EPG - All Channels"));
627                list = ALLCHANNEL;
628                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0);
629                selectchannelgmepg(channellistbox);
630        }
631
632        if(flag == 0 && epgscreenconf == 3)
633        {
634                b2->hidden = NO;
635                b3->hidden = NO;
636                b4->hidden = NO;
637        }
638        else
639        {
640                b2->hidden = YES;
641                b3->hidden = YES;
642                b4->hidden = YES;
643        }
644
645        gmultiepgchangesize(gmultiepg, listbox, channellistbox, timeline);
646
647        tmpstr = NULL;
648        drawscreen(gmultiepg, 2, 0);
649        addscreenrc(gmultiepg, listbox);
650        listbox->aktpage = channellistbox->aktpage;
651
652        createtimeline(gmultiepg, timeline, akttime, zoom);
653
654        drawchannellistgmepg(gmultiepg, list, listbox);
655
656        while(1)
657        {
658                rcret = waitrc(gmultiepg, 0, 2);
659
660                channellistbox->aktpage = listbox->aktpage;
661
662                if((rcret == getrcconfigint("rcexit", NULL)) || (rcret == getrcconfigint("rcepg", NULL))) break;
663                //if(rcret == getrcconfigint("rcinfo", NULL)) break;
664                if(listbox->select != NULL && rcret == getrcconfigint("rcok", NULL))
665                {
666                        if(channelnottunable((struct channel*)listbox->select->handle) == 0)
667                        {
668                                //clear screen before zap
669                                clearscreen(gmultiepg);
670                                drawscreen(skin, 0, 0);
671                               
672                                int ret = 0;
673                                if(status.servicetype == 0)
674                                        ret = servicestart((struct channel*)listbox->select->handle, getconfig("channellist", NULL), NULL, 0);
675                                else
676                                        ret = servicestart((struct channel*)listbox->select->handle, getconfig("rchannellist", NULL), NULL, 0);
677                                if(ret == 20) writeconfigtmp();
678                                servicecheckret(ret, 0);
679                                end = 1;
680                                break;
681                        }
682                }
683                if(rcret == getrcconfigint("rcinfo", NULL))
684                {
685                        if(listbox->select != NULL)
686                        {
687                                clearscreen(gmultiepg);
688                                end = screenepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, 1);
689                                if(end == 1)
690                                        break;
691                                else
692                                        drawscreen(gmultiepg, 0, 0);
693                        }
694                }
695               
696                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcgreen", NULL))
697                {
698                        if(listbox->select != NULL)
699                        {
700                                clearscreen(gmultiepg);
701                                end = screenepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, 0);
702                                //drawscreen(gmultiepg, 0, 0);
703                                break;
704                        }
705                }
706                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcyellow", NULL))
707                {
708                        if(listbox->select != NULL)
709                        {
710                                clearscreen(gmultiepg);
711                                end = screensingleepg((struct channel*)listbox->select->handle, NULL, 0);
712                                //drawscreen(gmultiepg, 0, 0);
713                                break;
714                        }
715                }
716                if(flag == 0 && epgscreenconf == 3 && rcret == getrcconfigint("rcblue", NULL))
717                {
718                        if(listbox->select != NULL)
719                        {
720                                clearscreen(gmultiepg);
721                                end = screenmultiepg((struct channel*)listbox->select->handle, NULL, 0);
722                                //drawscreen(gmultiepg, 0, 0);
723                                break;
724                        }
725                }
726                if(rcret == getrcconfigint("rc0", NULL))
727                {
728                        if(listbox->select != NULL && listbox->select->handle1 != NULL)
729                        {
730                                screenepgsearch(((struct epg*)listbox->select->handle1)->title);
731                                resettvpic();
732                                drawscreen(gmultiepg, 0, 0);
733                                continue;
734                        }
735                }
736
737                if(list == BOUQUETCHANNEL && (rcret == getrcconfigint("rcff", NULL) || rcret == getrcconfigint("rcfr", NULL)))
738                {
739                        struct mainbouquet *mnode = (struct mainbouquet*)aktlist;
740                        int round = 0;
741                        while(mnode != NULL)
742                        {
743                                if(rcret == getrcconfigint("rcff", NULL))
744                                {
745                                        mnode = mnode->next;
746                                        if(mnode == NULL && round == 0)
747                                        {
748                                                round = 1;
749                                                mnode = mainbouquet;
750                                        }
751                                }
752                                else if(rcret == getrcconfigint("rcfr", NULL))
753                                {
754                                        mnode = mnode->prev;
755                                        if(mnode == NULL && round == 0)
756                                        {
757                                                round = 1;
758                                                mnode = getlastmainbouquet(mainbouquet);
759                                        }
760                                }
761                                if(mnode == NULL) break;
762                                if(mnode->type != status.servicetype) continue;
763
764                                char* tmp = ostrcat(tmp, "(BOUQUET)-", 0, 0);
765                                tmp = ostrcat(tmp, mnode->name, 1, 0);
766                                if(status.servicetype == 0)
767                                        addconfigtmp("channellist", tmp);
768                                else
769                                        addconfigtmp("rchannellist", tmp);
770                                free(tmp); tmp = NULL;
771
772                                tmpstr1 = ostrcat(tmpstr1, _("GRAPHIC MULTI EPG - Bouquets"), 0, 0);
773                                tmpstr1 = ostrcat(tmpstr1, " - ", 1, 0);
774                                tmpstr1 = ostrcat(tmpstr1, mnode->name, 1, 0);
775                                if(nochanneltitle == 0) changetitle(gmultiepg, tmpstr1);
776                                free(tmpstr1); tmpstr1 = NULL;
777
778                                if(status.servicetype == 0)
779                                        aktchannel = getchannel(getconfigint("serviceid", NULL), getconfigllu("transponderid", NULL));
780                                else
781                                        aktchannel = getchannel(getconfigint("rserviceid", NULL), getconfigllu("rtransponderid", NULL));
782
783                                listbox->aktpage = -1;
784                                listbox->aktline = 1;
785                                listbox->select = NULL;
786                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, mnode->bouquet, mnode, zoom, starttime, aktchannel, 0);
787                                selectchannelgmepg(channellistbox);
788                                aktlist = (void*)mnode;
789
790                                createtimeline(gmultiepg, timeline, starttime, zoom);
791                                drawscreen(gmultiepg, 2, 0);
792                                gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
793                                drawscreen(gmultiepg, 0, 0);
794                                if(listbox->select != NULL)
795                                        aktchannel = (struct channel*)listbox->select->handle;
796                                break;
797                        }
798                        continue;
799                }
800
801                if((listbox->select != NULL && (listbox->select->titlealign == 1 || listbox->select->titlealign == 3) && rcret == getrcconfigint("rcright", NULL)) || rcret == getrcconfigint("rc9", NULL) || rcret == getrcconfigint("rcnext", NULL) || rcret == getrcconfigint("rcfav", NULL))
802                {
803                        time_t tmptime = 0;
804
805                        if(rcret == getrcconfigint("rcfav", NULL))
806                        {
807                                tmptime = calcprimetime(akttime);
808                                if(tmptime != 0)
809                                {
810                                        akttime = tmptime;
811                                        akttime -= addtime;
812                                }
813                        }
814                        akttime += addtime;
815
816                        if(list == BOUQUETCHANNEL)
817                        {
818                                if(showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, 0) == 0)
819                                {
820                                        if(tmptime == 0)
821                                                akttime -= addtime;
822                                        else
823                                                akttime = starttime;
824                                        if(akttime < starttime)
825                                                akttime = starttime;
826                                        else
827                                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, 0);
828                                }
829                        }
830                        else if(list == ALLCHANNEL)
831                        {
832                                if(showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0) == 0)
833                                {
834                                        if(tmptime == 0)
835                                                akttime -= addtime;
836                                        else
837                                                akttime = starttime;
838                                        if(akttime < starttime)
839                                                akttime = starttime;
840                                        else
841                                                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, 0);
842                                }
843                        }
844                        else if(list == AZCHANNEL)
845                        {
846                                if(showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0) == 0)
847                                {
848                                        if(tmptime == 0)
849                                                akttime -= addtime;
850                                        else
851                                                akttime = starttime;
852                                        if(akttime < starttime)
853                                                akttime = starttime;
854                                        else
855                                                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, 0);
856                                }
857                        }
858                        else if(list == SATCHANNEL)
859                        {
860                                if(showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0) == 0)
861                                {
862                                        if(tmptime == 0)
863                                                akttime -= addtime;
864                                        else
865                                                akttime = starttime;
866                                        if(akttime < starttime)
867                                                akttime = starttime;
868                                        else
869                                                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, 0);
870                                }
871                        }
872                        else if(list == PROVIDERCHANNEL)
873                        {
874                                if(showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0) == 0)
875                                {
876                                        if(tmptime == 0)
877                                                akttime -= addtime;
878                                        else
879                                                akttime = starttime;
880                                        if(akttime < starttime)
881                                                akttime = starttime;
882                                        else
883                                                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, 0);
884                                }
885                        }
886                        createtimeline(gmultiepg, timeline, akttime, zoom);
887                        drawscreen(gmultiepg, 2, 0);
888                        gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
889                        drawscreen(gmultiepg, 0, 0);
890                        if(listbox->select != NULL)
891                                aktchannel = (struct channel*)listbox->select->handle;
892                        continue;
893                }
894
895                if((listbox->select != NULL && (listbox->select->titlealign == 2 || listbox->select->titlealign == 3) && rcret == getrcconfigint("rcleft", NULL)) || rcret == getrcconfigint("rc7", NULL) || rcret == getrcconfigint("rcprev", NULL))
896                {
897                        akttime -= addtime;
898                        if(akttime < starttime) akttime = starttime;
899                       
900                        int marklast = 0;
901                        if(rcret == getrcconfigint("rcleft", NULL)) marklast = 1;
902
903                        if(list == BOUQUETCHANNEL)
904                                showbouquetgmepgchannel(gmultiepg, channellistbox, listbox, timeline, ((struct mainbouquet*)aktlist)->bouquet, (struct mainbouquet*)aktlist, zoom, akttime, aktchannel, marklast);
905                        else if(list == ALLCHANNEL)
906                                showallgmepgchannel(gmultiepg, channellistbox, listbox, timeline, zoom, akttime, aktchannel, marklast);
907                        else if(list == AZCHANNEL)
908                                showazgmepgchannel(gmultiepg, channellistbox, listbox, timeline, character, zoom, akttime, aktchannel, marklast);
909                        else if(list == SATCHANNEL)
910                                showsatgmepgchannel(gmultiepg, channellistbox, listbox, timeline, satnode, zoom, akttime, aktchannel, marklast);
911                        else if(list == PROVIDERCHANNEL)
912                                showprovidergmepgchannel(gmultiepg, channellistbox, listbox, timeline, providernode, zoom, akttime, aktchannel, marklast);
913                        createtimeline(gmultiepg, timeline, akttime, zoom);
914                        drawscreen(gmultiepg, 2, 0);
915                        gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
916                        drawscreen(gmultiepg, 0, 0);
917                        if(listbox->select != NULL)
918                                aktchannel = (struct channel*)listbox->select->handle;
919                        continue;
920                }
921
922                if(rcret == getrcconfigint("rcred", NULL) && listbox->select != NULL)
923                {
924                        clearscreen(gmultiepg);
925                        ret = addrecepg((struct channel*)listbox->select->handle, (struct epg*)listbox->select->handle1, NULL);
926
927                        //recalc record timelines
928                        struct skin* tmplistbox = listbox;
929                        while(tmplistbox != NULL)
930                        {
931                                if(tmplistbox->type & MULTIPROGRESSBAR)
932                                        tmplistbox->epgrecord = getepgrecord((struct channel*)tmplistbox->handle, (struct epg*)tmplistbox->handle1);
933                                tmplistbox = tmplistbox->next;
934                        }
935
936                        drawscreen(gmultiepg, 0, 0);
937                        continue;
938                }
939
940                gmultiepgfilldesc(listbox, epgdesc, epgdate, NULL, NULL, 0);
941                drawscreen(gmultiepg, 0, 0);
942                if(listbox->select != NULL)
943                        aktchannel = (struct channel*)listbox->select->handle;
944        }
945
946        delconfigtmp("channellist");
947        delconfigtmp("rchannellist");
948        status.markedchannel = NULL;
949        status.markmodus = 0;
950        delmarkedscreennodes(gmultiepg, 1);
951        delmarkedscreennodes(gmultiepg, 3);
952        delownerrc(gmultiepg);
953        clearscreen(gmultiepg);
954
955        return end;
956}
957
958#endif
Note: See TracBrowser for help on using the repository browser.