blob: 90b02c0670c69d37431e7fad76b02b16cbfaee2a (
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
|
#include <lib/dvb/metaparser.h>
#include <errno.h>
int eDVBMetaParser::parseFile(const std::string &tsname)
{
/* if it's a PVR channel, recover service id. */
std::string filename = tsname + ".meta";
FILE *f = fopen(filename.c_str(), "r");
if (!f)
return -ENOENT;
int linecnt = 0;
while (1)
{
char line[1024];
if (!fgets(line, 1024, f))
break;
if (*line && line[strlen(line)-1] == '\n')
line[strlen(line)-1] = 0;
if (*line && line[strlen(line)-1] == '\r')
line[strlen(line)-1] = 0;
switch (linecnt)
{
case 0:
m_ref = (const eServiceReferenceDVB&)eServiceReference(line);
break;
case 1:
m_name = line;
break;
case 2:
m_description = line;
break;
default:
break;
}
++linecnt;
}
fclose(f);
return 0;
}
|