1
1
#include " channels.h"
2
+ using namespace std ;
2
3
3
- void ChannelsResponder::reply (std:: ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
4
+ void ChannelsResponder::reply (ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
4
5
{
5
6
QueryHandler::addHeader (reply);
6
7
@@ -20,7 +21,7 @@ void ChannelsResponder::reply(std::ostream& out, cxxtools::http::Request& reques
20
21
}
21
22
}
22
23
23
- void ChannelsResponder::replyChannels (std:: ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
24
+ void ChannelsResponder::replyChannels (ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
24
25
{
25
26
QueryHandler q (" /channels" , request);
26
27
@@ -40,10 +41,10 @@ void ChannelsResponder::replyChannels(std::ostream& out, cxxtools::http::Request
40
41
return ;
41
42
}
42
43
43
- std:: string channel_details = q.getParamAsString (0 );
44
+ string channel_details = q.getParamAsString (0 );
44
45
int start_filter = q.getOptionAsInt (" start" );
45
46
int limit_filter = q.getOptionAsInt (" limit" );
46
- std:: string group_filter = q.getOptionAsString (" group" );
47
+ string group_filter = q.getOptionAsString (" group" );
47
48
48
49
if (channel_details.length () > 0 ) {
49
50
cChannel* channel = VdrExtension::getChannel (channel_details);
@@ -54,7 +55,7 @@ void ChannelsResponder::replyChannels(std::ostream& out, cxxtools::http::Request
54
55
} else {
55
56
channelList->init ();
56
57
57
- std:: string group = " " ;
58
+ string group = " " ;
58
59
int total = 0 ;
59
60
for (cChannel *channelIt = Channels.First (); channelIt; channelIt = Channels.Next (channelIt))
60
61
{
@@ -65,7 +66,7 @@ void ChannelsResponder::replyChannels(std::ostream& out, cxxtools::http::Request
65
66
group = channelIt->Name ();
66
67
}
67
68
channelList->setTotal (total);
68
- std:: string image = FileCaches::get ()->searchChannelLogo (channel);
69
+ string image = FileCaches::get ()->searchChannelLogo (channel);
69
70
channelList->addChannel (channel, group, image.length () == 0 );
70
71
}
71
72
} else {
@@ -74,12 +75,12 @@ void ChannelsResponder::replyChannels(std::ostream& out, cxxtools::http::Request
74
75
}
75
76
channelList->init ();
76
77
int total = 0 ;
77
- std:: string group = " " ;
78
+ string group = " " ;
78
79
for (cChannel *channel = Channels.First (); channel; channel = Channels.Next (channel))
79
80
{
80
81
if (!channel->GroupSep ()) {
81
82
if ( group_filter.length () == 0 || group == group_filter ) {
82
- std:: string image = FileCaches::get ()->searchChannelLogo (channel);
83
+ string image = FileCaches::get ()->searchChannelLogo (channel);
83
84
channelList->addChannel (channel, group, image.length () != 0 );
84
85
total++;
85
86
}
@@ -94,37 +95,37 @@ void ChannelsResponder::replyChannels(std::ostream& out, cxxtools::http::Request
94
95
delete channelList;
95
96
}
96
97
97
- void ChannelsResponder::replyImage (std:: ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
98
+ void ChannelsResponder::replyImage (ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
98
99
{
99
100
StreamExtension se (&out);
100
101
QueryHandler q (" /channels/image/" , request);
101
102
102
- std:: string channelid = q.getParamAsString (0 );
103
+ string channelid = q.getParamAsString (0 );
103
104
cChannel* channel = VdrExtension::getChannel (channelid);
104
- std:: string imageFolder = Settings::get ()->ChannelLogoDirectory () + (std:: string)" /" ;
105
+ string imageFolder = Settings::get ()->ChannelLogoDirectory () + (string)" /" ;
105
106
106
107
if (channel == NULL ) {
107
108
reply.httpReturn (502 , " Channel not found!" );
108
109
return ;
109
110
}
110
111
111
- std:: string imageName = FileCaches::get ()->searchChannelLogo (channel);
112
+ string imageName = FileCaches::get ()->searchChannelLogo (channel);
112
113
113
114
if (imageName.length () == 0 ) {
114
115
reply.httpReturn (502 , " No image found!" );
115
116
return ;
116
117
}
117
118
118
- std:: string absolute_path = imageFolder + imageName;
119
- std:: string contenttype = (std:: string)" image/" + imageName.substr ( imageName.find_last_of (' .' ) + 1 );
119
+ string absolute_path = imageFolder + imageName;
120
+ string contenttype = (string)" image/" + imageName.substr ( imageName.find_last_of (' .' ) + 1 );
120
121
if ( se.writeBinary (absolute_path) ) {
121
122
reply.addHeader (" Content-Type" , contenttype.c_str ());
122
123
} else {
123
124
reply.httpReturn (502 , " Binary Output failed" );
124
125
}
125
126
}
126
127
127
- void ChannelsResponder::replyGroups (std:: ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
128
+ void ChannelsResponder::replyGroups (ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
128
129
{
129
130
QueryHandler q (" /channels/groups" , request);
130
131
ChannelGroupList* channelGroupList;
@@ -182,7 +183,7 @@ void operator<<= (cxxtools::SerializationInfo& si, const SerChannel& c)
182
183
si.addMember (" is_radio" ) <<= c.IsRadio ;
183
184
}
184
185
185
- ChannelList::ChannelList (std:: ostream* _out)
186
+ ChannelList::ChannelList (ostream* _out)
186
187
{
187
188
s = new StreamExtension (_out);
188
189
}
@@ -198,7 +199,7 @@ void HtmlChannelList::init()
198
199
s->write (" <ul>" );
199
200
}
200
201
201
- void HtmlChannelList::addChannel (cChannel* channel, std:: string group, bool image)
202
+ void HtmlChannelList::addChannel (cChannel* channel, string group, bool image)
202
203
{
203
204
if ( filtered () ) return ;
204
205
@@ -213,20 +214,20 @@ void HtmlChannelList::finish()
213
214
s->write (" </body></html>" );
214
215
}
215
216
216
- void JsonChannelList::addChannel (cChannel* channel, std:: string group, bool image)
217
+ void JsonChannelList::addChannel (cChannel* channel, string group, bool image)
217
218
{
218
219
if ( filtered () ) return ;
219
220
220
- std:: string suffix = (std:: string) " .ts" ;
221
+ string suffix = (string) " .ts" ;
221
222
222
223
SerChannel serChannel;
223
224
serChannel.Name = StringExtension::UTF8Decode (channel->Name ());
224
225
serChannel.Number = channel->Number ();
225
- serChannel.ChannelId = StringExtension::UTF8Decode ((std:: string)channel->GetChannelID ().ToString ());
226
+ serChannel.ChannelId = StringExtension::UTF8Decode ((string)channel->GetChannelID ().ToString ());
226
227
serChannel.Image = image;
227
228
serChannel.Group = StringExtension::UTF8Decode (group);
228
229
serChannel.Transponder = channel->Transponder ();
229
- serChannel.Stream = StringExtension::UTF8Decode (((std:: string)channel->GetChannelID ().ToString () + (std:: string)suffix).c_str ());
230
+ serChannel.Stream = StringExtension::UTF8Decode (((string)channel->GetChannelID ().ToString () + (string)suffix).c_str ());
230
231
// TODO: There is an atsc Patch
231
232
#if APIVERSNUM >= 10714
232
233
serChannel.IsAtsc = channel->IsAtsc ();
@@ -255,20 +256,20 @@ void XmlChannelList::init()
255
256
s->write (" <channels xmlns=\" http://www.domain.org/restfulapi/2011/channels-xml\" >\n " );
256
257
}
257
258
258
- void XmlChannelList::addChannel (cChannel* channel, std:: string group, bool image)
259
+ void XmlChannelList::addChannel (cChannel* channel, string group, bool image)
259
260
{
260
261
if ( filtered () ) return ;
261
262
262
- std:: string suffix = (std:: string) " .ts" ;
263
+ string suffix = (string) " .ts" ;
263
264
264
265
s->write (" <channel>\n " );
265
266
s->write (cString::sprintf (" <param name=\" name\" >%s</param>\n " , StringExtension::encodeToXml (channel->Name ()).c_str ()));
266
267
s->write (cString::sprintf (" <param name=\" number\" >%i</param>\n " , channel->Number ()));
267
- s->write (cString::sprintf (" <param name=\" channel_id\" >%s</param>\n " , StringExtension::encodeToXml ( (std:: string)channel->GetChannelID ().ToString ()).c_str ()));
268
+ s->write (cString::sprintf (" <param name=\" channel_id\" >%s</param>\n " , StringExtension::encodeToXml ( (string)channel->GetChannelID ().ToString ()).c_str ()));
268
269
s->write (cString::sprintf (" <param name=\" image\" >%s</param>\n " , (image ? " true" : " false" )));
269
270
s->write (cString::sprintf (" <param name=\" group\" >%s</param>\n " , StringExtension::encodeToXml ( group ).c_str ()));
270
271
s->write (cString::sprintf (" <param name=\" transponder\" >%i</param>\n " , channel->Transponder ()));
271
- s->write (cString::sprintf (" <param name=\" stream\" >%s</param>\n " , StringExtension::encodeToXml ( ((std:: string)channel->GetChannelID ().ToString () + (std:: string)suffix).c_str ()).c_str ()));
272
+ s->write (cString::sprintf (" <param name=\" stream\" >%s</param>\n " , StringExtension::encodeToXml ( ((string)channel->GetChannelID ().ToString () + (string)suffix).c_str ()).c_str ()));
272
273
// TODO: There is an atsc Patch
273
274
#if APIVERSNUM >= 10714
274
275
s->write (cString::sprintf (" <param name=\" is_atsc\" >%s</param>\n " , channel->IsAtsc () ? " true" : " false" ));
@@ -305,7 +306,7 @@ void HtmlChannelGroupList::init()
305
306
s->write (" <ul>" );
306
307
}
307
308
308
- void HtmlChannelGroupList::addGroup (std:: string group)
309
+ void HtmlChannelGroupList::addGroup (string group)
309
310
{
310
311
if ( filtered () ) return ;
311
312
@@ -320,7 +321,7 @@ void HtmlChannelGroupList::finish()
320
321
s->write (" </body></html>" );
321
322
}
322
323
323
- void JsonChannelGroupList::addGroup (std:: string group)
324
+ void JsonChannelGroupList::addGroup (string group)
324
325
{
325
326
if ( filtered () ) return ;
326
327
groups.push_back (StringExtension::UTF8Decode (group));
@@ -341,7 +342,7 @@ void XmlChannelGroupList::init()
341
342
s->write (" <groups xmlns=\" http://www.domain.org/restfulapi/2011/groups-xml\" >\n " );
342
343
}
343
344
344
- void XmlChannelGroupList::addGroup (std:: string group)
345
+ void XmlChannelGroupList::addGroup (string group)
345
346
{
346
347
if ( filtered () ) return ;
347
348
s->write (cString::sprintf (" <group>%s</group>\n " , group.c_str ()));
0 commit comments