source: titan/titan/shortepg.h @ 38791

Last change on this file since 38791 was 33613, checked in by tobayer, 9 years ago

[titan] fix translate_time in screenshortepg

File size: 2.4 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                tmpstr = translate_time(tmpstr, 1);
36                free(loctime); loctime = NULL;
37                tmpstr = ostrcat(tmpstr, "\n", 1, 0);
38
39                loctime = olocaltime(&epgnode->endtime);
40                ostrftime(buf, MINMALLOC, "%d.%m. (%a) %H:%M", loctime);
41                tmpstr = ostrcat(tmpstr, buf, 1, 0);
42                tmpstr = translate_time(tmpstr, 1);
43
44                free(loctime); loctime = NULL;
45                tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
46
47                tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0);
48                if(epgnode->subtitle != NULL && ostrcmp(epgnode->title, epgnode->subtitle) != 0)
49                {
50                        tmpstr = ostrcat(tmpstr, "\n", 1, 0);
51                        tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0);
52                }
53                tmpstr = ostrcat(tmpstr, "\n\n", 1, 0);
54                tmpstr = ostrcat(tmpstr, epgdescunzip(epgnode), 1, 1);
55
56                if(i == 0) changetext(pos1, tmpstr);
57                if(i == 1) changetext(pos2, tmpstr);
58                if(i == 2) changetext(pos3, tmpstr);
59                if(i == 3) changetext(pos4, tmpstr);
60                if(i == 4) changetext(pos5, tmpstr);
61                free(tmpstr); tmpstr = NULL;
62
63                i++;
64                if(i > 4) break;
65
66                epgnode = epgnode->next;
67        }
68
69        free(buf); buf = NULL;
70        drawscreen(shortepg, 0, 0);
71        addscreenrc(shortepg, grid);
72
73        while(1)
74        {
75                rcret = waitrc(shortepg, 0, 0);
76                if(rcret == getrcconfigint("rcexit", NULL)) break;
77                if(rcret == getrcconfigint("rcok", NULL)) break;
78        }
79
80        changetext(pos1, NULL);
81        changetext(pos2, NULL);
82        changetext(pos3, NULL);
83        changetext(pos4, NULL);
84        changetext(pos5, NULL);
85        delownerrc(shortepg);
86        clearscreen(shortepg);
87}
88
89#endif
Note: See TracBrowser for help on using the repository browser.