forked from yavdr/vdr-plugin-restfulapi
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchannels.h
133 lines (120 loc) · 3.76 KB
/
channels.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
#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 "tools.h"
#include <vdr/channels.h>
class ChannelsResponder : public cxxtools::http::Responder
{
public:
explicit ChannelsResponder(cxxtools::http::Service& service)
: cxxtools::http::Responder(service)
{ }
virtual void reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyChannels(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyImage(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyGroups(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
};
typedef cxxtools::http::CachedService<ChannelsResponder> ChannelsService;
struct SerChannel
{
cxxtools::String Name;
int Number;
cxxtools::String ChannelId;
int Transponder;
bool Image;
cxxtools::String Stream;
cxxtools::String Group;
bool IsAtsc;
bool IsCable;
bool IsTerr;
bool IsSat;
bool IsRadio;
};
void operator<<= (cxxtools::SerializationInfo& si, const SerChannel& c);
class ChannelList : public BaseList
{
protected:
StreamExtension *s;
int total;
public:
explicit ChannelList(std::ostream* _out);
virtual ~ChannelList();
virtual void init() { };
virtual void addChannel(cChannel* channel, std::string group, bool image) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
};
class HtmlChannelList : ChannelList
{
public:
explicit HtmlChannelList(std::ostream* _out) : ChannelList(_out) { };
~HtmlChannelList() { };
virtual void init();
virtual void addChannel(cChannel* channel, std::string group, bool image);
virtual void finish();
};
class JsonChannelList : ChannelList
{
private:
std::vector < struct SerChannel > serChannels;
public:
explicit JsonChannelList(std::ostream* _out) : ChannelList(_out) { };
~JsonChannelList() { };
virtual void addChannel(cChannel* channel, std::string group, bool image);
virtual void finish();
};
class XmlChannelList : ChannelList
{
public:
explicit XmlChannelList(std::ostream* _out) : ChannelList(_out) { };
~XmlChannelList() { };
virtual void init();
virtual void addChannel(cChannel* channel, std::string group, bool image);
virtual void finish();
};
class ChannelGroupList : public BaseList
{
protected:
StreamExtension *s;
int total;
public:
explicit ChannelGroupList(std::ostream* _out);
virtual ~ChannelGroupList();
virtual void init() { };
virtual void addGroup(std::string group) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; }
};
class HtmlChannelGroupList : ChannelGroupList
{
public:
explicit HtmlChannelGroupList(std::ostream* _out) : ChannelGroupList(_out) { };
~HtmlChannelGroupList() { };
virtual void init();
virtual void addGroup(std::string group);
virtual void finish();
};
class JsonChannelGroupList : ChannelGroupList
{
private:
std::vector< cxxtools::String > groups;
public:
explicit JsonChannelGroupList(std::ostream* _out) : ChannelGroupList(_out) { };
~JsonChannelGroupList() { };
virtual void init() { };
virtual void addGroup(std::string group);
virtual void finish();
};
class XmlChannelGroupList : ChannelGroupList
{
public:
explicit XmlChannelGroupList(std::ostream* _out) : ChannelGroupList(_out) { };
~XmlChannelGroupList() { };
virtual void init();
virtual void addGroup(std::string group);
virtual void finish();
};