/*
 * xml2cEvent.h: Converting xml-files from the web to cEvents
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */
#ifndef __XML2CEVENT_H
#define __XML2CEVENT_H

#include <vdr/epg.h>
#include <string>
#include <vector>

using namespace std;

struct cxmlIdx{
  char *URL, *md5;
};

struct cEv{
  time_t StartTime, VPS;
  int Duration;
  /*tEventID*/int EventID;
  char *Title, *ShortText, *Description;
};

struct cChan{
  char *name, *VDRname, *URL;
  int Source, Transponder, skipped, Days;
  unsigned short ServiceID;
};

enum {
  ssOk      = 0,
  ssNew     = 1,
  ssSkipped = 2,
};

class cEvents{
private:
  int NumberOfEvents;
  int DebugLevel;
  vector<cEv> Events;
  bool download_success;
  cChan Channel;
public:
  cEvents(void){NumberOfEvents = 0; shedState = ssOk;};
  ~cEvents(void){};
  int GetNumberOfEvents(){return NumberOfEvents;};
  int FromXMLFile(const char *file);
  void SetDebugLevel(int DL){DebugLevel = DL;};
  void Set_Download_Success(bool succ){download_success = succ;};
  cEv *GetEvent(int Number){ if(Number < NumberOfEvents)return &Events[Number]; return NULL;};
  void SetChannel(cChan &C){Channel = C;};
  cChan GetChannel(){return Channel;};
  bool Download_Success(){return download_success;};
  int shedState;
  bool feedEpg(); //EW
  void clearEpg(); //EW
};

#endif //__XML2CEVENT_H
