diff options
Diffstat (limited to 'lib/dvb/metaparser.cpp')
| -rw-r--r-- | lib/dvb/metaparser.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/dvb/metaparser.cpp b/lib/dvb/metaparser.cpp new file mode 100644 index 00000000..8c1f0cfd --- /dev/null +++ b/lib/dvb/metaparser.cpp @@ -0,0 +1,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 = (eServiceReferenceDVB&)eServiceReference(line); + break; + case 1: + m_name = line; + break; + case 2: + m_description = line; + break; + default: + break; + } + ++linecnt; + } + fclose(f); + return 0; +} |
