-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathevents.h
179 lines (158 loc) · 4.8 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#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.h"
#include "epgsearch/services.h"
#include "scraper2vdr.h"
#ifndef __RESTFUL_EVENTS_H
#define __RESTFUL_EVENTS_H
#define CONTENT_DESCRIPTOR_MAX 255
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);
void replyContentDescriptors(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;
int ParentalRating;
int Vps;
cxxtools::String TimerId;
const cEvent* Instance;
#ifdef EPG_DETAILS_PATCH
std::vector< tEpgDetail >* Details;
#endif
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;
int dateLimit;
Scraper2VdrService sc;
public:
explicit EventList(std::ostream* _out);
virtual ~EventList();
virtual void init() { };
virtual void addEvent(const cEvent* event) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
virtual void activateDateLimit(int _limit);
bool filtered(int start_time);
using BaseList::filtered;
};
class HtmlEventList : EventList
{
public:
explicit HtmlEventList(std::ostream* _out) : EventList(_out) { };
~HtmlEventList() { };
virtual void init();
virtual void addEvent(const 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(const cEvent* event);
virtual void finish();
};
class XmlEventList : EventList
{
public:
explicit XmlEventList(std::ostream* _out) : EventList(_out) { };
~XmlEventList() { };
virtual void init();
virtual void addEvent(const cEvent* event);
virtual void finish();
};
struct SerContentDescriptor {
cxxtools::String id;
cxxtools::String name;
bool isGroup;
};
class ContentDescriptorList : public BaseList
{
protected:
StreamExtension *s;
int total;
public:
explicit ContentDescriptorList(std::ostream* _out);
virtual ~ContentDescriptorList();
virtual void init() { };
virtual void addDescr(SerContentDescriptor &descr) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
};
class HtmlContentDescriptorList : ContentDescriptorList
{
public:
explicit HtmlContentDescriptorList(std::ostream* _out) : ContentDescriptorList(_out) { };
~HtmlContentDescriptorList() { };
virtual void init();
virtual void addDescr(SerContentDescriptor &descr);
virtual void finish();
};
class JsonContentDescriptorList : ContentDescriptorList
{
private:
std::vector < struct SerContentDescriptor > serContentDescriptors;
public:
explicit JsonContentDescriptorList(std::ostream* _out) : ContentDescriptorList(_out) { };
~JsonContentDescriptorList() { };
virtual void addDescr(SerContentDescriptor &descr);
virtual void finish();
};
class XmlContentDescriptorList : ContentDescriptorList
{
public:
explicit XmlContentDescriptorList(std::ostream* _out) : ContentDescriptorList(_out) { };
~XmlContentDescriptorList() { };
virtual void init();
virtual void addDescr(SerContentDescriptor &descr);
virtual void finish();
};
#endif //__RESTFUL_EVENTS_H