summaryrefslogtreecommitdiff
path: root/parse.h
blob: 76849d34bb41edab44175ee619f2852b1f5c3849 (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
/*
 * 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 cEPGMappings;
class cGlobals;

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

private:
    cGlobals *g;  
    iconv_t cep2ascii;
    iconv_t cutf2ascii;
    cEPGSource *source;
    cXMLTVEvent xevent;
    time_t ConvertXMLTVTime2UnixTime(char *xmltvtime);
    bool FetchEvent(xmlNodePtr node, bool useeptext);
public:
    cParse(cEPGSource *Source, cGlobals *Global);
    ~cParse();
    int Process(cEPGExecutor &myExecutor, char *buffer, int bufsize);
    static void RemoveNonAlphaNumeric(char *String, bool InDescription=false);
    static bool FetchSeasonEpisode(iconv_t cEP2ASCII, iconv_t cUTF2ASCII, const char *EPDir,
                                   const char *Title, const char *ShortText, const char *Description,
                                   int &Season, int &Episode, int &EpisodeOverall, char **EPShortText,
                                   char **EPTitle);
    static void InitLibXML();
    static void CleanupLibXML();
};

#endif