summaryrefslogtreecommitdiff
path: root/parse.h
blob: 4c4e7a0d452678f7a7a76bb60b3a8341ea79497d (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
/*
 * 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 cep2ascii;
    iconv_t cutf2ascii;
    const 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, const char *EPDir, cEPGSource *Source, cEPGMappings *Maps);
    ~cParse();
    int Process(cEPGExecutor &myExecutor, char *buffer, int bufsize);
    static void RemoveNonAlphaNumeric(char *String);
    static bool FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const char *EPDir,
                                   const char *Title, const char *ShortText, int &Season,
                                   int &Episode);
    static void InitLibXML();
    static void CleanupLibXML();
};

#endif