summaryrefslogtreecommitdiff
path: root/parse.h
blob: 378e90165fbdca3c8789dbec58b411e520ed4b72 (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
/*
 * parse.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef _PARSE_H
#define _PARSE_H

#include <vdr/epg.h>
#include <libxml/parser.h>
#include <time.h>

#include "maps.h"
#include "event.h"

class cEPGExecutor;
class cEPGSource;

class cParse
{
    enum
    {
        PARSE_NOERROR=0,
        PARSE_XMLTVERR,
        PARSE_NOMAPPING,
        PARSE_NOCHANNELID
    };

private:
    iconv_t conv;
    char *epdir;
    const char *epgfile;
    cEPGSource *source;
    cEPGMappings *maps;
    cXMLTVEvent xevent;
    time_t ConvertXMLTVTime2UnixTime(char *xmltvtime);
    bool FetchEvent(xmlNodePtr node);
public:
    cParse(const char *EPGFile, cEPGSource *Source, cEPGMappings *Maps);
    ~cParse();
    int Process(cEPGExecutor &myExecutor, char *buffer, int bufsize);
    static void RemoveNonAlphaNumeric(char *String);
    static bool FetchSeasonEpisode(iconv_t Conv, const char *EPDir, const char *Title,
                                   const char *ShortText, int &Season, int &Episode);
    static void InitLibXML();
    static void CleanupLibXML();
};

#endif