source: titan/titan/shortepg.h @ 18838

Last change on this file since 18838 was 18838, checked in by nit, 10 years ago

[titan] fix comp warn

File size: 2.3 KB
Line 
1#ifndef SHORTEPG_H
2#define SHORTEPG_H
3
4void screenshortepg(struct channel* chnode, struct epg* epgnode, int flag)
5{
6        int rcret = 0, i = 0;
7        struct skin* shortepg = getscreen("shortepg");
8        struct skin* grid = getscreennode(shortepg, "grid");
9        struct skin* pos1 = getscreennode(shortepg, "pos1");
10        struct skin* pos2 = getscreennode(shortepg, "pos2");
11        struct skin* pos3 = getscreennode(shortepg, "pos3");
12        struct skin* pos4 = getscreennode(shortepg, "pos4");
13        struct skin* pos5 = getscreennode(shortepg, "pos5");
14        char* tmpstr = NULL, *buf = NULL;
15        struct tm *loctime = NULL;
16
17        if(chnode == NULL) chnode = status.aktservice->channel;
18        if(chnode == NULL) return;
19        if(epgnode == NULL) epgnode = getepgakt(chnode);
20        if(epgnode == NULL) epgnode = getepgnext(chnode);
21
22        buf = malloc(100);
23        if(buf == NULL)
24        {
25                free(loctime);
26                err("no memory");
27                return;
28        }
29
30        while(epgnode != NULL)
31        {
32                loctime = olocaltime(&epgnode->starttime);
33                ostrftime(buf, MINMALLOC, "%d.%m. (%a) %H:%M", loctime);
34                tmpstr = ostrcat(tmpstr, buf, 1, 0);
35                free(loctime); loctime = NULL;
36                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
37
38                loctime = olocaltime(&epgnode->endtime);
39                ostrftime(buf, MINMALLOC, "%d.%m. (%a) %H:%M", loctime);
40                tmpstr = ostrcat(tmpstr, buf, 1, 0);
41                free(loctime); loctime = NULL;
42                tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
43
44                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
45                if(epgnode->subtitle != NULL && ostrcmp(epgnode->title, epgnode->subtitle) != 0)
46                {
47                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
48                        tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0);
49                }
50                tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
51                tmpstr = ostrcat(tmpstr, epgdescunzip(epgnode), 1, 1);
52
53                if(i == 0) changetext(pos1, tmpstr);
54                if(i == 1) changetext(pos2, tmpstr);
55                if(i == 2) changetext(pos3, tmpstr);
56                if(i == 3) changetext(pos4, tmpstr);
57                if(i == 4) changetext(pos5, tmpstr);
58                free(tmpstr); tmpstr = NULL;
59
60                i++;
61                if(i > 4) break;
62
63                epgnode = epgnode->next;
64        }
65
66        free(buf); buf = NULL;
67        drawscreen(shortepg, 0, 0);
68        addscreenrc(shortepg, grid);
69
70        while(1)
71        {
72                rcret = waitrc(shortepg, 0, 0);
73                if(rcret == getrcconfigint("rcexit", NULL)) break;
74                if(rcret == getrcconfigint("rcok", NULL)) break;
75        }
76
77        changetext(pos1, NULL);
78        changetext(pos2, NULL);
79        changetext(pos3, NULL);
80        changetext(pos4, NULL);
81        changetext(pos5, NULL);
82        delownerrc(shortepg);
83        clearscreen(shortepg);
84}
85
86#endif
Note: See TracBrowser for help on using the repository browser.