blob: c502e90c740e94759df1043f0fd7494c695611d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* charset.c: Character set list item
*
* See the README file for copyright information and how to reach the author.
*
*/
#include "charset.h"
/* Global instance */
cEpgfixerList<cCharSet, cEvent> EpgfixerCharSets;
cCharSet::cCharSet()
{
origcharset = NULL;
realcharset = NULL;
}
cCharSet::~cCharSet(void)
{
free(origcharset);
free(realcharset);
}
bool cCharSet::Apply(cEvent *Event)
{
if (enabled && IsActive(Event->ChannelID())) {
cCharSetConv backconv(cCharSetConv::SystemCharacterTable(), origcharset ? origcharset : "iso6937");
cString title(backconv.Convert(Event->Title()));
cString shortText(backconv.Convert(Event->ShortText()));
cString description(backconv.Convert(Event->Description()));
cCharSetConv conv(realcharset, cCharSetConv::SystemCharacterTable());
Event->SetTitle(conv.Convert(title));
Event->SetShortText(conv.Convert(shortText));
Event->SetDescription(conv.Convert(description));
}
return false;
}
void cCharSet::SetFromString(char *s, bool Enabled)
{
FREE(origcharset);
FREE(realcharset);
Free();
enabled = Enabled;
if (s[0] == '!')
string = strdup(s + 1);
else
string = strdup(s);
if (s[0] == '!' || s[0] == '#')
enabled = false;
char *p = (s[0] == '#') ? NULL : s;
if (p) {
char *p = (s[0] == '!') ? s+1 : s;
char *r = strchr(p, ':');
if (r) {
*r = 0;
numchannels = LoadChannelsFromString(p);
p = r + 1;
}
r = strchr(p, '=');
if (r) {
*r = 0;
origcharset = strdup(p);
realcharset = strdup(r + 1);
}
else
realcharset = strdup(p);
}
}
|