forked from Saman-VDR/vdr-plugin-restfulapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.h
118 lines (106 loc) · 3.07 KB
/
events.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#include <cxxtools/http/request.h>
#include <cxxtools/http/reply.h>
#include <cxxtools/http/responder.h>
#include <cxxtools/arg.h>
#include <cxxtools/jsonserializer.h>
#include <cxxtools/serializationinfo.h>
#include <cxxtools/utf8codec.h>
#include <vdr/epg.h>
#include <vdr/plugin.h>
#include "tools.h"
#include "epgsearch/services.h"
#include "services/scraper2vdr.h"
#ifndef __RESTFUL_EVENTS_H
#define __RESTFUL_EVENTS_H
class EventsResponder : public cxxtools::http::Responder
{
public:
explicit EventsResponder(cxxtools::http::Service& service)
: cxxtools::http::Responder(service)
{ }
virtual void reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void replyEvents(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void replyImage(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
void replySearchResult(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
};
typedef cxxtools::http::CachedService<EventsResponder> EventsService;
struct SerComponent
{
int Stream;
int Type;
cxxtools::String Language;
cxxtools::String Description;
};
struct SerEvent
{
int Id;
cxxtools::String Title;
cxxtools::String ShortText;
cxxtools::String Description;
cxxtools::String Channel;
cxxtools::String ChannelName;
int StartTime;
int Duration;
int TableID;
int Version;
int Images;
bool TimerExists;
bool TimerActive;
#if APIVERSNUM > 10710 || EPGHANDLER
int ParentalRating;
#endif
int Vps;
cxxtools::String TimerId;
cEvent* Instance;
#ifdef EPG_DETAILS_PATCH
std::vector< tEpgDetail >* Details;
#endif
std::vector< struct SerAdditionalMedia > AdditionalMedia;
};
void operator<<= (cxxtools::SerializationInfo& si, const SerEvent& e);
void operator<<= (cxxtools::SerializationInfo& si, const SerComponent& c);
#ifdef EPG_DETAILS_PATCH
void operator<<= (cxxtools::SerializationInfo& si, const struct tEpgDetail& e);
#endif
class EventList : public BaseList
{
protected:
StreamExtension *s;
int total;
public:
explicit EventList(std::ostream* _out);
virtual ~EventList();
virtual void init() { };
virtual void addEvent(cEvent* event) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
};
class HtmlEventList : EventList
{
public:
explicit HtmlEventList(std::ostream* _out) : EventList(_out) { };
~HtmlEventList() { };
virtual void init();
virtual void addEvent(cEvent* event);
virtual void finish();
};
class JsonEventList : EventList
{
private:
std::vector < struct SerEvent > serEvents;
public:
explicit JsonEventList(std::ostream* _out) : EventList(_out) { };
~JsonEventList() { };
virtual void addEvent(cEvent* event);
virtual void finish();
};
class XmlEventList : EventList
{
public:
explicit XmlEventList(std::ostream* _out) : EventList(_out) { };
~XmlEventList() { };
virtual void init();
virtual void addEvent(cEvent* event);
virtual void finish();
};
#endif //__RESTFUL_EVENTS_H