1 | #ifndef HTTPDFUNC_H
|
---|
2 | #define HTTPDFUNC_H
|
---|
3 |
|
---|
4 | time_t webcreatetimeline(char** buf, int* maxlen, int* pos)
|
---|
5 | {
|
---|
6 | int i = 0;
|
---|
7 | struct tm *loctime = NULL;
|
---|
8 | int timeadd = 15 * 60;
|
---|
9 | char* buf1 = NULL;
|
---|
10 | time_t akttimeadd = 0;
|
---|
11 |
|
---|
12 | #ifdef SIMULATE
|
---|
13 | time_t akttime = 1307871000;
|
---|
14 | akttime = 1315614961;
|
---|
15 | #else
|
---|
16 | time_t akttime = time(NULL);
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | akttime -= (((akttime) % 100));
|
---|
20 | akttime -= (((akttime / 60) % 15) * 60);
|
---|
21 | akttimeadd = akttime;
|
---|
22 |
|
---|
23 | buf1 = malloc(6);
|
---|
24 | if(buf1 == NULL)
|
---|
25 | {
|
---|
26 | err("no mem");
|
---|
27 | return akttime;
|
---|
28 | }
|
---|
29 |
|
---|
30 | //not shown
|
---|
31 | ostrcatbig(buf, "<th class=gepgchannel1> </th><th style=\"width: 1px; max-width: 1px; min-width: 1px;\"></th>", maxlen, pos);
|
---|
32 | for(i = 0; i < 96; i++)
|
---|
33 | {
|
---|
34 | loctime = olocaltime(&akttimeadd);
|
---|
35 | if(loctime != NULL)
|
---|
36 | strftime(buf1, 6, "%H:%M", loctime);
|
---|
37 | else
|
---|
38 | snprintf(buf1, 6, "00:00");
|
---|
39 | free(loctime); loctime = NULL;
|
---|
40 |
|
---|
41 | ostrcatbig(buf, "<th class=gepgtimelinecell><div class=gepgcellborder>", maxlen, pos);
|
---|
42 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
43 | ostrcatbig(buf, "</div></th>", maxlen, pos);
|
---|
44 |
|
---|
45 | akttimeadd += timeadd;
|
---|
46 | }
|
---|
47 |
|
---|
48 | free(buf1);
|
---|
49 | return akttime / 60;
|
---|
50 | }
|
---|
51 |
|
---|
52 | void webcreatetailbig(char** buf, int* maxlen, int* pos, int flag)
|
---|
53 | {
|
---|
54 | ostrcatbig(buf, "</table></font></center></body></html>", maxlen, pos);
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | char* webcreatetail(char* buf, int flag)
|
---|
59 | {
|
---|
60 | buf = ostrcat(buf, "</table></font></center></body></html>", 1, 0);
|
---|
61 | return buf;
|
---|
62 | }
|
---|
63 |
|
---|
64 | void webcreateheadbig(char** buf, int* maxlen, char* meta, int* pos, int flag)
|
---|
65 | {
|
---|
66 | ostrcatbig(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css>", maxlen, pos);
|
---|
67 | if(meta != NULL)
|
---|
68 | ostrcatbig(buf, meta, maxlen, pos);
|
---|
69 | ostrcatbig(buf, "</head><body class=body>", maxlen, pos);
|
---|
70 | if(flag == 0)
|
---|
71 | ostrcatbig(buf, "<center><table border=0 width=100%>", maxlen, pos);
|
---|
72 | else
|
---|
73 | ostrcatbig(buf, "<center><table border=0 width=100% height=100%>", maxlen, pos);
|
---|
74 | }
|
---|
75 |
|
---|
76 | char* webcreatehead(char* buf, char* meta, int flag)
|
---|
77 | {
|
---|
78 | buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css>", 1, 0);
|
---|
79 | if(meta != NULL)
|
---|
80 | buf = ostrcat(buf, meta, 1, 0);
|
---|
81 | buf = ostrcat(buf, "</head><body class=body>", 1, 0);
|
---|
82 | if(flag == 0)
|
---|
83 | buf = ostrcat(buf, "<center><table border=0 width=100%>", 1, 0);
|
---|
84 | else
|
---|
85 | buf = ostrcat(buf, "<center><table border=0 width=100% height=100%>", 1, 0);
|
---|
86 | return buf;
|
---|
87 | }
|
---|
88 |
|
---|
89 | void webcreatechannelbody(char** buf, int line, struct channel* chnode, char* channellist, int* maxlen, int* pos, int flag, int fmt)
|
---|
90 | {
|
---|
91 | char* tmpstr = NULL, *buf1 = NULL, *serviceid = NULL, *transponderid = NULL;
|
---|
92 | struct epg* epgnode = getepgakt(chnode);
|
---|
93 | int ret = 0, proz = 0;
|
---|
94 | struct tm *loctime = NULL;
|
---|
95 | time_t max = 0, akt = 0;
|
---|
96 |
|
---|
97 | if(chnode == NULL) return;
|
---|
98 | ret = channelnottunable(chnode);
|
---|
99 |
|
---|
100 | buf1 = malloc(MINMALLOC);
|
---|
101 | if(buf1 == NULL)
|
---|
102 | {
|
---|
103 | err("no mem");
|
---|
104 | return;
|
---|
105 | }
|
---|
106 |
|
---|
107 | if(fmt == 0)
|
---|
108 | {
|
---|
109 | if(line == 0)
|
---|
110 | ostrcatbig(buf, "<tr class=line1>", maxlen, pos);
|
---|
111 | else
|
---|
112 | ostrcatbig(buf, "<tr class=line2>", maxlen, pos);
|
---|
113 | }
|
---|
114 |
|
---|
115 | if(epgnode != NULL)
|
---|
116 | {
|
---|
117 | proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime);
|
---|
118 | if(proz > 100) proz = 100;
|
---|
119 | if(proz < 0) proz = 0;
|
---|
120 | }
|
---|
121 |
|
---|
122 | if(fmt == 0)
|
---|
123 | {
|
---|
124 | ostrcatbig(buf, "<td width=100% valign=middle nowrap class=link><div class=timelineborder><div class=timelinebar style=\"width: ", maxlen, pos);
|
---|
125 | tmpstr = oitoa(proz);
|
---|
126 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
127 | free(tmpstr); tmpstr = NULL;
|
---|
128 | ostrcatbig(buf, "%;\"> </div></div>", maxlen, pos);
|
---|
129 | }
|
---|
130 |
|
---|
131 | serviceid = oitoa(chnode->serviceid);
|
---|
132 | transponderid = ollutoa(chnode->transponderid);
|
---|
133 |
|
---|
134 | if(fmt == 0 && ret == 0)
|
---|
135 | {
|
---|
136 | ostrcatbig(buf, "<a target=aktservice class=link href=query?switch&", maxlen, pos);
|
---|
137 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
138 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
139 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
140 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
141 | ostrcatbig(buf, channellist, maxlen, pos);
|
---|
142 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
143 | }
|
---|
144 |
|
---|
145 | if(fmt == 0)
|
---|
146 | {
|
---|
147 | ostrcatbig(buf, chnode->name, maxlen, pos);
|
---|
148 | if(ret == 0)
|
---|
149 | ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
150 | }
|
---|
151 | else
|
---|
152 | {
|
---|
153 | *buf = ostrcat(*buf, chnode->name, 1, 0);
|
---|
154 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
155 | *buf = ostrcat(*buf, oitoa(proz), 1, 1);
|
---|
156 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
157 | *buf = ostrcat(*buf, serviceid, 1, 0);
|
---|
158 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
159 | *buf = ostrcat(*buf, transponderid, 1, 0);
|
---|
160 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
161 | *buf = ostrcat(*buf, channellist, 1, 0);
|
---|
162 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
163 | *buf = ostrcat(*buf, oitoa(chnode->servicetype), 1, 1);
|
---|
164 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
165 | if(epgnode != NULL)
|
---|
166 | {
|
---|
167 | *buf = ostrcat(*buf, oitoa(epgnode->eventid), 1, 1);
|
---|
168 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
169 | *buf = ostrcat(*buf, olutoa(epgnode->starttime), 1, 1);
|
---|
170 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
171 | *buf = ostrcat(*buf, epgnode->title, 1, 0);
|
---|
172 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
173 | if(epgnode->next != NULL)
|
---|
174 | {
|
---|
175 | *buf = ostrcat(*buf, olutoa(epgnode->next->starttime), 1, 1);
|
---|
176 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
177 | *buf = ostrcat(*buf, olutoa(epgnode->next->endtime), 1, 1);
|
---|
178 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
179 | *buf = ostrcat(*buf, epgnode->next->title, 1, 0);
|
---|
180 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
181 | *buf = ostrcat(*buf, oitoa(epgnode->next->eventid), 1, 1);
|
---|
182 | }
|
---|
183 | else
|
---|
184 | {
|
---|
185 | *buf = ostrcat(*buf, olutoa(epgnode->endtime), 1, 1);
|
---|
186 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
187 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
188 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
189 | *buf = ostrcat(*buf, "0", 1, 0);
|
---|
190 | }
|
---|
191 | }
|
---|
192 | else
|
---|
193 | {
|
---|
194 | *buf = ostrcat(*buf, "0", 1, 0);
|
---|
195 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
196 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
197 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
198 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
199 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
200 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
201 | *buf = ostrcat(*buf, "0", 1, 0);
|
---|
202 | }
|
---|
203 | *buf = ostrcat(*buf, "#", 1, 0);
|
---|
204 |
|
---|
205 | if(ret == 1)
|
---|
206 | *buf = ostrcat(*buf, "1", 1, 0);
|
---|
207 | else
|
---|
208 | *buf = ostrcat(*buf, "0", 1, 0);
|
---|
209 |
|
---|
210 | *buf = ostrcat(*buf, "\n", 1, 0);
|
---|
211 | }
|
---|
212 |
|
---|
213 | //akt epg
|
---|
214 | if(fmt == 0 && epgnode != NULL)
|
---|
215 | {
|
---|
216 | if(flag == 0)
|
---|
217 | ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
218 | else
|
---|
219 | ostrcatbig(buf, " <a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
220 |
|
---|
221 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
222 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
223 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
224 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
225 | tmpstr = oitoa(epgnode->eventid);
|
---|
226 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
227 | free(tmpstr); tmpstr = NULL;
|
---|
228 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
229 |
|
---|
230 | loctime = olocaltime(&epgnode->starttime);
|
---|
231 | if(loctime != NULL)
|
---|
232 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
233 | free(loctime); loctime = NULL;
|
---|
234 | loctime = olocaltime(&epgnode->endtime);
|
---|
235 | if(loctime != NULL)
|
---|
236 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
237 | free(loctime); loctime = NULL;
|
---|
238 |
|
---|
239 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
240 | ostrcatbig(buf, epgnode->title, maxlen, pos);
|
---|
241 |
|
---|
242 | max = (epgnode->endtime - epgnode->starttime) / 60;
|
---|
243 | akt = (time(NULL) - epgnode->starttime) / 60;
|
---|
244 | if(max < 0) max = 0;
|
---|
245 | if(akt < 0) akt = 0;
|
---|
246 | snprintf(buf1, MINMALLOC, " (%ld from %ld min, %d%%)", akt, max, proz);
|
---|
247 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
248 |
|
---|
249 | ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
250 |
|
---|
251 | //next epg
|
---|
252 | epgnode = epgnode->next;
|
---|
253 | if(flag == 0 && epgnode != NULL)
|
---|
254 | {
|
---|
255 | ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
256 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
257 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
258 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
259 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
260 | tmpstr = oitoa(epgnode->eventid);
|
---|
261 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
262 | free(tmpstr); tmpstr = NULL;
|
---|
263 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
264 |
|
---|
265 | loctime = olocaltime(&epgnode->starttime);
|
---|
266 | if(loctime != NULL)
|
---|
267 | strftime(buf1, 8, "%H:%M -", loctime);
|
---|
268 | free(loctime); loctime = NULL;
|
---|
269 | loctime = olocaltime(&epgnode->endtime);
|
---|
270 | if(loctime != NULL)
|
---|
271 | strftime(&buf1[7], 8, " %H:%M ", loctime);
|
---|
272 | free(loctime); loctime = NULL;
|
---|
273 |
|
---|
274 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
275 | ostrcatbig(buf, epgnode->title, maxlen, pos);
|
---|
276 | ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
277 | }
|
---|
278 | }
|
---|
279 |
|
---|
280 | //tv - radio
|
---|
281 | if(fmt == 0)
|
---|
282 | {
|
---|
283 | if(chnode->servicetype == 0)
|
---|
284 | ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/tv.png alt=TV width=16 height=16>", maxlen, pos);
|
---|
285 | else
|
---|
286 | ostrcatbig(buf, "</td><td width=100 align=right valign=middle nowrap><img style=\"margin-left: 5\" border=0 src=img/radio.png alt=Radio width=16 height=16>", maxlen, pos);
|
---|
287 |
|
---|
288 | //single epg
|
---|
289 | ostrcatbig(buf, "<a target=main href=query?getsingleepg&", maxlen, pos);
|
---|
290 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
291 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
292 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
293 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/singleepg.png alt=\"Single EPG\" width=16 height=16></a>", maxlen, pos);
|
---|
294 |
|
---|
295 | //m3u stream + webstream
|
---|
296 | if(ret == 0)
|
---|
297 | {
|
---|
298 | ostrcatbig(buf, "<a target=nothing href=query?getm3u&", maxlen, pos);
|
---|
299 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
300 | ostrcatbig(buf, ",", maxlen, pos);
|
---|
301 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
302 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/stream.png alt=Stream width=16 height=16></a>", maxlen, pos);
|
---|
303 |
|
---|
304 | ostrcatbig(buf, "<a target=_blank href=query?getvideo&", maxlen, pos);
|
---|
305 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
306 | ostrcatbig(buf, ",", maxlen, pos);
|
---|
307 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
308 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/webstream.png alt=WebStream width=16 height=16></a>", maxlen, pos);
|
---|
309 | }
|
---|
310 | else
|
---|
311 | ostrcatbig(buf, "<img style=\"margin-left: 5\" border=0 src=img/cross.png alt=\"Channel not availabel\" width=16 height=16>", maxlen, pos);
|
---|
312 | ostrcatbig(buf, "</td></tr>", maxlen, pos);
|
---|
313 | }
|
---|
314 |
|
---|
315 | free(buf1);
|
---|
316 | free(serviceid);
|
---|
317 | free(transponderid);
|
---|
318 | }
|
---|
319 |
|
---|
320 | char* webgetbouquetchannel(char* param, int fmt)
|
---|
321 | {
|
---|
322 | char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
|
---|
323 | struct mainbouquet *mbouquet = NULL;
|
---|
324 | struct bouquet *node = NULL;
|
---|
325 | struct channel* chnode = NULL;
|
---|
326 | int line = 0, maxlen = 0, pos = 0;
|
---|
327 |
|
---|
328 | if(param == NULL) return NULL;
|
---|
329 |
|
---|
330 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
|
---|
331 |
|
---|
332 | mbouquet = getmainbouquet(param);
|
---|
333 | if(mbouquet != NULL)
|
---|
334 | {
|
---|
335 | node = mbouquet->bouquet;
|
---|
336 | tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
|
---|
337 | tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
|
---|
338 | tmpstr1 = htmlencode(tmpstr);
|
---|
339 | free(tmpstr); tmpstr = NULL;
|
---|
340 | while(node != NULL)
|
---|
341 | {
|
---|
342 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
343 | if(chnode != NULL)
|
---|
344 | {
|
---|
345 | webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
|
---|
346 | if(line == 0)
|
---|
347 | line = 1;
|
---|
348 | else
|
---|
349 | line = 0;
|
---|
350 | }
|
---|
351 | node = node->next;
|
---|
352 | }
|
---|
353 | free(tmpstr1); tmpstr1 = NULL;
|
---|
354 | }
|
---|
355 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
356 |
|
---|
357 | return buf;
|
---|
358 | }
|
---|
359 |
|
---|
360 | //flag 0: all
|
---|
361 | //flag 1: sat
|
---|
362 | //flag 2: provider
|
---|
363 | //flag 3: A-Z
|
---|
364 | char* webgetchannel(int param, int flag, int page, int fmt)
|
---|
365 | {
|
---|
366 | char* buf = NULL, *tmpnr = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
|
---|
367 | struct channel* chnode = channel;
|
---|
368 | int line = 0, maxcount = 0, maxlen = 0, pos = 0;
|
---|
369 |
|
---|
370 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=60>", &pos, 0);
|
---|
371 |
|
---|
372 | if(flag == 0) tmpstr1 = ostrcat(tmpstr1, "(ALL)", 1, 0);
|
---|
373 | if(flag == 1)
|
---|
374 | {
|
---|
375 | struct sat* node = getsatbyorbitalpos(param);
|
---|
376 | if(node != NULL)
|
---|
377 | {
|
---|
378 | tmpstr = ostrcat(tmpstr, "(SAT)-", 1, 0);
|
---|
379 | tmpstr = ostrcat(tmpstr, node->name, 1, 0);
|
---|
380 | tmpstr1 = htmlencode(tmpstr);
|
---|
381 | free(tmpstr); tmpstr = NULL;
|
---|
382 | }
|
---|
383 | }
|
---|
384 | if(flag == 2)
|
---|
385 | {
|
---|
386 | struct provider* node = getprovider(param);
|
---|
387 | if(node != NULL)
|
---|
388 | {
|
---|
389 | tmpstr = ostrcat(tmpstr, "(PROVIDER)-", 1, 0);
|
---|
390 | tmpstr = ostrcat(tmpstr, node->name, 1, 0);
|
---|
391 | tmpstr1 = htmlencode(tmpstr);
|
---|
392 | free(tmpstr); tmpstr = NULL;
|
---|
393 | }
|
---|
394 | }
|
---|
395 | if(flag == 3)
|
---|
396 | {
|
---|
397 | tmpstr = malloc(2);
|
---|
398 | if(tmpstr != NULL)
|
---|
399 | snprintf(tmpstr, 2, "%c", param);
|
---|
400 | tmpstr = ostrcat("(A-Z)-", tmpstr, 0, 1);
|
---|
401 | tmpstr1 = htmlencode(tmpstr);
|
---|
402 | free(tmpstr); tmpstr = NULL;
|
---|
403 | }
|
---|
404 |
|
---|
405 | while(chnode != NULL)
|
---|
406 | {
|
---|
407 | if(chnode->transponder == NULL)
|
---|
408 | {
|
---|
409 | chnode = chnode->next;
|
---|
410 | continue;
|
---|
411 | }
|
---|
412 | if(chnode->name == NULL)
|
---|
413 | {
|
---|
414 | chnode = chnode->next;
|
---|
415 | continue;
|
---|
416 | }
|
---|
417 | if(flag == 1 && chnode->transponder->orbitalpos != param)
|
---|
418 | {
|
---|
419 | chnode = chnode->next;
|
---|
420 | continue;
|
---|
421 | }
|
---|
422 | if(flag == 2 && chnode->providerid != param)
|
---|
423 | {
|
---|
424 | chnode = chnode->next;
|
---|
425 | continue;
|
---|
426 | }
|
---|
427 | if(flag == 3 && chnode->name[0] != param && chnode->name[0] != param + 32)
|
---|
428 | {
|
---|
429 | chnode = chnode->next;
|
---|
430 | continue;
|
---|
431 | }
|
---|
432 |
|
---|
433 | maxcount++;
|
---|
434 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
435 | {
|
---|
436 | chnode = chnode->next;
|
---|
437 | continue;
|
---|
438 | }
|
---|
439 | webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0, fmt);
|
---|
440 |
|
---|
441 | if(line == 0)
|
---|
442 | line = 1;
|
---|
443 | else
|
---|
444 | line = 0;
|
---|
445 |
|
---|
446 | chnode = chnode->next;
|
---|
447 | }
|
---|
448 | free(tmpstr); tmpstr = NULL;
|
---|
449 |
|
---|
450 | if(fmt == 0 && maxcount > MAXHTMLLINE)
|
---|
451 | {
|
---|
452 | int i;
|
---|
453 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
454 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
455 | {
|
---|
456 | if(page == i)
|
---|
457 | ostrcatbig(&buf, "<a class=pagesellink href=query?getchannelpage&", &maxlen, &pos);
|
---|
458 | else
|
---|
459 | ostrcatbig(&buf, "<a class=pagelink href=query?getchannelpage&", &maxlen, &pos);
|
---|
460 | tmpnr = oitoa(param);
|
---|
461 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
462 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
463 | free(tmpnr); tmpnr = NULL;
|
---|
464 | tmpnr = oitoa(flag);
|
---|
465 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
466 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
467 | free(tmpnr); tmpnr = NULL;
|
---|
468 |
|
---|
469 | tmpnr = oitoa(i);
|
---|
470 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
471 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
472 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
473 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
474 | free(tmpnr); tmpnr = NULL;
|
---|
475 | }
|
---|
476 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
477 | }
|
---|
478 |
|
---|
479 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
480 | return buf;
|
---|
481 | }
|
---|
482 |
|
---|
483 | char* webgetprovider(int fmt)
|
---|
484 | {
|
---|
485 | char* buf = NULL, *tmpstr = NULL;
|
---|
486 | struct provider* node = provider;
|
---|
487 | int line = 0, maxlen = 0, pos = 0;
|
---|
488 |
|
---|
489 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
490 |
|
---|
491 | while(node != NULL)
|
---|
492 | {
|
---|
493 | if(fmt == 0)
|
---|
494 | {
|
---|
495 | if(line == 0)
|
---|
496 | {
|
---|
497 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
|
---|
498 | tmpstr = oitoa(node->providerid);
|
---|
499 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
500 | free(tmpstr); tmpstr = NULL;
|
---|
501 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
502 | line = 1;
|
---|
503 | }
|
---|
504 | else
|
---|
505 | {
|
---|
506 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
|
---|
507 | tmpstr = oitoa(node->providerid);
|
---|
508 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
509 | free(tmpstr); tmpstr = NULL;
|
---|
510 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
511 | line = 0;
|
---|
512 | }
|
---|
513 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
514 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
515 | }
|
---|
516 | else
|
---|
517 | {
|
---|
518 | buf = ostrcat(buf, node->name, 1, 0);
|
---|
519 | buf = ostrcat(buf, "#", 1, 0);
|
---|
520 | buf = ostrcat(buf, oitoa(node->providerid), 1, 1);
|
---|
521 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
522 | }
|
---|
523 |
|
---|
524 | node = node->next;
|
---|
525 | }
|
---|
526 |
|
---|
527 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
528 | return buf;
|
---|
529 | }
|
---|
530 |
|
---|
531 | char* webgetsat(int fmt)
|
---|
532 | {
|
---|
533 | char* buf = NULL, *tmpstr = NULL;
|
---|
534 | struct sat* node = sat;
|
---|
535 | int line = 0, maxlen = 0, pos = 0;
|
---|
536 |
|
---|
537 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
538 |
|
---|
539 | while(node != NULL)
|
---|
540 | {
|
---|
541 | if(fmt == 0)
|
---|
542 | {
|
---|
543 | if(line == 0)
|
---|
544 | {
|
---|
545 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
|
---|
546 | tmpstr = oitoa(node->orbitalpos);
|
---|
547 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
548 | free(tmpstr); tmpstr = NULL;
|
---|
549 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
550 | line = 1;
|
---|
551 | }
|
---|
552 | else
|
---|
553 | {
|
---|
554 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
|
---|
555 | tmpstr = oitoa(node->orbitalpos);
|
---|
556 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
557 | free(tmpstr); tmpstr = NULL;
|
---|
558 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
559 | line = 0;
|
---|
560 | }
|
---|
561 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
562 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
563 | }
|
---|
564 | else
|
---|
565 | {
|
---|
566 | buf = ostrcat(buf, node->name, 1, 0);
|
---|
567 | buf = ostrcat(buf, "#", 1, 0);
|
---|
568 | buf = ostrcat(buf, oitoa(node->orbitalpos), 1, 1);
|
---|
569 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
570 | }
|
---|
571 |
|
---|
572 | node = node->next;
|
---|
573 | }
|
---|
574 |
|
---|
575 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
576 | return buf;
|
---|
577 | }
|
---|
578 |
|
---|
579 | char* webgetaz(int fmt)
|
---|
580 | {
|
---|
581 | char* buf = NULL, *tmpstr = NULL, *tmpnr = NULL;
|
---|
582 | int line = 0, maxlen = 0, pos = 0, i;
|
---|
583 |
|
---|
584 | tmpstr = malloc(2);
|
---|
585 | if(tmpstr == NULL)
|
---|
586 | {
|
---|
587 | err("no memory");
|
---|
588 | return NULL;
|
---|
589 | }
|
---|
590 |
|
---|
591 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
592 |
|
---|
593 | for(i = 65; i < 91; i++)
|
---|
594 | {
|
---|
595 | if(fmt == 0)
|
---|
596 | {
|
---|
597 | if(line == 0)
|
---|
598 | {
|
---|
599 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
|
---|
600 | tmpnr = oitoa(i);
|
---|
601 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
602 | free(tmpnr); tmpnr = NULL;
|
---|
603 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
604 | line = 1;
|
---|
605 | }
|
---|
606 | else
|
---|
607 | {
|
---|
608 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
|
---|
609 | tmpnr = oitoa(i);
|
---|
610 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
611 | free(tmpnr); tmpnr = NULL;
|
---|
612 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
613 | line = 0;
|
---|
614 | }
|
---|
615 | snprintf(tmpstr, 2, "%c", i);
|
---|
616 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
617 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
618 | }
|
---|
619 | else
|
---|
620 | {
|
---|
621 | snprintf(tmpstr, 2, "%c", i);
|
---|
622 | buf = ostrcat(buf, tmpstr, 1, 0);
|
---|
623 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
624 | }
|
---|
625 | }
|
---|
626 |
|
---|
627 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
628 | free(tmpstr);
|
---|
629 | return buf;
|
---|
630 | }
|
---|
631 |
|
---|
632 | char* webgetbouquet(int fmt)
|
---|
633 | {
|
---|
634 | char* buf = NULL;
|
---|
635 | struct mainbouquet* node = mainbouquet;
|
---|
636 | int line = 0, maxlen = 0, pos = 0;
|
---|
637 |
|
---|
638 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
639 |
|
---|
640 | while(node != NULL)
|
---|
641 | {
|
---|
642 | if(fmt == 0)
|
---|
643 | {
|
---|
644 | if(line == 0)
|
---|
645 | {
|
---|
646 | ostrcatbig(&buf, "<tr class=line1><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
|
---|
647 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
648 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
649 | line = 1;
|
---|
650 | }
|
---|
651 | else
|
---|
652 | {
|
---|
653 | ostrcatbig(&buf, "<tr class=line2><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
|
---|
654 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
655 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
656 | line = 0;
|
---|
657 | }
|
---|
658 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
659 | ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
|
---|
660 |
|
---|
661 | ostrcatbig(&buf, "<td width=50 nowrap align=right valign=middle><img style=\"margin-left: 5\" border=0 src=", &maxlen, &pos);
|
---|
662 |
|
---|
663 | if(node->type == 0)
|
---|
664 | ostrcatbig(&buf, "img/tv.png width=16 height=16 alt=TV>", &maxlen, &pos);
|
---|
665 | else
|
---|
666 | ostrcatbig(&buf, "img/radio.png width=16 height=16 alt=Radio>", &maxlen, &pos);
|
---|
667 | ostrcatbig(&buf, "<a href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
668 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
669 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
670 | ostrcatbig(&buf, "<img style=\"margin-left: 5\" border=0 width=16 height=16 alt=\"Graphical Multi EPG\" src=img/gmultiepg.png></a>", &maxlen, &pos);
|
---|
671 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
672 | }
|
---|
673 | else
|
---|
674 | {
|
---|
675 | buf = ostrcat(buf, node->name, 1, 0);
|
---|
676 | buf = ostrcat(buf, "#", 1, 0);
|
---|
677 | buf = ostrcat(buf, oitoa(node->type), 1, 1);
|
---|
678 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
679 | }
|
---|
680 |
|
---|
681 | node = node->next;
|
---|
682 | }
|
---|
683 |
|
---|
684 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
685 | return buf;
|
---|
686 | }
|
---|
687 |
|
---|
688 | char* websetmute(char* param, int fmt)
|
---|
689 | {
|
---|
690 | char* buf = NULL;
|
---|
691 | int mute = status.mute;
|
---|
692 |
|
---|
693 | if(param != NULL)
|
---|
694 | mute = atoi(param);
|
---|
695 |
|
---|
696 | if(fmt == 0)
|
---|
697 | {
|
---|
698 | buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><center>", 1, 0);
|
---|
699 | if(mute == 0)
|
---|
700 | buf = ostrcat(buf, "<a href=query?setmute&1><img src=img/speak_on.png border=0 alt=\"Mute on\"></img></a>", 1, 0);
|
---|
701 | else
|
---|
702 | buf = ostrcat(buf, "<a href=query?setmute&0><img src=img/speak_off.png border=0 alt=\"Mute off\"></img></a>", 1, 0);
|
---|
703 | buf = ostrcat(buf, "</center></body></html>", 1, 0);
|
---|
704 | }
|
---|
705 | else
|
---|
706 | {
|
---|
707 | if(mute == 0)
|
---|
708 | buf = ostrcat(buf, "0", 1, 0);
|
---|
709 | else
|
---|
710 | buf = ostrcat(buf, "1", 1, 0);
|
---|
711 | }
|
---|
712 |
|
---|
713 | if(mute != status.mute)
|
---|
714 | screenmute(NULL, NULL, 0);
|
---|
715 |
|
---|
716 | return buf;
|
---|
717 | }
|
---|
718 |
|
---|
719 | char* websetvol(char* param, int fmt)
|
---|
720 | {
|
---|
721 | char* buf = NULL;
|
---|
722 | int vol = 30;
|
---|
723 |
|
---|
724 | if(param == NULL)
|
---|
725 | vol = getvol();
|
---|
726 | else
|
---|
727 | vol = atoi(param);
|
---|
728 |
|
---|
729 | if(fmt == 0)
|
---|
730 | {
|
---|
731 | buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><center>", 1, 0);
|
---|
732 | if(vol >=10)
|
---|
733 | buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
734 | else
|
---|
735 | buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
736 | if(vol >=20)
|
---|
737 | buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
738 | else
|
---|
739 | buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
740 | if(vol >=30)
|
---|
741 | buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
742 | else
|
---|
743 | buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
744 | if(vol >=40)
|
---|
745 | buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
746 | else
|
---|
747 | buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
748 | if(vol >=50)
|
---|
749 | buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
750 | else
|
---|
751 | buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
752 | if(vol >=60)
|
---|
753 | buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
754 | else
|
---|
755 | buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
756 | if(vol >=70)
|
---|
757 | buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
758 | else
|
---|
759 | buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
760 | if(vol >=80)
|
---|
761 | buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
762 | else
|
---|
763 | buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
764 | if(vol >=90)
|
---|
765 | buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
766 | else
|
---|
767 | buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
768 | if(vol >=100)
|
---|
769 | buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
770 | else
|
---|
771 | buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
772 | buf = ostrcat(buf, "</center></body></html>", 1, 0);
|
---|
773 | }
|
---|
774 | else
|
---|
775 | buf = ostrcat(buf, oitoa(vol), 1, 1);
|
---|
776 |
|
---|
777 | if(param != NULL)
|
---|
778 | {
|
---|
779 | setvol(vol);
|
---|
780 | if(status.mute == 1)
|
---|
781 | screenmute(NULL, NULL, 0);
|
---|
782 | }
|
---|
783 | return buf;
|
---|
784 | }
|
---|
785 |
|
---|
786 | char* webgetaktservice(int fmt)
|
---|
787 | {
|
---|
788 | char* buf = NULL;
|
---|
789 | struct channel* chnode = status.aktservice->channel;
|
---|
790 | int line = 0, maxlen = 0, pos = 0;
|
---|
791 |
|
---|
792 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
|
---|
793 | webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
|
---|
794 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
|
---|
795 |
|
---|
796 | return buf;
|
---|
797 | }
|
---|
798 |
|
---|
799 | char* webgetservice(char* param, int fmt)
|
---|
800 | {
|
---|
801 | char* buf = NULL, *param1 = NULL;
|
---|
802 | struct channel* chnode = NULL;
|
---|
803 | int line = 0, maxlen = 0, pos = 0;
|
---|
804 |
|
---|
805 | if(param == NULL) return NULL;
|
---|
806 |
|
---|
807 | //create param1
|
---|
808 | param1 = strchr(param, '&');
|
---|
809 | if(param1 != NULL)
|
---|
810 | *param1++ = '\0';
|
---|
811 |
|
---|
812 | if(param1 == NULL) return NULL;
|
---|
813 |
|
---|
814 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
815 |
|
---|
816 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
|
---|
817 | webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1, fmt);
|
---|
818 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 1);
|
---|
819 |
|
---|
820 | return buf;
|
---|
821 | }
|
---|
822 |
|
---|
823 | char* webswitch(char* param, int fmt)
|
---|
824 | {
|
---|
825 | if(status.channelswitch == 1) goto end;
|
---|
826 |
|
---|
827 | int ret = 0;
|
---|
828 | char* param1 = NULL, *param2 = NULL;
|
---|
829 | struct channel* chnode = NULL;
|
---|
830 |
|
---|
831 | if(param == NULL) goto end;
|
---|
832 |
|
---|
833 | //create param1
|
---|
834 | param1 = strchr(param, '&');
|
---|
835 | if(param1 != NULL)
|
---|
836 | {
|
---|
837 | *param1++ = '\0';
|
---|
838 | param2 = strchr(param1, '&');
|
---|
839 | if(param2 != NULL)
|
---|
840 | *param2++ = '\0';
|
---|
841 | }
|
---|
842 |
|
---|
843 | if(param1 == NULL && param2 == NULL) goto end;
|
---|
844 |
|
---|
845 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
846 | if(chnode != NULL)
|
---|
847 | {
|
---|
848 | ret = channelnottunable(chnode);
|
---|
849 | if(ret == 0)
|
---|
850 | ret = servicestart(chnode, param2, NULL, 0);
|
---|
851 | }
|
---|
852 |
|
---|
853 | end:
|
---|
854 | return webgetaktservice(fmt);
|
---|
855 | }
|
---|
856 |
|
---|
857 | char* webgetm3u(char* param, int connfd, int fmt)
|
---|
858 | {
|
---|
859 | int extip = 1;
|
---|
860 | char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
|
---|
861 | struct sockaddr_in sin;
|
---|
862 | socklen_t len = sizeof(sin);
|
---|
863 |
|
---|
864 | if(param == NULL) return NULL;
|
---|
865 |
|
---|
866 | if(getconfigint("webifip", NULL) == 1)
|
---|
867 | ip = getispip();
|
---|
868 |
|
---|
869 | if(ip == NULL)
|
---|
870 | {
|
---|
871 | if(getsockname(connfd, &sin, &len) < 0)
|
---|
872 | {
|
---|
873 | perr("getsockname");
|
---|
874 | return NULL;
|
---|
875 | }
|
---|
876 |
|
---|
877 | extip = 0;
|
---|
878 | ip = inet_ntoa(sin.sin_addr);
|
---|
879 | if(ip == NULL) return NULL;
|
---|
880 | }
|
---|
881 |
|
---|
882 | buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
|
---|
883 | buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
|
---|
884 | buf = ostrcat(buf, "http://", 1, 0);
|
---|
885 | buf = ostrcat(buf, ip, 1, 0);
|
---|
886 | buf = ostrcat(buf, ":", 1, 0);
|
---|
887 | buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
|
---|
888 | buf = ostrcat(buf, "/", 1, 0);
|
---|
889 |
|
---|
890 | tmpbuf = htmlencode(param);
|
---|
891 | if(tmpbuf != NULL)
|
---|
892 | param = tmpbuf;
|
---|
893 |
|
---|
894 | buf = ostrcat(buf, param, 1, 0);
|
---|
895 | free(tmpbuf); tmpbuf = NULL;
|
---|
896 |
|
---|
897 | if(extip == 1) free(ip);
|
---|
898 | return buf;
|
---|
899 | }
|
---|
900 |
|
---|
901 | char* webgetvideo(char* param, int connfd, int fmt)
|
---|
902 | {
|
---|
903 | int extip = 1;
|
---|
904 | char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
|
---|
905 | struct sockaddr_in sin;
|
---|
906 | socklen_t len = sizeof(sin);
|
---|
907 |
|
---|
908 | if(param == NULL) return NULL;
|
---|
909 |
|
---|
910 | if(getconfigint("webifip", NULL) == 1)
|
---|
911 | ip = getispip();
|
---|
912 |
|
---|
913 | if(ip == NULL)
|
---|
914 | {
|
---|
915 | if(getsockname(connfd, &sin, &len) < 0)
|
---|
916 | {
|
---|
917 | perr("getsockname");
|
---|
918 | return NULL;
|
---|
919 | }
|
---|
920 |
|
---|
921 | extip = 0;
|
---|
922 | ip = inet_ntoa(sin.sin_addr);
|
---|
923 | if(ip == NULL) return NULL;
|
---|
924 | }
|
---|
925 |
|
---|
926 | if(fmt == 0)
|
---|
927 | {
|
---|
928 | buf = ostrcat(buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css></head><body class=body><table border=0 width=100% height=100%><tr><td align=center valign=middle>", 1, 0);
|
---|
929 | buf = ostrcat(buf, "<embed width=100% height=100% type=application/x-vlc-plugin name=video autoplay=yes target=\"http://", 1, 0);
|
---|
930 | }
|
---|
931 | else
|
---|
932 | buf = ostrcat(buf, "http://", 1, 0);
|
---|
933 |
|
---|
934 | buf = ostrcat(buf, ip, 1, 0);
|
---|
935 | buf = ostrcat(buf, ":", 1, 0);
|
---|
936 | buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
|
---|
937 | buf = ostrcat(buf, "/", 1, 0);
|
---|
938 |
|
---|
939 | tmpbuf = htmlencode(param);
|
---|
940 | if(tmpbuf != NULL)
|
---|
941 | param = tmpbuf;
|
---|
942 |
|
---|
943 | buf = ostrcat(buf, param, 1, 0);
|
---|
944 | free(tmpbuf); tmpbuf = NULL;
|
---|
945 |
|
---|
946 | if(fmt == 0)
|
---|
947 | {
|
---|
948 | buf = ostrcat(buf, "\" />", 1, 0);
|
---|
949 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.play()'>Play</a>", 1, 0);
|
---|
950 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.stop()'>Stop</a>", 1, 0);
|
---|
951 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.fullscreen()'>Fullscreen</a>", 1, 0);
|
---|
952 | buf = ostrcat(buf, "</td></tr></body></html>", 1, 0);
|
---|
953 | }
|
---|
954 |
|
---|
955 | if(extip == 1) free(ip);
|
---|
956 | return buf;
|
---|
957 | }
|
---|
958 |
|
---|
959 | char* webvideo(char* param, int fmt)
|
---|
960 | {
|
---|
961 | char* buf = NULL, *param1 = NULL, *tmpbuf = NULL;
|
---|
962 |
|
---|
963 | if(param == NULL) return NULL;
|
---|
964 |
|
---|
965 | //create param1
|
---|
966 | param1 = strchr(param, '&');
|
---|
967 | if(param1 != NULL)
|
---|
968 | *param1++ = '\0';
|
---|
969 |
|
---|
970 | if(param1 == NULL) return NULL;
|
---|
971 |
|
---|
972 | htmldecode(param1, param1);
|
---|
973 | if(param1 != NULL)
|
---|
974 | {
|
---|
975 | if(status.play == 0 && status.webplayfile == NULL)
|
---|
976 | {
|
---|
977 | if(ostrstr(param1, "url=") == param1)
|
---|
978 | status.webplayfile = ostrcat(param1 + 4, NULL, 0, 0);
|
---|
979 | else
|
---|
980 | status.webplayfile = ostrcat(param1, NULL, 0, 0);
|
---|
981 | }
|
---|
982 | }
|
---|
983 | tmpbuf = ostrcat("not in play mode", NULL, 0, 0);
|
---|
984 |
|
---|
985 | int count = 0;
|
---|
986 | if(status.timeshift == 0 && status.play == 0 && (ostrcmp("play", param) == 0 || ostrcmp("play=", param) == 0))
|
---|
987 | {
|
---|
988 | int count = 0;
|
---|
989 |
|
---|
990 | int rcret = getrcconfigint("rcwebplay", NULL);
|
---|
991 | if(rcret == 0) rcret = getrcconfigint("rcarchive", NULL);
|
---|
992 | if(rcret == 0) rcret = getrcconfigint("rcplay", NULL);
|
---|
993 | writerc(rcret);
|
---|
994 | while(status.play == 0 && count < 30)
|
---|
995 | {
|
---|
996 | usleep(100000);
|
---|
997 | count++;
|
---|
998 | }
|
---|
999 | }
|
---|
1000 | else
|
---|
1001 | count = 31;
|
---|
1002 |
|
---|
1003 | if(count >= 30 && status.play == 0)
|
---|
1004 | {
|
---|
1005 | free(status.webplayfile); status.webplayfile = NULL;
|
---|
1006 | free(tmpbuf); tmpbuf = NULL;
|
---|
1007 | tmpbuf = ostrcat("can not start playback", NULL, 0, 0);
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | if(status.timeshift == 0 && status.play == 1)
|
---|
1011 | {
|
---|
1012 | if(ostrcmp("stop", param) == 0 || ostrcmp("stop=", param) == 0)
|
---|
1013 | writerc(getrcconfigint("rcstop", NULL));
|
---|
1014 |
|
---|
1015 | if(ostrcmp("pause", param) == 0 || ostrcmp("pause=", param) == 0)
|
---|
1016 | writerc(getrcconfigint("rcpause", NULL));
|
---|
1017 |
|
---|
1018 | if(ostrcmp("ff", param) == 0 || ostrcmp("ff=", param) == 0)
|
---|
1019 | writerc(getrcconfigint("rcff", NULL));
|
---|
1020 |
|
---|
1021 | if(ostrcmp("fr", param) == 0 || ostrcmp("fr=", param) == 0)
|
---|
1022 | writerc(getrcconfigint("rcfr", NULL));
|
---|
1023 |
|
---|
1024 | free(tmpbuf); tmpbuf = NULL;
|
---|
1025 | tmpbuf = ostrcat(param, NULL, 0, 0);
|
---|
1026 |
|
---|
1027 | if(ostrcmp("getlen", param) == 0 || ostrcmp("getlen=", param) == 0)
|
---|
1028 | {
|
---|
1029 | unsigned long len = 0;
|
---|
1030 | free(tmpbuf); tmpbuf = NULL;
|
---|
1031 |
|
---|
1032 | len = playergetlength();
|
---|
1033 | tmpbuf = ostrcat(buf, olutoa(len), 1, 1);
|
---|
1034 | }
|
---|
1035 |
|
---|
1036 | if(ostrcmp("getpos", param) == 0 || ostrcmp("getpos=", param) == 0)
|
---|
1037 | {
|
---|
1038 | unsigned long pos = 0;
|
---|
1039 | free(tmpbuf); tmpbuf = NULL;
|
---|
1040 |
|
---|
1041 | pos = playergetpts() / 90000;
|
---|
1042 | tmpbuf = ostrcat(buf, olutoa(pos), 1, 1);
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | if(ostrcmp("getisplaying", param) == 0 || ostrcmp("getisplaying=", param) == 0)
|
---|
1046 | {
|
---|
1047 | int playing = 0;
|
---|
1048 | free(tmpbuf); tmpbuf = NULL;
|
---|
1049 |
|
---|
1050 | playing = playerisplaying();
|
---|
1051 | tmpbuf = ostrcat(buf, oitoa(playing), 1, 1);
|
---|
1052 | }
|
---|
1053 |
|
---|
1054 | if(ostrcmp("getplayercan", param) == 0 || ostrcmp("getplayercan=", param) == 0)
|
---|
1055 | {
|
---|
1056 | free(tmpbuf); tmpbuf = NULL;
|
---|
1057 | tmpbuf = ostrcat(buf, olutoa(status.playercan), 1, 1);
|
---|
1058 | }
|
---|
1059 | }
|
---|
1060 |
|
---|
1061 | if(fmt == 0)
|
---|
1062 | {
|
---|
1063 | buf = webcreatehead(buf, NULL, 1);
|
---|
1064 | buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Video ", 1, 0);
|
---|
1065 | buf = ostrcat(buf, tmpbuf, 1, 1);
|
---|
1066 | buf = ostrcat(buf, " !!!</font></td></tr>", 1, 0);
|
---|
1067 | buf = webcreatetail(buf, 1);
|
---|
1068 | }
|
---|
1069 | else
|
---|
1070 | buf = ostrcat(buf, tmpbuf, 1, 1);
|
---|
1071 |
|
---|
1072 | return buf;
|
---|
1073 | }
|
---|
1074 |
|
---|
1075 | char* webgetchannelpage(char* param, int fmt)
|
---|
1076 | {
|
---|
1077 | char* param1 = NULL, *param2 = NULL;
|
---|
1078 |
|
---|
1079 | if(param == NULL) return NULL;
|
---|
1080 |
|
---|
1081 | //create param1 + 2
|
---|
1082 | param1 = strchr(param, '&');
|
---|
1083 | if(param1 != NULL)
|
---|
1084 | {
|
---|
1085 | *param1++ = '\0';
|
---|
1086 | param2 = strchr(param1, '&');
|
---|
1087 | if(param2 != NULL)
|
---|
1088 | *param2++ = '\0';
|
---|
1089 | }
|
---|
1090 |
|
---|
1091 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
1092 |
|
---|
1093 | return webgetchannel(atoi(param), atoi(param1), atoi(param2), fmt);
|
---|
1094 | }
|
---|
1095 |
|
---|
1096 | void webmessage(struct stimerthread* timernode, char* text, int flag)
|
---|
1097 | {
|
---|
1098 | textbox(_("Message"), text, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
|
---|
1099 | free(text);
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | char* websendmessage(char* param, int fmt)
|
---|
1103 | {
|
---|
1104 | char* text = NULL, *buf = NULL;
|
---|
1105 |
|
---|
1106 | if(param == NULL) return NULL;
|
---|
1107 | param = strchr(param, '=');
|
---|
1108 | if(param != NULL)
|
---|
1109 | {
|
---|
1110 | param++;
|
---|
1111 | stringreplacechar(param, '+', ' ');
|
---|
1112 | text = ostrcat(text, param, 1, 0);
|
---|
1113 | }
|
---|
1114 | addtimer(&webmessage, START, 1000, 1, (void*)text, NULL, NULL);
|
---|
1115 |
|
---|
1116 | if(fmt == 0)
|
---|
1117 | {
|
---|
1118 | buf = webcreatehead(buf, NULL, 1);
|
---|
1119 | buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Message Send !!!</font></td></tr>", 1, 0);
|
---|
1120 | buf = webcreatetail(buf, 1);
|
---|
1121 | }
|
---|
1122 | else
|
---|
1123 | buf = ostrcat(buf, "Message Send", 1, 0);
|
---|
1124 |
|
---|
1125 | return buf;
|
---|
1126 | }
|
---|
1127 |
|
---|
1128 | char* webgetsignal(int fmt)
|
---|
1129 | {
|
---|
1130 | char* buf = NULL, *tmpnr = NULL;
|
---|
1131 | uint16_t snr = 0, signal = 0;
|
---|
1132 | uint32_t ber = 0, unc = 0;
|
---|
1133 |
|
---|
1134 | ber = fereadber(status.aktservice->fedev);
|
---|
1135 | unc = fereaduncorrectedblocks(status.aktservice->fedev);
|
---|
1136 | signal = fereadsignalstrength(status.aktservice->fedev);
|
---|
1137 | snr = fereadsnr(status.aktservice->fedev);
|
---|
1138 | snr = (snr * 100) / 0xffff;
|
---|
1139 |
|
---|
1140 | if(fmt == 0)
|
---|
1141 | {
|
---|
1142 | buf = webcreatehead(buf, "<meta http-equiv=refresh content=1>", 0);
|
---|
1143 |
|
---|
1144 | buf = ostrcat(buf, "<tr><td align=center><font class=biglabel><br><br>BER: ", 1, 0);
|
---|
1145 | tmpnr = oitoa(ber);
|
---|
1146 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
1147 | free(tmpnr); tmpnr = NULL;
|
---|
1148 |
|
---|
1149 | buf = ostrcat(buf, "<br>UNC: ", 1, 0);
|
---|
1150 | tmpnr = oitoa(unc);
|
---|
1151 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
1152 | free(tmpnr); tmpnr = NULL;
|
---|
1153 |
|
---|
1154 | buf = ostrcat(buf, "<br>SIG: ", 1, 0);
|
---|
1155 | tmpnr = oitoa(signal);
|
---|
1156 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
1157 | free(tmpnr); tmpnr = NULL;
|
---|
1158 |
|
---|
1159 | buf = ostrcat(buf, "<br>SNR: ", 1, 0);
|
---|
1160 | tmpnr = oitoa(snr);
|
---|
1161 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
1162 | free(tmpnr); tmpnr = NULL;
|
---|
1163 |
|
---|
1164 | buf = ostrcat(buf, "</font></td></tr>", 1, 0);
|
---|
1165 | buf = webcreatetail(buf, 0);
|
---|
1166 | }
|
---|
1167 | else
|
---|
1168 | {
|
---|
1169 | buf = ostrcat(buf, oitoa(ber), 1, 1);
|
---|
1170 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1171 | buf = ostrcat(buf, oitoa(unc), 1, 1);
|
---|
1172 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1173 | buf = ostrcat(buf, oitoa(signal), 1, 1);
|
---|
1174 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1175 | buf = ostrcat(buf, oitoa(snr), 1, 1);
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 | return buf;
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | char* webgetepg(char* param, int fmt)
|
---|
1182 | {
|
---|
1183 | char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL;
|
---|
1184 | struct epg* epgnode = NULL;
|
---|
1185 | struct channel* chnode = NULL;
|
---|
1186 | struct tm *loctime = NULL;
|
---|
1187 |
|
---|
1188 | if(param == NULL) return NULL;
|
---|
1189 |
|
---|
1190 | //create param1 + 2
|
---|
1191 | param1 = strchr(param, '&');
|
---|
1192 | if(param1 != NULL)
|
---|
1193 | {
|
---|
1194 | *param1++ = '\0';
|
---|
1195 | param2 = strchr(param1, '&');
|
---|
1196 | if(param2 != NULL)
|
---|
1197 | *param2++ = '\0';
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
1201 |
|
---|
1202 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
1203 | if(chnode == NULL) return NULL;
|
---|
1204 |
|
---|
1205 | epgnode = getepg(chnode, atoi(param2), 0);
|
---|
1206 | if(epgnode == NULL) return NULL;
|
---|
1207 |
|
---|
1208 | if(fmt == 0) buf = webcreatehead(buf, NULL, 0);
|
---|
1209 |
|
---|
1210 | buf1 = malloc(MINMALLOC);
|
---|
1211 | if(buf1 == NULL)
|
---|
1212 | {
|
---|
1213 | err("no mem");
|
---|
1214 | return buf;
|
---|
1215 | }
|
---|
1216 |
|
---|
1217 | if(fmt == 0) buf = ostrcat(buf, "<tr><td><font class=biglabel>", 1, 0);
|
---|
1218 | if(epgnode->title != NULL)
|
---|
1219 | {
|
---|
1220 | buf = ostrcat(buf, epgnode->title, 1, 0);
|
---|
1221 | if(fmt == 0)
|
---|
1222 | {
|
---|
1223 | buf = ostrcat(buf, " (", 1, 0);
|
---|
1224 | loctime = olocaltime(&epgnode->starttime);
|
---|
1225 | if(loctime != NULL)
|
---|
1226 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
1227 | free(loctime); loctime = NULL;
|
---|
1228 | loctime = olocaltime(&epgnode->endtime);
|
---|
1229 | if(loctime != NULL)
|
---|
1230 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M", loctime);
|
---|
1231 | free(loctime); loctime = NULL;
|
---|
1232 | buf = ostrcat(buf, buf1, 1, 0);
|
---|
1233 | buf = ostrcat(buf, ")", 1, 0);
|
---|
1234 | }
|
---|
1235 | }
|
---|
1236 | if(fmt == 0)
|
---|
1237 | {
|
---|
1238 | buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
|
---|
1239 | buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
|
---|
1240 | }
|
---|
1241 | else
|
---|
1242 | {
|
---|
1243 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1244 | buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
|
---|
1245 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1246 | buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
|
---|
1247 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1248 | }
|
---|
1249 |
|
---|
1250 | if(epgnode->subtitle != NULL)
|
---|
1251 | buf = ostrcat(buf, epgnode->subtitle, 1, 0);
|
---|
1252 |
|
---|
1253 | if(fmt == 0)
|
---|
1254 | {
|
---|
1255 | buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
|
---|
1256 | buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
|
---|
1257 | }
|
---|
1258 | else
|
---|
1259 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1260 |
|
---|
1261 | tmpstr = epgdescunzip(epgnode);
|
---|
1262 | if(tmpstr != NULL)
|
---|
1263 | buf = ostrcat(buf, tmpstr, 1, 0);
|
---|
1264 | free(tmpstr); tmpstr = NULL;
|
---|
1265 |
|
---|
1266 | if(fmt == 0)
|
---|
1267 | {
|
---|
1268 | buf = ostrcat(buf, "</font></td></tr>", 1, 0);
|
---|
1269 | buf = webcreatetail(buf, 0);
|
---|
1270 | }
|
---|
1271 |
|
---|
1272 | free(buf1);
|
---|
1273 | return buf;
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | char* webgetsingleepg(char* param, int fmt)
|
---|
1277 | {
|
---|
1278 | int line = 0, maxlen = 0, pos = 0, longdesc = 1;
|
---|
1279 | char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL, *tmpstr = NULL;
|
---|
1280 | struct epg* epgnode = NULL;
|
---|
1281 | struct channel* chnode = NULL;
|
---|
1282 | struct tm *loctime = NULL;
|
---|
1283 |
|
---|
1284 | if(param == NULL) return NULL;
|
---|
1285 |
|
---|
1286 | //create param1 + 2
|
---|
1287 | param1 = strchr(param, '&');
|
---|
1288 | if(param1 != NULL)
|
---|
1289 | {
|
---|
1290 | *param1++ = '\0';
|
---|
1291 | param2 = strchr(param1, '&');
|
---|
1292 | if(param2 != NULL)
|
---|
1293 | *param2++ = '\0';
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | if(param1 == NULL) return NULL;
|
---|
1297 | if(param2 != NULL) longdesc = atoi(param2);
|
---|
1298 |
|
---|
1299 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
1300 | if(chnode == NULL) return NULL;
|
---|
1301 | epgnode = getepgakt(chnode);;
|
---|
1302 |
|
---|
1303 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
1304 |
|
---|
1305 | buf1 = malloc(MINMALLOC);
|
---|
1306 | if(buf1 == NULL)
|
---|
1307 | {
|
---|
1308 | err("no mem");
|
---|
1309 | return buf;
|
---|
1310 | }
|
---|
1311 |
|
---|
1312 | while(epgnode != NULL)
|
---|
1313 | {
|
---|
1314 | if(fmt == 0)
|
---|
1315 | {
|
---|
1316 | if(line == 0)
|
---|
1317 | {
|
---|
1318 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
1319 | line = 1;
|
---|
1320 | }
|
---|
1321 | else
|
---|
1322 | {
|
---|
1323 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
1324 | line = 0;
|
---|
1325 | }
|
---|
1326 |
|
---|
1327 | ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
|
---|
1328 | tmpstr = oitoa(chnode->serviceid);
|
---|
1329 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1330 | buf2 = ostrcat("<td nowrap><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
|
---|
1331 | buf2 = ostrcat(buf2, "&", 0, 0);
|
---|
1332 | free(tmpstr); tmpstr = NULL;
|
---|
1333 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1334 | tmpstr = ollutoa(chnode->transponderid);
|
---|
1335 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1336 | buf2 = ostrcat(buf2, tmpstr, 0, 0);
|
---|
1337 | buf2 = ostrcat(buf2, "&", 0, 0);
|
---|
1338 | free(tmpstr); tmpstr = NULL;
|
---|
1339 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1340 | tmpstr = oitoa(epgnode->eventid);
|
---|
1341 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1342 | buf2 = ostrcat(buf2, tmpstr, 0, 0);
|
---|
1343 | buf2 = ostrcat(buf2, ">", 0, 0);
|
---|
1344 | free(tmpstr); tmpstr = NULL;
|
---|
1345 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1346 |
|
---|
1347 | loctime = olocaltime(&epgnode->starttime);
|
---|
1348 | if(loctime != NULL)
|
---|
1349 | strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime);
|
---|
1350 | //strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
1351 | free(loctime); loctime = NULL;
|
---|
1352 | //loctime = olocaltime(&epgnode->endtime);
|
---|
1353 | //if(loctime != NULL)
|
---|
1354 | // strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
1355 | //free(loctime); loctime = NULL;
|
---|
1356 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
1357 | ostrcatbig(&buf, " ", &maxlen, &pos);
|
---|
1358 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1359 | if(epgnode->subtitle != NULL)
|
---|
1360 | {
|
---|
1361 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1362 | ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
|
---|
1363 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1364 | }
|
---|
1365 |
|
---|
1366 | ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
|
---|
1367 | ostrcatbig(&buf, buf2, &maxlen, &pos);
|
---|
1368 | ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
|
---|
1369 | ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
|
---|
1370 | }
|
---|
1371 | else
|
---|
1372 | {
|
---|
1373 | buf = ostrcat(buf, epgnode->title, 1, 0);
|
---|
1374 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1375 | buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
|
---|
1376 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1377 | buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
|
---|
1378 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1379 | buf = ostrcat(buf, epgnode->subtitle, 1, 0);
|
---|
1380 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1381 | if(longdesc == 1)
|
---|
1382 | {
|
---|
1383 | tmpstr = epgdescunzip(epgnode);
|
---|
1384 | if(tmpstr != NULL)
|
---|
1385 | buf = ostrcat(buf, tmpstr, 1, 0);
|
---|
1386 | free(tmpstr); tmpstr = NULL;
|
---|
1387 | }
|
---|
1388 | buf = ostrcat(buf, "#", 1, 0);
|
---|
1389 | buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
|
---|
1390 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
1391 | }
|
---|
1392 |
|
---|
1393 | epgnode = epgnode->next;
|
---|
1394 | free(buf2); buf2 = NULL;
|
---|
1395 | }
|
---|
1396 |
|
---|
1397 | if(fmt == 0)
|
---|
1398 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1399 | else if(buf == NULL)
|
---|
1400 | buf = ostrcat("no data", NULL, 0, 0);
|
---|
1401 |
|
---|
1402 | free(buf1);
|
---|
1403 | return buf;
|
---|
1404 | }
|
---|
1405 |
|
---|
1406 | //TODO: create rectimer line
|
---|
1407 | void webcalcrecline(char** buf, int* maxlen, int* pos)
|
---|
1408 | {
|
---|
1409 | //ostrcatbig(buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed\"><tr><td width=500 style=\"background-color: c0c0c0; height: 2; border-left: 2px solid #303030;\"></td></tr></table>", maxlen, pos);
|
---|
1410 | }
|
---|
1411 |
|
---|
1412 | char* webgetgmultiepg(char* param, int fmt)
|
---|
1413 | {
|
---|
1414 | int page = 1, i, line = 0, treffer = 0, maxlen = 0, pos = 0;
|
---|
1415 | char* buf = NULL, *tmpnr = NULL, *param1 = NULL;
|
---|
1416 | struct mainbouquet *mbouquet = NULL;
|
---|
1417 | struct bouquet *node = NULL;
|
---|
1418 | struct channel* chnode = NULL;
|
---|
1419 | struct epg* epgnode = NULL;
|
---|
1420 | time_t akttime = 0, difftime = 0, starttime = 0, endtime = 0, lastendtime = 0;
|
---|
1421 |
|
---|
1422 | if(param == NULL) return NULL;
|
---|
1423 |
|
---|
1424 | //create param1
|
---|
1425 | param1 = strchr(param, '&');
|
---|
1426 | if(param1 != NULL)
|
---|
1427 | *param1++ = '\0';
|
---|
1428 |
|
---|
1429 | if(param1 != NULL) page = atoi(param1);
|
---|
1430 |
|
---|
1431 | ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100% height=100%><tr><td height=100%><table cellpadding=0 cellspacing=0 border=0 id=gmultiepg class=scrolltable style=\"table-layout: fixed;\" cellpadding=0><thead><tr>", &maxlen, &pos);
|
---|
1432 |
|
---|
1433 | akttime = webcreatetimeline(&buf, &maxlen, &pos);
|
---|
1434 | akttime += ((page - 1) * 1440);
|
---|
1435 | ostrcatbig(&buf, "</tr></thead><tbody>", &maxlen, &pos);
|
---|
1436 |
|
---|
1437 | mbouquet = getmainbouquet(param);
|
---|
1438 | if(mbouquet != NULL)
|
---|
1439 | {
|
---|
1440 | node = mbouquet->bouquet;
|
---|
1441 | while(node != NULL)
|
---|
1442 | {
|
---|
1443 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
1444 | if(chnode != NULL)
|
---|
1445 | {
|
---|
1446 | if(line == 0)
|
---|
1447 | {
|
---|
1448 | ostrcatbig(&buf, "<tr><th class=gepgchannel1>", &maxlen, &pos);
|
---|
1449 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1450 | ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
|
---|
1451 | webcalcrecline(&buf, &maxlen, &pos);
|
---|
1452 | ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line1>", &maxlen, &pos);
|
---|
1453 | line = 1;
|
---|
1454 | }
|
---|
1455 | else
|
---|
1456 | {
|
---|
1457 | ostrcatbig(&buf, "<tr><th class=gepgchannel2>", &maxlen, &pos);
|
---|
1458 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1459 | ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
|
---|
1460 | webcalcrecline(&buf, &maxlen, &pos);
|
---|
1461 |
|
---|
1462 | ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line2>", &maxlen, &pos);
|
---|
1463 | line = 0;
|
---|
1464 | }
|
---|
1465 |
|
---|
1466 | treffer = 0;
|
---|
1467 | lastendtime = 0;
|
---|
1468 | epgnode = getepgakt(chnode);
|
---|
1469 | while(epgnode != NULL)
|
---|
1470 | {
|
---|
1471 | treffer = 1;
|
---|
1472 | starttime = epgnode->starttime / 60;
|
---|
1473 | endtime = epgnode->endtime / 60;
|
---|
1474 |
|
---|
1475 | if(endtime <= starttime || starttime >= akttime + 1440)
|
---|
1476 | {
|
---|
1477 | epgnode = epgnode->next;
|
---|
1478 | continue;
|
---|
1479 | }
|
---|
1480 |
|
---|
1481 | //check if old endtime > new starttime
|
---|
1482 | if(lastendtime > 0 && starttime > lastendtime)
|
---|
1483 | {
|
---|
1484 | difftime = (starttime - lastendtime) * 5;
|
---|
1485 |
|
---|
1486 | if(difftime <= 0)
|
---|
1487 | {
|
---|
1488 | epgnode = epgnode->next;
|
---|
1489 | continue;
|
---|
1490 | }
|
---|
1491 |
|
---|
1492 | ostrcatbig(&buf, "<td class=gepgcellblank style=\"", &maxlen, &pos);
|
---|
1493 | tmpnr = oitoa(difftime);
|
---|
1494 | ostrcatbig(&buf, "width:", &maxlen, &pos);
|
---|
1495 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1496 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1497 | ostrcatbig(&buf, "min-width:", &maxlen, &pos);
|
---|
1498 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1499 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1500 | ostrcatbig(&buf, "max-width:", &maxlen, &pos);
|
---|
1501 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1502 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1503 | free(tmpnr); tmpnr = NULL;
|
---|
1504 |
|
---|
1505 | ostrcatbig(&buf, "\"> </td>", &maxlen, &pos);
|
---|
1506 | }
|
---|
1507 |
|
---|
1508 | //check if starttime < last endtime
|
---|
1509 | if(starttime < lastendtime)
|
---|
1510 | starttime = lastendtime;
|
---|
1511 |
|
---|
1512 | //check if endtime is in next day
|
---|
1513 | if(endtime > akttime + 1440)
|
---|
1514 | endtime = endtime - (endtime - (akttime + 1440));
|
---|
1515 |
|
---|
1516 | //check if starttime is in prev day
|
---|
1517 | if(starttime < akttime)
|
---|
1518 | difftime = (endtime - akttime) * 5;
|
---|
1519 | else
|
---|
1520 | difftime = (endtime - starttime) * 5;
|
---|
1521 |
|
---|
1522 | if(difftime <= 0)
|
---|
1523 | {
|
---|
1524 | epgnode = epgnode->next;
|
---|
1525 | continue;
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | lastendtime = endtime;
|
---|
1529 |
|
---|
1530 | ostrcatbig(&buf, "<td class=gepgcell style=\"", &maxlen, &pos);
|
---|
1531 | tmpnr = oitoa(difftime);
|
---|
1532 | ostrcatbig(&buf, "width:", &maxlen, &pos);
|
---|
1533 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1534 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1535 | ostrcatbig(&buf, "min-width:", &maxlen, &pos);
|
---|
1536 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1537 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1538 | ostrcatbig(&buf, "max-width:", &maxlen, &pos);
|
---|
1539 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1540 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1541 | free(tmpnr); tmpnr = NULL;
|
---|
1542 |
|
---|
1543 | ostrcatbig(&buf, "\"><div class=gepgcellborder>", &maxlen, &pos);
|
---|
1544 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1545 | ostrcatbig(&buf, "</div></div></td>", &maxlen, &pos);
|
---|
1546 |
|
---|
1547 | epgnode = epgnode->next;
|
---|
1548 | }
|
---|
1549 | if(treffer == 0)
|
---|
1550 | ostrcatbig(&buf, "<td class=gepgcellblank> </td>", &maxlen, &pos);
|
---|
1551 | }
|
---|
1552 | ostrcatbig(&buf, "</tr></table></td></tr>", &maxlen, &pos);
|
---|
1553 |
|
---|
1554 | node = node->next;
|
---|
1555 | }
|
---|
1556 | }
|
---|
1557 | ostrcatbig(&buf, "<script type=text/javascript>if(typeof tableScroll == 'function'){tableScroll('gmultiepg');}</script></tbody></table></td></tr><tr><td align=center>", &maxlen, &pos);
|
---|
1558 |
|
---|
1559 | for(i = 1; i <= 14; i++)
|
---|
1560 | {
|
---|
1561 | if(page == i)
|
---|
1562 | ostrcatbig(&buf, "<a class=pagesellink href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
1563 | else
|
---|
1564 | ostrcatbig(&buf, "<a class=pagelink href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
1565 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1566 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1567 | tmpnr = oitoa(i);
|
---|
1568 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1569 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1570 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1571 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
1572 | free(tmpnr); tmpnr = NULL;
|
---|
1573 | }
|
---|
1574 |
|
---|
1575 | ostrcatbig(&buf, "</td></tr></table></center></body></html>", &maxlen, &pos);
|
---|
1576 | return buf;
|
---|
1577 | }
|
---|
1578 |
|
---|
1579 | char* webgetdrawcount(char* param, int fmt)
|
---|
1580 | {
|
---|
1581 | return oitoa(status.drawscreencount);
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 | void webgetshoot(char* param, int fmt)
|
---|
1585 | {
|
---|
1586 | char* cmd = NULL;
|
---|
1587 | /*
|
---|
1588 | char* cmd = NULL, *tmpstr = NULL;
|
---|
1589 |
|
---|
1590 | if(status.aktservice->channel != NULL)
|
---|
1591 | {
|
---|
1592 | m_lock(&status.waitrcmutex, 24);
|
---|
1593 | cmd = ostrcat(cmd, "grab.sh ", 1, 0);
|
---|
1594 | cmd = ostrcat(cmd, param, 1, 0);
|
---|
1595 | cmd = ostrcat(cmd, " ", 1, 0);
|
---|
1596 | cmd = ostrcat(cmd, getconfig("streamport", NULL), 1, 0);
|
---|
1597 | cmd = ostrcat(cmd, " ", 1, 0);
|
---|
1598 | tmpstr = oitoa(status.aktservice->channel->serviceid);
|
---|
1599 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1600 | free(tmpstr); tmpstr = NULL;
|
---|
1601 | cmd = ostrcat(cmd, ",", 1, 0);
|
---|
1602 | tmpstr = ollutoa(status.aktservice->channel->transponderid);
|
---|
1603 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1604 | free(tmpstr); tmpstr = NULL;
|
---|
1605 | cmd = ostrcat(cmd, " titan", 1, 0);
|
---|
1606 | cmd = ostrcat("/sbin/grab -o -j 40 -r 960", NULL, 1, 0);
|
---|
1607 |
|
---|
1608 | m_unlock(&status.waitrcmutex, 24);
|
---|
1609 | }
|
---|
1610 | */
|
---|
1611 | // use new grab osd + video
|
---|
1612 | cmd = ostrcat("/sbin/grab -j 100 -r 960", NULL, 0, 0);
|
---|
1613 |
|
---|
1614 | if(cmd != NULL)
|
---|
1615 | system(cmd);
|
---|
1616 | free(cmd);
|
---|
1617 | }
|
---|
1618 |
|
---|
1619 | char* webgetepgsearch(char* query, char* param, int fmt)
|
---|
1620 | {
|
---|
1621 | int line = 0, maxlen = 0, pos = 0, maxcount = 0, page = 1, newchannel = 0, longepg = 0;
|
---|
1622 | char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *tmpstr = NULL, *tmpnr = NULL, *param1 = NULL, *param2 = NULL;
|
---|
1623 | struct channel* chnode = channel;
|
---|
1624 | struct epg* epgnode = NULL;
|
---|
1625 | struct tm *loctime = NULL;
|
---|
1626 |
|
---|
1627 | if(query == NULL) return NULL;
|
---|
1628 |
|
---|
1629 | if(param == NULL)
|
---|
1630 | {
|
---|
1631 | query = strchr(query, '=');
|
---|
1632 | if(query != NULL)
|
---|
1633 | {
|
---|
1634 | query++;
|
---|
1635 | stringreplacechar(param, '+', ' ');
|
---|
1636 | param = query;
|
---|
1637 | }
|
---|
1638 | }
|
---|
1639 | else
|
---|
1640 | {
|
---|
1641 | //create param1 + 2
|
---|
1642 | param1 = strchr(param, '&');
|
---|
1643 | if(param1 != NULL)
|
---|
1644 | {
|
---|
1645 | *param1++ = '\0';
|
---|
1646 | param2 = strchr(param1, '&');
|
---|
1647 | if(param2 != NULL)
|
---|
1648 | *param2++ = '\0';
|
---|
1649 | }
|
---|
1650 | }
|
---|
1651 |
|
---|
1652 | if(param1 != NULL) page = atoi(param1);
|
---|
1653 | if(param2 != NULL) longepg = atoi(param2);
|
---|
1654 |
|
---|
1655 | buf1 = malloc(MINMALLOC);
|
---|
1656 | if(buf1 == NULL)
|
---|
1657 | {
|
---|
1658 | err("no mem");
|
---|
1659 | return buf;
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 | if(fmt == 0) webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
1663 | while(chnode != NULL)
|
---|
1664 | {
|
---|
1665 | newchannel = 1;
|
---|
1666 | epgnode = getepgakt(chnode);
|
---|
1667 | while(epgnode != NULL)
|
---|
1668 | {
|
---|
1669 | if(epgnode->title != NULL && ostrstrcase(epgnode->title, param) != NULL)
|
---|
1670 | {
|
---|
1671 |
|
---|
1672 | maxcount++;
|
---|
1673 |
|
---|
1674 | if(page >= 0)
|
---|
1675 | {
|
---|
1676 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
1677 | {
|
---|
1678 | epgnode = epgnode->next;
|
---|
1679 | continue;
|
---|
1680 | }
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | if(fmt == 0)
|
---|
1684 | {
|
---|
1685 | if(line == 0)
|
---|
1686 | {
|
---|
1687 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
1688 | line = 1;
|
---|
1689 | }
|
---|
1690 | else
|
---|
1691 | {
|
---|
1692 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
1693 | line = 0;
|
---|
1694 | }
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | if(fmt == 1 && newchannel == 1)
|
---|
1698 | {
|
---|
1699 | newchannel = 0;
|
---|
1700 | ostrcatbig(&buf, "BeginNewChannel", &maxlen, &pos);
|
---|
1701 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1702 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1703 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1704 | tmpstr = oitoa(chnode->serviceid);
|
---|
1705 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1706 | free(tmpstr); tmpstr = NULL;
|
---|
1707 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1708 | tmpstr = ollutoa(chnode->transponderid);
|
---|
1709 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1710 | free(tmpstr); tmpstr = NULL;
|
---|
1711 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1712 | tmpstr = oitoa(chnode->servicetype);
|
---|
1713 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1714 | free(tmpstr); tmpstr = NULL;
|
---|
1715 | ostrcatbig(&buf, "\n", &maxlen, &pos);
|
---|
1716 | }
|
---|
1717 |
|
---|
1718 | if(fmt == 0)
|
---|
1719 | {
|
---|
1720 | ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
|
---|
1721 | tmpstr = oitoa(chnode->serviceid);
|
---|
1722 | buf2 = ostrcat("<td nowrap><a target=main class=link href=query?addrectimer&", tmpstr, 0, 0);
|
---|
1723 | buf2 = ostrcat(buf2, "&", 0, 0);
|
---|
1724 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1725 | free(tmpstr); tmpstr = NULL;
|
---|
1726 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1727 | tmpstr = ollutoa(chnode->transponderid);
|
---|
1728 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1729 | buf2 = ostrcat(buf2, tmpstr, 0, 0);
|
---|
1730 | buf2 = ostrcat(buf2, "&", 0, 0);
|
---|
1731 | free(tmpstr); tmpstr = NULL;
|
---|
1732 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1733 | tmpstr = oitoa(epgnode->eventid);
|
---|
1734 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1735 | buf2 = ostrcat(buf2, tmpstr, 0, 0);
|
---|
1736 | buf2 = ostrcat(buf2, ">", 0, 0);
|
---|
1737 | free(tmpstr); tmpstr = NULL;
|
---|
1738 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1739 |
|
---|
1740 | loctime = olocaltime(&epgnode->starttime);
|
---|
1741 | if(loctime != NULL)
|
---|
1742 | strftime(buf1, MINMALLOC, "%d.%m _ %H:%M __ ", loctime);
|
---|
1743 | //strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
1744 | free(loctime); loctime = NULL;
|
---|
1745 | //loctime = olocaltime(&epgnode->endtime);
|
---|
1746 | //if(loctime != NULL)
|
---|
1747 | // strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
1748 | //free(loctime); loctime = NULL;
|
---|
1749 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
1750 | ostrcatbig(&buf, " ", &maxlen, &pos);
|
---|
1751 |
|
---|
1752 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1753 | if(chnode->name != NULL)
|
---|
1754 | {
|
---|
1755 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1756 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1757 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1758 | }
|
---|
1759 |
|
---|
1760 | ostrcatbig(&buf, "</a><br><font class=smalllabel1>", &maxlen, &pos);
|
---|
1761 | ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
|
---|
1762 |
|
---|
1763 | ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
|
---|
1764 | ostrcatbig(&buf, buf2, &maxlen, &pos);
|
---|
1765 | ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/timer.png alt=\"set timer\"/>", &maxlen, &pos);
|
---|
1766 | ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
|
---|
1767 | }
|
---|
1768 | else
|
---|
1769 | {
|
---|
1770 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1771 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1772 |
|
---|
1773 | tmpstr = olutoa(epgnode->starttime);
|
---|
1774 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1775 | free(tmpstr); tmpstr = NULL;
|
---|
1776 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1777 |
|
---|
1778 | tmpstr = olutoa(epgnode->endtime);
|
---|
1779 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1780 | free(tmpstr); tmpstr = NULL;
|
---|
1781 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1782 |
|
---|
1783 | ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
|
---|
1784 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1785 |
|
---|
1786 | if(longepg == 1)
|
---|
1787 | {
|
---|
1788 | tmpstr = epgdescunzip(epgnode);
|
---|
1789 | if(tmpstr != NULL)
|
---|
1790 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1791 | free(tmpstr); tmpstr = NULL;
|
---|
1792 | }
|
---|
1793 | ostrcatbig(&buf, "#", &maxlen, &pos);
|
---|
1794 |
|
---|
1795 | tmpstr = oitoa(epgnode->eventid);
|
---|
1796 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1797 | free(tmpstr); tmpstr = NULL;
|
---|
1798 | ostrcatbig(&buf, "\n", &maxlen, &pos);
|
---|
1799 | }
|
---|
1800 | }
|
---|
1801 | epgnode = epgnode->next;
|
---|
1802 | free(buf2); buf2 = NULL;
|
---|
1803 | }
|
---|
1804 | chnode = chnode->next;
|
---|
1805 | }
|
---|
1806 |
|
---|
1807 | if(maxcount > MAXHTMLLINE && fmt == 0)
|
---|
1808 | {
|
---|
1809 | int i;
|
---|
1810 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
1811 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
1812 | {
|
---|
1813 | if(page == i)
|
---|
1814 | ostrcatbig(&buf, "<a class=pagesellink href=query?getepgsearch&", &maxlen, &pos);
|
---|
1815 | else
|
---|
1816 | ostrcatbig(&buf, "<a class=pagelink href=query?getepgsearch&", &maxlen, &pos);
|
---|
1817 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1818 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1819 | free(tmpnr); tmpnr = NULL;
|
---|
1820 |
|
---|
1821 | tmpnr = oitoa(i);
|
---|
1822 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1823 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1824 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1825 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
1826 | free(tmpnr); tmpnr = NULL;
|
---|
1827 | }
|
---|
1828 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 | if(fmt == 0)
|
---|
1832 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1833 | else if(buf == NULL)
|
---|
1834 | buf = ostrcat("no data", NULL, 0, 0);
|
---|
1835 |
|
---|
1836 | free(buf1);
|
---|
1837 | return buf;
|
---|
1838 | }
|
---|
1839 |
|
---|
1840 | //flagbit 0: restrict to path
|
---|
1841 | //flagbit 1: show epg icon
|
---|
1842 | //flagbit 2: show delete icon
|
---|
1843 | //flagbit 3: show stream icon
|
---|
1844 | //flagbit 4: show websteam icon
|
---|
1845 | char* webgetfilelist(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
|
---|
1846 | {
|
---|
1847 | char* buf = NULL, *tmppath = NULL, *tmpnr = NULL, *param1 = NULL;
|
---|
1848 | int maxlen = 0, pos = 0, line = 0, maxcount = 0, page = 1;
|
---|
1849 | struct skin* webdir = getscreen("webdir");
|
---|
1850 | struct skin* filelist = getscreennode(webdir, "filelist");
|
---|
1851 | struct skin* filelistpath = getscreennode(webdir, "filelistpath");
|
---|
1852 | struct skin* node = NULL;
|
---|
1853 |
|
---|
1854 | if(param == NULL) param = path;
|
---|
1855 |
|
---|
1856 | //create param1
|
---|
1857 | param1 = strchr(param, '&');
|
---|
1858 | if(param1 != NULL)
|
---|
1859 | *param1++ = '\0';
|
---|
1860 |
|
---|
1861 | if(param1 != NULL) page = atoi(param1);
|
---|
1862 |
|
---|
1863 | if(strlen(param) == 0 || !isdir(param))
|
---|
1864 | tmppath = ostrcat(path, NULL, 0, 0);
|
---|
1865 | else
|
---|
1866 | tmppath = ostrcat(param, NULL, 0, 0);
|
---|
1867 |
|
---|
1868 | char* tmppath1 = createpath(tmppath, "");
|
---|
1869 | free(tmppath); tmppath = tmppath1;
|
---|
1870 |
|
---|
1871 | if(checkbit(flag, 0) == 1)
|
---|
1872 | {
|
---|
1873 | if(ostrstr(tmppath, path) != tmppath)
|
---|
1874 | {
|
---|
1875 | free(tmppath); tmppath = NULL;
|
---|
1876 | tmppath = ostrcat(path, NULL, 0, 0);
|
---|
1877 | }
|
---|
1878 | }
|
---|
1879 |
|
---|
1880 | changemask(filelist, mask);
|
---|
1881 | changeinput(filelist, tmppath);
|
---|
1882 | changetext(filelistpath, filelist->input);
|
---|
1883 |
|
---|
1884 | free(tmppath); tmppath = NULL;
|
---|
1885 |
|
---|
1886 | delmarkedscreennodes(webdir, FILELISTDELMARK);
|
---|
1887 | createfilelist(webdir, filelist, 0);
|
---|
1888 |
|
---|
1889 | if(fmt == 0) ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100%>", &maxlen, &pos);
|
---|
1890 |
|
---|
1891 | node = filelist;
|
---|
1892 | while(node != NULL)
|
---|
1893 | {
|
---|
1894 | if(node->del == FILELISTDELMARK)
|
---|
1895 | {
|
---|
1896 | maxcount++;
|
---|
1897 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
1898 | {
|
---|
1899 | node = node->next;
|
---|
1900 | continue;
|
---|
1901 | }
|
---|
1902 |
|
---|
1903 | if(fmt == 0)
|
---|
1904 | {
|
---|
1905 | if(line == 0)
|
---|
1906 | {
|
---|
1907 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
1908 | line = 1;
|
---|
1909 | }
|
---|
1910 | else
|
---|
1911 | {
|
---|
1912 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
1913 | line = 0;
|
---|
1914 | }
|
---|
1915 |
|
---|
1916 | ostrcatbig(&buf, "<td>", &maxlen, &pos);
|
---|
1917 | }
|
---|
1918 | if(node->input != NULL) //dir
|
---|
1919 | {
|
---|
1920 | if(fmt == 0)
|
---|
1921 | {
|
---|
1922 | ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/folder.png alt=Directory> <a class=link href=\"query?", &maxlen, &pos);
|
---|
1923 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
1924 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1925 | ostrcatbig(&buf, node->input, &maxlen, &pos);
|
---|
1926 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1927 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1928 | ostrcatbig(&buf, "</a><td> </td>", &maxlen, &pos);
|
---|
1929 | }
|
---|
1930 | else
|
---|
1931 | {
|
---|
1932 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1933 | ostrcatbig(&buf, "#0", &maxlen, &pos);
|
---|
1934 | ostrcatbig(&buf, "\n", &maxlen, &pos);
|
---|
1935 | }
|
---|
1936 | }
|
---|
1937 | else
|
---|
1938 | {
|
---|
1939 | if(fmt == 0)
|
---|
1940 | {
|
---|
1941 | ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
|
---|
1942 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1943 | ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
|
---|
1944 |
|
---|
1945 | ostrcatbig(&buf, "<td width=80 align=right>", &maxlen, &pos);
|
---|
1946 |
|
---|
1947 | //epg png
|
---|
1948 | if(checkbit(flag, 1) == 1)
|
---|
1949 | {
|
---|
1950 | ostrcatbig(&buf, "<a href=\"query?getmovieepg&", &maxlen, &pos);
|
---|
1951 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1952 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1953 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1954 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1955 | ostrcatbig(&buf, "<img border=0 src=img/movieepg.png width=16 height=16 alt=EPG></a>", &maxlen, &pos);
|
---|
1956 | }
|
---|
1957 | //delete png
|
---|
1958 | if(checkbit(flag, 2) == 1)
|
---|
1959 | {
|
---|
1960 | ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
|
---|
1961 | ostrcatbig(&buf, "query?", &maxlen, &pos);
|
---|
1962 | ostrcatbig(&buf, dellink, &maxlen, &pos);
|
---|
1963 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1964 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1965 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1966 | tmpnr = oitoa(page);
|
---|
1967 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1968 | free(tmpnr); tmpnr = NULL;
|
---|
1969 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1970 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1971 | ostrcatbig(&buf, "\");'>", &maxlen, &pos);
|
---|
1972 | }
|
---|
1973 | //stream png
|
---|
1974 | if(checkbit(flag, 3) == 1)
|
---|
1975 | {
|
---|
1976 | ostrcatbig(&buf, "<a target=nothing href=\"query?getm3u&0,0,", &maxlen, &pos);
|
---|
1977 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1978 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1979 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1980 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1981 |
|
---|
1982 | ostrcatbig(&buf, "<img border=0 src=img/stream.png width=16 height=16 alt=Stream></a>", &maxlen, &pos);
|
---|
1983 | }
|
---|
1984 | //webstream png
|
---|
1985 | if(checkbit(flag, 4) == 1)
|
---|
1986 | {
|
---|
1987 | ostrcatbig(&buf, "<a target=_blank href=\"query?getvideo&0,0,", &maxlen, &pos);
|
---|
1988 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1989 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1990 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1991 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1992 |
|
---|
1993 | ostrcatbig(&buf, "<img border=0 src=img/webstream.png width=16 height=16 alt=WebStream></a>", &maxlen, &pos);
|
---|
1994 |
|
---|
1995 | ostrcatbig(&buf, "<a target=_blank href=\"", &maxlen, &pos);
|
---|
1996 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1997 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1998 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1999 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2000 |
|
---|
2001 | ostrcatbig(&buf, "<img border=0 src=img/icon_restart.png width=16 height=16 alt=Download></a>", &maxlen, &pos);
|
---|
2002 | }
|
---|
2003 | }
|
---|
2004 | else
|
---|
2005 | {
|
---|
2006 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
2007 | ostrcatbig(&buf, "#1", &maxlen, &pos);
|
---|
2008 | ostrcatbig(&buf, "\n", &maxlen, &pos);
|
---|
2009 | }
|
---|
2010 | }
|
---|
2011 | if(fmt == 0)
|
---|
2012 | {
|
---|
2013 | ostrcatbig(&buf, "</td>", &maxlen, &pos);
|
---|
2014 | ostrcatbig(&buf, "</tr>", &maxlen, &pos);
|
---|
2015 | }
|
---|
2016 | }
|
---|
2017 |
|
---|
2018 | node = node->next;
|
---|
2019 | }
|
---|
2020 |
|
---|
2021 | if(maxcount > MAXHTMLLINE)
|
---|
2022 | {
|
---|
2023 | int i;
|
---|
2024 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
2025 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
2026 | {
|
---|
2027 | if(page == i)
|
---|
2028 | {
|
---|
2029 | ostrcatbig(&buf, "<a class=pagesellink href=query?", &maxlen, &pos);
|
---|
2030 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
2031 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2032 | }
|
---|
2033 | else
|
---|
2034 | {
|
---|
2035 | ostrcatbig(&buf, "<a class=pagelink href=query?", &maxlen, &pos);
|
---|
2036 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
2037 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2038 | }
|
---|
2039 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
2040 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2041 |
|
---|
2042 | tmpnr = oitoa(i);
|
---|
2043 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
2044 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
2045 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
2046 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
2047 | free(tmpnr); tmpnr = NULL;
|
---|
2048 | }
|
---|
2049 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
2050 | }
|
---|
2051 |
|
---|
2052 | if(fmt == 0) webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
2053 | delmarkedscreennodes(webdir, FILELISTDELMARK);
|
---|
2054 | return buf;
|
---|
2055 | }
|
---|
2056 |
|
---|
2057 | char* webgetmovieepg(char* param, char* path, int flag, int fmt)
|
---|
2058 | {
|
---|
2059 | char* buf = NULL, *tmpstr = NULL;
|
---|
2060 | char tstr[2];
|
---|
2061 | char c = 0;
|
---|
2062 | int first = 1, maxlen = 0, pos = 0;
|
---|
2063 | FILE* fd = NULL;
|
---|
2064 |
|
---|
2065 | if(fmt == 0)
|
---|
2066 | {
|
---|
2067 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
2068 | ostrcatbig(&buf, "<tr><td><font class=biglabel>", &maxlen, &pos);
|
---|
2069 | }
|
---|
2070 |
|
---|
2071 | if(flag == 1)
|
---|
2072 | {
|
---|
2073 | if(param != NULL && ostrstr(param, path) == param)
|
---|
2074 | {
|
---|
2075 | tmpstr = changefilenameext(param, ".epg");
|
---|
2076 | fd = fopen(tmpstr, "r");
|
---|
2077 | }
|
---|
2078 | }
|
---|
2079 | else
|
---|
2080 | {
|
---|
2081 | tmpstr = changefilenameext(param, ".epg");
|
---|
2082 | fd = fopen(tmpstr, "r");
|
---|
2083 | }
|
---|
2084 |
|
---|
2085 | if(fd != NULL)
|
---|
2086 | {
|
---|
2087 | while(c != EOF)
|
---|
2088 | {
|
---|
2089 | c = fgetc(fd);
|
---|
2090 | if(fmt == 0 && c == '\n')
|
---|
2091 | {
|
---|
2092 | if(first == 1)
|
---|
2093 | {
|
---|
2094 | ostrcatbig(&buf, "</font><br><font class=label>", &maxlen, &pos);
|
---|
2095 | first = 0;
|
---|
2096 | }
|
---|
2097 | ostrcatbig(&buf, "<br>", &maxlen, &pos);
|
---|
2098 | continue;
|
---|
2099 | }
|
---|
2100 | if(c != EOF)
|
---|
2101 | {
|
---|
2102 | sprintf(tstr, "%c", c);
|
---|
2103 | ostrcatbig(&buf, tstr, &maxlen, &pos);
|
---|
2104 | }
|
---|
2105 | }
|
---|
2106 | fclose(fd);
|
---|
2107 | }
|
---|
2108 |
|
---|
2109 | if(fmt == 0)
|
---|
2110 | {
|
---|
2111 | ostrcatbig(&buf, "</font></td></tr>", &maxlen, &pos);
|
---|
2112 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
2113 | }
|
---|
2114 |
|
---|
2115 | free(tmpstr); tmpstr = NULL;
|
---|
2116 | return buf;
|
---|
2117 | }
|
---|
2118 |
|
---|
2119 | char* webdelfile(char* param, char* link, char* dellink, char* path, char* mask, int flag, int fmt)
|
---|
2120 | {
|
---|
2121 | int del = 0;
|
---|
2122 | char* buf = NULL, *param1 = NULL, *param2 = NULL, *tmpparam = NULL;
|
---|
2123 |
|
---|
2124 | if(param == NULL) return NULL;
|
---|
2125 |
|
---|
2126 | //create param1 + 2
|
---|
2127 | param1 = strchr(param, '&');
|
---|
2128 | if(param1 != NULL)
|
---|
2129 | {
|
---|
2130 | *param1++ = '\0';
|
---|
2131 | param2 = strchr(param1, '&');
|
---|
2132 | if(param2 != NULL)
|
---|
2133 | *param2++ = '\0';
|
---|
2134 | }
|
---|
2135 |
|
---|
2136 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
2137 |
|
---|
2138 | tmpparam = createpath(param, param2);
|
---|
2139 |
|
---|
2140 | if(checkbit(flag, 0) == 1)
|
---|
2141 | {
|
---|
2142 | if(tmpparam != NULL && ostrstr(tmpparam, path) == tmpparam)
|
---|
2143 | del = 1;
|
---|
2144 | }
|
---|
2145 | else
|
---|
2146 | del = 1;
|
---|
2147 |
|
---|
2148 | if(del == 1)
|
---|
2149 | {
|
---|
2150 | char* epgfilename = NULL;
|
---|
2151 |
|
---|
2152 | unlink(tmpparam);
|
---|
2153 |
|
---|
2154 | if(cmpfilenameext(tmpparam, ".ts") == 0)
|
---|
2155 | {
|
---|
2156 | epgfilename = changefilenameext(tmpparam, ".epg");
|
---|
2157 | unlink(epgfilename);
|
---|
2158 | free(epgfilename); epgfilename = NULL;
|
---|
2159 | epgfilename = changefilenameext(tmpparam, ".se");
|
---|
2160 | unlink(epgfilename);
|
---|
2161 | free(epgfilename); epgfilename = NULL;
|
---|
2162 | epgfilename = changefilenameext(tmpparam, ".ma");
|
---|
2163 | unlink(epgfilename);
|
---|
2164 | free(epgfilename); epgfilename = NULL;
|
---|
2165 | }
|
---|
2166 | }
|
---|
2167 |
|
---|
2168 | free(tmpparam); tmpparam = NULL;
|
---|
2169 | tmpparam = ostrcat(tmpparam, param, 1, 0);
|
---|
2170 | tmpparam = ostrcat(tmpparam, "&", 1, 0);
|
---|
2171 | tmpparam = ostrcat(tmpparam, param1, 1, 0);
|
---|
2172 |
|
---|
2173 | buf = webgetfilelist(tmpparam, link, dellink, path, mask, flag, fmt);
|
---|
2174 | free(tmpparam); tmpparam = NULL;
|
---|
2175 | return buf;
|
---|
2176 | }
|
---|
2177 |
|
---|
2178 | char* websendrc(char* param, int fmt)
|
---|
2179 | {
|
---|
2180 | int rccode = 0;
|
---|
2181 | char* buf = NULL;
|
---|
2182 |
|
---|
2183 | rccode = getrcconfigint(param, NULL);
|
---|
2184 | writerc(rccode);
|
---|
2185 |
|
---|
2186 | buf = ostrcat("ok", NULL, 0, 0);
|
---|
2187 | return buf;
|
---|
2188 | }
|
---|
2189 |
|
---|
2190 | //flag 0: get aktiv timer
|
---|
2191 | //flag 1: get old timer
|
---|
2192 | char* webgetrectimer(char* param, int flag, int fmt)
|
---|
2193 | {
|
---|
2194 | char* buf = NULL, *buf1 = NULL;
|
---|
2195 | struct rectimer* node = rectimer;
|
---|
2196 | struct channel* chnode = NULL;
|
---|
2197 | int line = 0, maxlen = 0, pos = 0;
|
---|
2198 | struct tm *loctime = NULL;
|
---|
2199 |
|
---|
2200 | buf1 = malloc(MINMALLOC);
|
---|
2201 | if(buf1 == NULL)
|
---|
2202 | {
|
---|
2203 | err("no mem");
|
---|
2204 | return NULL;
|
---|
2205 | }
|
---|
2206 |
|
---|
2207 | if(fmt == 0) ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=stylesheet type=text/css href=titan.css><script type=text/javascript src=titan.js></script></head><body class=body><center><table width=100%>", &maxlen, &pos);
|
---|
2208 |
|
---|
2209 | while(node != NULL)
|
---|
2210 | {
|
---|
2211 | if((flag == 0 && (node->status == 2 || node->status == 3)) || (flag == 1 && (node->status == 0 || node->status == 1)) || node->status == 4 || node->status == 5)
|
---|
2212 | {
|
---|
2213 | node = node->next;
|
---|
2214 | continue;
|
---|
2215 | }
|
---|
2216 | if(fmt == 0)
|
---|
2217 | {
|
---|
2218 | if(line == 0)
|
---|
2219 | {
|
---|
2220 | ostrcatbig(&buf, "<tr class=line1><td>", &maxlen, &pos);
|
---|
2221 | line = 1;
|
---|
2222 | }
|
---|
2223 | else
|
---|
2224 | {
|
---|
2225 | ostrcatbig(&buf, "<tr class=line2><td>", &maxlen, &pos);
|
---|
2226 | line = 0;
|
---|
2227 | }
|
---|
2228 |
|
---|
2229 | loctime = olocaltime(&node->begin);
|
---|
2230 | if(loctime != NULL)
|
---|
2231 | strftime(buf1, MINMALLOC, "%d-%m-%Y %H:%M -", loctime);
|
---|
2232 | free(loctime); loctime = NULL;
|
---|
2233 | loctime = olocaltime(&node->end);
|
---|
2234 | if(loctime != NULL)
|
---|
2235 | strftime(&buf1[18], MINMALLOC - 19, " %H:%M ", loctime);
|
---|
2236 | free(loctime); loctime = NULL;
|
---|
2237 |
|
---|
2238 | ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
|
---|
2239 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2240 |
|
---|
2241 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
2242 | if(node->justplay == 0)
|
---|
2243 | ostrcatbig(&buf, "rec - ", &maxlen, &pos);
|
---|
2244 | else
|
---|
2245 | ostrcatbig(&buf, "switch - ", &maxlen, &pos);
|
---|
2246 | if(node->repeate == 0)
|
---|
2247 | ostrcatbig(&buf, "once", &maxlen, &pos);
|
---|
2248 | else
|
---|
2249 | ostrcatbig(&buf, "repeate", &maxlen, &pos);
|
---|
2250 |
|
---|
2251 | ostrcatbig(&buf, ")</font><br><font class=smalllabel1>", &maxlen, &pos);
|
---|
2252 | if(node->name == NULL || strlen(node->name) == 0)
|
---|
2253 | ostrcatbig(&buf, "---", &maxlen, &pos);
|
---|
2254 | else
|
---|
2255 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
2256 |
|
---|
2257 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
2258 | if(chnode != NULL)
|
---|
2259 | {
|
---|
2260 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
2261 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
2262 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
2263 | }
|
---|
2264 | ostrcatbig(&buf, "<br>", &maxlen, &pos);
|
---|
2265 |
|
---|
2266 | if(node->status == 0)
|
---|
2267 | ostrcatbig(&buf, "waiting", &maxlen, &pos);
|
---|
2268 | else if(node->status == 1)
|
---|
2269 | ostrcatbig(&buf, "running", &maxlen, &pos);
|
---|
2270 | else if(node->status == 2)
|
---|
2271 | ostrcatbig(&buf, "succes", &maxlen, &pos);
|
---|
2272 | else if(node->status == 3)
|
---|
2273 | {
|
---|
2274 | ostrcatbig(&buf, "error", &maxlen, &pos);
|
---|
2275 | if(node->errstr != NULL && strlen(node->errstr) > 0)
|
---|
2276 | {
|
---|
2277 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
2278 | ostrcatbig(&buf, node->errstr, &maxlen, &pos);
|
---|
2279 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
2280 | }
|
---|
2281 | }
|
---|
2282 |
|
---|
2283 | ostrcatbig(&buf, "</font>", &maxlen, &pos);
|
---|
2284 |
|
---|
2285 | if(flag == 0)
|
---|
2286 | {
|
---|
2287 | ostrcatbig(&buf, "</td><td width=40 align=right>", &maxlen, &pos);
|
---|
2288 |
|
---|
2289 | //edit png
|
---|
2290 | ostrcatbig(&buf, "<a target=main href=\"query?editrectimer", &maxlen, &pos);
|
---|
2291 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2292 | ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
|
---|
2293 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2294 |
|
---|
2295 | ostrcatbig(&buf, "<img border=0 src=img/edit.png width=16 height=16 alt=\"Edit Timer\"></a>", &maxlen, &pos);
|
---|
2296 |
|
---|
2297 | //delete png
|
---|
2298 | ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
|
---|
2299 | ostrcatbig(&buf, "query?delrectimer", &maxlen, &pos);
|
---|
2300 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2301 | ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
|
---|
2302 | //ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
2303 | //ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2304 | //tmpnr = oitoa(page);
|
---|
2305 | //ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
2306 | //free(tmpnr); tmpnr = NULL;
|
---|
2307 | //ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
2308 | //ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
2309 | ostrcatbig(&buf, "\");'>", &maxlen, &pos);
|
---|
2310 | }
|
---|
2311 |
|
---|
2312 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
2313 | }
|
---|
2314 | else
|
---|
2315 | {
|
---|
2316 | buf = ostrcat(buf, olutoa(node->begin), 1, 1);
|
---|
2317 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2318 | buf = ostrcat(buf, olutoa(node->end), 1, 1);
|
---|
2319 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2320 | buf = ostrcat(buf, oitoa(node->justplay), 1, 1);
|
---|
2321 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2322 | buf = ostrcat(buf, oitoa(node->repeate), 1, 1);
|
---|
2323 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2324 | buf = ostrcat(buf, node->name, 1, 0);
|
---|
2325 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2326 | buf = ostrcat(buf, oitoa(node->serviceid), 1, 1);
|
---|
2327 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2328 | buf = ostrcat(buf, ollutoa(node->transponderid), 1, 1);
|
---|
2329 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2330 | buf = ostrcat(buf, oitoa(node->status), 1, 1);
|
---|
2331 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2332 | buf = ostrcat(buf, node->errstr, 1, 0);
|
---|
2333 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2334 | buf = ostrcat(buf, node->timestamp, 1, 0);
|
---|
2335 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2336 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
2337 | if(chnode != NULL)
|
---|
2338 | buf = ostrcat(buf, chnode->name, 1, 0);
|
---|
2339 | buf = ostrcat(buf, "#", 1, 0);
|
---|
2340 | buf = ostrcat(buf, oitoa(node->afterevent), 1, 1);
|
---|
2341 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
2342 | }
|
---|
2343 |
|
---|
2344 | node = node->next;
|
---|
2345 | }
|
---|
2346 |
|
---|
2347 | if(fmt == 0)
|
---|
2348 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
2349 | else if(buf == NULL)
|
---|
2350 | buf = ostrcat("no data", NULL, 0, 0);
|
---|
2351 |
|
---|
2352 | free(buf1);
|
---|
2353 | return buf;
|
---|
2354 | }
|
---|
2355 |
|
---|
2356 | char* webaddrectimer(char* param, int fmt)
|
---|
2357 | {
|
---|
2358 | char* buf = NULL, *buf1 = NULL, *buf2 = NULL, *param1 = NULL, *param2 = NULL;
|
---|
2359 | struct channel* chnode = NULL;
|
---|
2360 | struct epg* epgnode = NULL;
|
---|
2361 | // int maxlen = 0, pos = 0, tmpservicetype = 0;
|
---|
2362 | int maxlen = 0, pos = 0;
|
---|
2363 | struct tm* loctime = NULL;
|
---|
2364 | time_t akttime = time(NULL);
|
---|
2365 |
|
---|
2366 | if(param != NULL)
|
---|
2367 | {
|
---|
2368 | //create param1 + 2
|
---|
2369 | param1 = strchr(param, '&');
|
---|
2370 | if(param1 != NULL)
|
---|
2371 | {
|
---|
2372 | *param1++ = '\0';
|
---|
2373 | param2 = strchr(param1, '&');
|
---|
2374 | if(param2 != NULL)
|
---|
2375 | *param2++ = '\0';
|
---|
2376 | }
|
---|
2377 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
2378 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
2379 | if(chnode == NULL) return NULL;
|
---|
2380 |
|
---|
2381 | epgnode = getepg(chnode, atoi(param2), 0);
|
---|
2382 | if(epgnode == NULL) return NULL;
|
---|
2383 | }
|
---|
2384 |
|
---|
2385 |
|
---|
2386 | ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
|
---|
2387 | ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
|
---|
2388 | ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
|
---|
2389 | if(chnode == NULL)
|
---|
2390 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimercheck&node\" value=\"", &maxlen, &pos);
|
---|
2391 | else
|
---|
2392 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
|
---|
2393 | ostrcatbig(&buf, "0", &maxlen, &pos);
|
---|
2394 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2395 | ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
|
---|
2396 | ostrcatbig(&buf, "<td><font class=label>Name: </font></td>", &maxlen, &pos);
|
---|
2397 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
|
---|
2398 | if(epgnode != NULL)
|
---|
2399 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
2400 | else
|
---|
2401 | ostrcatbig(&buf, " ", &maxlen, &pos);
|
---|
2402 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2403 | ostrcatbig(&buf, "<td><font class=label>Type: </font></td>", &maxlen, &pos);
|
---|
2404 | ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
|
---|
2405 | ostrcatbig(&buf, "record", &maxlen, &pos);
|
---|
2406 | ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
|
---|
2407 |
|
---|
2408 | buf2 = malloc(MINMALLOC);
|
---|
2409 | if(epgnode != NULL)
|
---|
2410 | loctime = olocaltime(&epgnode->starttime);
|
---|
2411 | else
|
---|
2412 | loctime = olocaltime(&akttime);
|
---|
2413 | if(loctime != NULL)
|
---|
2414 | strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
|
---|
2415 | free(loctime); loctime = NULL;
|
---|
2416 |
|
---|
2417 | buf1 = ostrcat(buf2, NULL, 0, 0);
|
---|
2418 | ostrcatbig(&buf, "<td><font class=label>Begin: </font></td>", &maxlen, &pos);
|
---|
2419 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
|
---|
2420 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2421 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2422 | free(buf1); buf1 = NULL;
|
---|
2423 |
|
---|
2424 | if(epgnode != NULL)
|
---|
2425 | loctime = olocaltime(&epgnode->endtime);
|
---|
2426 | else
|
---|
2427 | loctime = olocaltime(&akttime);
|
---|
2428 | if(loctime != NULL)
|
---|
2429 | strftime(buf2, MINMALLOC, "%H:%M %d-%m-%Y", loctime);
|
---|
2430 | free(loctime); loctime = NULL;
|
---|
2431 |
|
---|
2432 | buf1 = ostrcat(buf2, NULL, 0, 0);
|
---|
2433 | ostrcatbig(&buf, "<td><font class=label>End: </font></td>", &maxlen, &pos);
|
---|
2434 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
|
---|
2435 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2436 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2437 | free(buf1); buf1 = NULL;
|
---|
2438 | free(buf2); buf2 = NULL;
|
---|
2439 |
|
---|
2440 | ostrcatbig(&buf, "<td><font class=label>Channel: </font></td>", &maxlen, &pos);
|
---|
2441 | if(chnode == NULL)
|
---|
2442 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
|
---|
2443 | else
|
---|
2444 | {
|
---|
2445 | ostrcatbig(&buf, "<td>", &maxlen, &pos);
|
---|
2446 | ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"sid\" value=\"", &maxlen, &pos);
|
---|
2447 | buf1 = oitoa(chnode->serviceid);
|
---|
2448 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2449 | free(buf1); buf1 = NULL;
|
---|
2450 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2451 | ostrcatbig(&buf, "<input class=inputbox type=\"hidden\" name=\"tid\" value=\"", &maxlen, &pos);
|
---|
2452 | buf1 = ollutoa(chnode->transponderid);
|
---|
2453 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2454 | free(buf1); buf1 = NULL;
|
---|
2455 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2456 | ostrcatbig(&buf, "<input readonly class=inputbox type=\"text\" name=\"channel\" value=\"", &maxlen, &pos);
|
---|
2457 | }
|
---|
2458 | if(chnode != NULL)
|
---|
2459 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
2460 | else if(status.aktservice->channel != NULL)
|
---|
2461 | ostrcatbig(&buf, status.aktservice->channel->name, &maxlen, &pos);
|
---|
2462 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2463 | free(buf1); buf1 = NULL;
|
---|
2464 |
|
---|
2465 | ostrcatbig(&buf, "<td><font class=label>after event: </font></td>", &maxlen, &pos);
|
---|
2466 | ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
|
---|
2467 | ostrcatbig(&buf, "auto", &maxlen, &pos);
|
---|
2468 | ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
|
---|
2469 |
|
---|
2470 | ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input> <input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
|
---|
2471 |
|
---|
2472 | //ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
2473 | return buf;
|
---|
2474 | }
|
---|
2475 |
|
---|
2476 | char* webrectimercheck(char* param, int fmt)
|
---|
2477 | {
|
---|
2478 | char* buf = NULL, *buf1 = NULL, *string = NULL, *param1 = NULL, *name = NULL, *begin = NULL, *end = NULL, *type = NULL, *anode = NULL, *channelname = NULL, *ext = NULL, *afterevent = NULL, *repeat = NULL;
|
---|
2479 | int maxlen = 0, pos = 0, channelfind = 0;
|
---|
2480 | struct channel *channel1 = NULL;
|
---|
2481 |
|
---|
2482 | anode = ostrstr(param, "node=");
|
---|
2483 | if(anode != NULL)
|
---|
2484 | anode = anode + 5;
|
---|
2485 | name = ostrstr(param, "name=");
|
---|
2486 | if(name != NULL)
|
---|
2487 | name = name + 5;
|
---|
2488 | begin = ostrstr(param, "begin=");
|
---|
2489 | if(begin != NULL)
|
---|
2490 | begin = begin + 6;
|
---|
2491 | end = ostrstr(param, "end=");
|
---|
2492 | if(end != NULL)
|
---|
2493 | end = end + 4;
|
---|
2494 | type = ostrstr(param, "type=");
|
---|
2495 | if(type != NULL)
|
---|
2496 | type = type + 5;
|
---|
2497 | channelname = ostrstr(param, "channel=");
|
---|
2498 | if(channelname != NULL)
|
---|
2499 | channelname = channelname + 8;
|
---|
2500 | ext = ostrstr(param, "ext=");
|
---|
2501 | if(ext != NULL)
|
---|
2502 | ext = ext + 4;
|
---|
2503 | afterevent = ostrstr(param, "afterevent=");
|
---|
2504 | if(afterevent != NULL)
|
---|
2505 | afterevent = afterevent + 11;
|
---|
2506 | repeat = ostrstr(param, "repeat=");
|
---|
2507 | if(repeat != NULL)
|
---|
2508 | repeat = repeat + 7;
|
---|
2509 |
|
---|
2510 | param1 = ostrcat(param, NULL, 0, 0);
|
---|
2511 | string = param;
|
---|
2512 | while(string != NULL)
|
---|
2513 | {
|
---|
2514 | string = strchr(string, '&');
|
---|
2515 | if(string != NULL)
|
---|
2516 | *string++ = '\0';
|
---|
2517 | }
|
---|
2518 |
|
---|
2519 | ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
|
---|
2520 | ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
|
---|
2521 | ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
|
---|
2522 |
|
---|
2523 | if(anode != NULL)
|
---|
2524 | {
|
---|
2525 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
|
---|
2526 | ostrcatbig(&buf, anode, &maxlen, &pos);
|
---|
2527 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2528 | }
|
---|
2529 |
|
---|
2530 | if(name != NULL)
|
---|
2531 | {
|
---|
2532 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"name\" value=\"", &maxlen, &pos);
|
---|
2533 | ostrcatbig(&buf, name, &maxlen, &pos);
|
---|
2534 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2535 | }
|
---|
2536 |
|
---|
2537 | if(begin != NULL)
|
---|
2538 | {
|
---|
2539 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"begin\" value=\"", &maxlen, &pos);
|
---|
2540 | ostrcatbig(&buf, begin, &maxlen, &pos);
|
---|
2541 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2542 | }
|
---|
2543 |
|
---|
2544 | if(end != NULL)
|
---|
2545 | {
|
---|
2546 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"end\" value=\"", &maxlen, &pos);
|
---|
2547 | ostrcatbig(&buf, end, &maxlen, &pos);
|
---|
2548 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2549 | }
|
---|
2550 |
|
---|
2551 | if(type != NULL)
|
---|
2552 | {
|
---|
2553 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"type\" value=\"", &maxlen, &pos);
|
---|
2554 | ostrcatbig(&buf, type, &maxlen, &pos);
|
---|
2555 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2556 | }
|
---|
2557 |
|
---|
2558 | if(ext != NULL)
|
---|
2559 | {
|
---|
2560 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"ext\" value=\"", &maxlen, &pos);
|
---|
2561 | ostrcatbig(&buf, ext, &maxlen, &pos);
|
---|
2562 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2563 | }
|
---|
2564 |
|
---|
2565 | if(afterevent != NULL)
|
---|
2566 | {
|
---|
2567 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"afterevent\" value=\"", &maxlen, &pos);
|
---|
2568 | ostrcatbig(&buf, afterevent, &maxlen, &pos);
|
---|
2569 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2570 | }
|
---|
2571 |
|
---|
2572 | if(repeat != NULL)
|
---|
2573 | {
|
---|
2574 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"repeat\" value=\"", &maxlen, &pos);
|
---|
2575 | ostrcatbig(&buf, repeat, &maxlen, &pos);
|
---|
2576 | ostrcatbig(&buf, "\" />", &maxlen, &pos);
|
---|
2577 | }
|
---|
2578 |
|
---|
2579 | ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
|
---|
2580 | ostrcatbig(&buf, "<td><select name=sid size=10 border=0>", &maxlen, &pos);
|
---|
2581 |
|
---|
2582 | /*
|
---|
2583 | channel1 = channel;
|
---|
2584 | while(channel1 != NULL)
|
---|
2585 | {
|
---|
2586 | if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
|
---|
2587 | {
|
---|
2588 | if(channelfind == 0)
|
---|
2589 | ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
|
---|
2590 | else
|
---|
2591 | ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
|
---|
2592 |
|
---|
2593 | buf1 = oitoa(channel1->serviceid);
|
---|
2594 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2595 | free(buf1); buf1 = NULL;
|
---|
2596 | ostrcatbig(&buf, "&tid=", &maxlen, &pos);
|
---|
2597 | buf1 = ollutoa(channel1->transponderid);
|
---|
2598 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2599 | free(buf1); buf1 = NULL;
|
---|
2600 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2601 |
|
---|
2602 | ostrcatbig(&buf, channel1->name, &maxlen, &pos);
|
---|
2603 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
2604 |
|
---|
2605 | //get satname from channel
|
---|
2606 | if(channel1->transponder != NULL)
|
---|
2607 | {
|
---|
2608 | struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
|
---|
2609 | if(snode != NULL)
|
---|
2610 | ostrcatbig(&buf, snode->name, &maxlen, &pos);
|
---|
2611 | else
|
---|
2612 | ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
|
---|
2613 |
|
---|
2614 | if(channel1->provider != NULL)
|
---|
2615 | ostrcatbig(&buf, " - ", &maxlen, &pos);
|
---|
2616 | }
|
---|
2617 |
|
---|
2618 | //get provider from channel
|
---|
2619 | if(channel1->provider != NULL)
|
---|
2620 | {
|
---|
2621 | if(channel1->provider->name != NULL)
|
---|
2622 | ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
|
---|
2623 | else
|
---|
2624 | ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
|
---|
2625 | }
|
---|
2626 |
|
---|
2627 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
2628 |
|
---|
2629 | channelfind++;
|
---|
2630 | }
|
---|
2631 | channel1 = channel1->next;
|
---|
2632 | }
|
---|
2633 | */
|
---|
2634 |
|
---|
2635 | if(channelfind == 0)
|
---|
2636 | {
|
---|
2637 | channel1 = channel;
|
---|
2638 | while(channel1 != NULL)
|
---|
2639 | {
|
---|
2640 | if(ostrstrcase(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
|
---|
2641 | {
|
---|
2642 | if(channelfind == 0)
|
---|
2643 | ostrcatbig(&buf, "<option selected value=\"", &maxlen, &pos);
|
---|
2644 | else
|
---|
2645 | ostrcatbig(&buf, "<option value=\"", &maxlen, &pos);
|
---|
2646 |
|
---|
2647 | buf1 = oitoa(channel1->serviceid);
|
---|
2648 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2649 | free(buf1); buf1 = NULL;
|
---|
2650 | ostrcatbig(&buf, "&tid=", &maxlen, &pos);
|
---|
2651 | buf1 = ollutoa(channel1->transponderid);
|
---|
2652 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2653 | free(buf1); buf1 = NULL;
|
---|
2654 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2655 |
|
---|
2656 | ostrcatbig(&buf, channel1->name, &maxlen, &pos);
|
---|
2657 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
2658 |
|
---|
2659 | //get satname from channel
|
---|
2660 | if(channel1->transponder != NULL)
|
---|
2661 | {
|
---|
2662 | struct sat* snode = getsatbyorbitalpos(channel1->transponder->orbitalpos);
|
---|
2663 | if(snode != NULL)
|
---|
2664 | ostrcatbig(&buf, snode->name, &maxlen, &pos);
|
---|
2665 | else
|
---|
2666 | ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
|
---|
2667 |
|
---|
2668 | if(channel1->provider != NULL)
|
---|
2669 | ostrcatbig(&buf, " - ", &maxlen, &pos);
|
---|
2670 | }
|
---|
2671 |
|
---|
2672 | //get provider from channel
|
---|
2673 | if(channel1->provider != NULL)
|
---|
2674 | {
|
---|
2675 | if(channel1->provider->name != NULL)
|
---|
2676 | ostrcatbig(&buf, channel1->provider->name, &maxlen, &pos);
|
---|
2677 | else
|
---|
2678 | ostrcatbig(&buf, _("unknown"), &maxlen, &pos);
|
---|
2679 | }
|
---|
2680 |
|
---|
2681 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
2682 |
|
---|
2683 | channelfind++;
|
---|
2684 | }
|
---|
2685 | channel1 = channel1->next;
|
---|
2686 | }
|
---|
2687 | }
|
---|
2688 |
|
---|
2689 | ostrcatbig(&buf, "</td></tr></table><br><br></select><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input> <input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
|
---|
2690 |
|
---|
2691 | if(channelfind < 2)
|
---|
2692 | {
|
---|
2693 | free(buf); buf = NULL;
|
---|
2694 | buf = webrectimersend(param1, fmt);
|
---|
2695 | free(param1); param1 = NULL;
|
---|
2696 | }
|
---|
2697 |
|
---|
2698 | return buf;
|
---|
2699 | }
|
---|
2700 |
|
---|
2701 | char* webrectimersend(char* param, int fmt)
|
---|
2702 | {
|
---|
2703 | char* buf = NULL, *string = NULL, *name = NULL, *begin = NULL, *end = NULL, *type = NULL, *anode = NULL, *channelname = NULL, *sid = NULL, *tid = NULL, *ext = NULL, *afterevent = NULL, *repeat = NULL;
|
---|
2704 | int newnode = 0, channelfind = 0;
|
---|
2705 | struct rectimer *node = NULL;
|
---|
2706 | char* tmpstr = NULL;
|
---|
2707 | struct tm* loctime = NULL;
|
---|
2708 | struct channel *channel1 = NULL;
|
---|
2709 |
|
---|
2710 | anode = ostrstr(param, "node=");
|
---|
2711 | if(anode != NULL)
|
---|
2712 | anode = anode + 5;
|
---|
2713 | name = ostrstr(param, "name=");
|
---|
2714 | if(name != NULL)
|
---|
2715 | name = name + 5;
|
---|
2716 | begin = ostrstr(param, "begin=");
|
---|
2717 | if(begin != NULL)
|
---|
2718 | begin = begin + 6;
|
---|
2719 | end = ostrstr(param, "end=");
|
---|
2720 | if(end != NULL)
|
---|
2721 | end = end + 4;
|
---|
2722 | type = ostrstr(param, "type=");
|
---|
2723 | if(type != NULL)
|
---|
2724 | type = type + 5;
|
---|
2725 | channelname = ostrstr(param, "channel=");
|
---|
2726 | if(channelname != NULL)
|
---|
2727 | channelname = channelname + 8;
|
---|
2728 | sid = ostrstr(param, "sid=");
|
---|
2729 | if(sid != NULL)
|
---|
2730 | sid = sid + 4;
|
---|
2731 | tid = ostrstr(param, "tid=");
|
---|
2732 | if(tid != NULL)
|
---|
2733 | tid = tid + 4;
|
---|
2734 | ext = ostrstr(param, "ext=");
|
---|
2735 | if(ext != NULL)
|
---|
2736 | ext = ext + 4;
|
---|
2737 | afterevent = ostrstr(param, "afterevent=");
|
---|
2738 | if(afterevent != NULL)
|
---|
2739 | afterevent = afterevent + 11;
|
---|
2740 | repeat = ostrstr(param, "repeat=");
|
---|
2741 | if(repeat != NULL)
|
---|
2742 | repeat = repeat + 7;
|
---|
2743 |
|
---|
2744 | string = param;
|
---|
2745 | while(string != NULL)
|
---|
2746 | {
|
---|
2747 | string = strchr(string, '&');
|
---|
2748 | if(string != NULL)
|
---|
2749 | *string++ = '\0';
|
---|
2750 | }
|
---|
2751 |
|
---|
2752 | if((sid == NULL && tid != NULL) || (sid != NULL && tid == NULL))
|
---|
2753 | {
|
---|
2754 | buf = ostrcat(buf, "ERROR: sid and tid required or only channel", 1, 0);
|
---|
2755 | return buf;
|
---|
2756 | }
|
---|
2757 |
|
---|
2758 | if(channelname != NULL && sid == NULL)
|
---|
2759 | {
|
---|
2760 | channelfind = 0;
|
---|
2761 | channel1 = channel;
|
---|
2762 | while(channel1 != NULL)
|
---|
2763 | {
|
---|
2764 | if(ostrcmp(channel1->name, channelname) == 0 && (channel1->servicetype == 0 || channel1->servicetype == 1))
|
---|
2765 | {
|
---|
2766 | channelfind = 1;
|
---|
2767 | break;
|
---|
2768 | }
|
---|
2769 | channel1 = channel1->next;
|
---|
2770 | }
|
---|
2771 | if(channelfind == 0)
|
---|
2772 | {
|
---|
2773 | channel1 = channel;
|
---|
2774 | while(channel1 != NULL)
|
---|
2775 | {
|
---|
2776 | if(ostrstr(channel1->name, channelname) != NULL && (channel1->servicetype == 0 || channel1->servicetype == 1))
|
---|
2777 | {
|
---|
2778 | channelfind = 1;
|
---|
2779 | break;
|
---|
2780 | }
|
---|
2781 | channel1 = channel1->next;
|
---|
2782 | }
|
---|
2783 | }
|
---|
2784 | if(channelfind == 0)
|
---|
2785 | {
|
---|
2786 | buf = ostrcat(buf, "ERROR: channel not found", 1, 0);
|
---|
2787 | return buf;
|
---|
2788 | }
|
---|
2789 | }
|
---|
2790 |
|
---|
2791 | newnode = 0;
|
---|
2792 | node = getrectimerbytimestamp(anode);
|
---|
2793 | if(node == NULL)
|
---|
2794 | {
|
---|
2795 | node = addrectimernode(NULL, NULL);
|
---|
2796 | if(node != NULL)
|
---|
2797 | {
|
---|
2798 | newnode = 1;
|
---|
2799 | node->pincode = ostrcat("0000", NULL, 0, 0);
|
---|
2800 | node->recpath = ostrcat(NULL, getconfig("rec_path", NULL), 0, 0);
|
---|
2801 | node->afterevent = 0;
|
---|
2802 | node->repeate = 0;
|
---|
2803 | }
|
---|
2804 | }
|
---|
2805 |
|
---|
2806 | if(node != NULL)
|
---|
2807 | {
|
---|
2808 | if(channelfind == 1 && channel1 != NULL)
|
---|
2809 | {
|
---|
2810 | node->serviceid = channel1->serviceid;
|
---|
2811 | node->servicetype = channel1->servicetype;
|
---|
2812 | node->transponderid = channel1->transponderid;
|
---|
2813 | }
|
---|
2814 |
|
---|
2815 | if(sid != NULL && tid != NULL)
|
---|
2816 | {
|
---|
2817 | node->serviceid = atoi(sid);
|
---|
2818 | node->transponderid = strtoull(tid, NULL, 10);
|
---|
2819 | node->servicetype = 0;
|
---|
2820 | }
|
---|
2821 |
|
---|
2822 | free(node->name); node->name = NULL;
|
---|
2823 | node->name = ostrcat(name, NULL, 0, 0);
|
---|
2824 |
|
---|
2825 | if(ostrcmp(type, "record") == 0)
|
---|
2826 | node->justplay = 0;
|
---|
2827 | else
|
---|
2828 | node->justplay = 1;
|
---|
2829 |
|
---|
2830 | if(afterevent != NULL)
|
---|
2831 | {
|
---|
2832 | if(ostrcmp(afterevent, "auto") == 0)
|
---|
2833 | node->afterevent = 0;
|
---|
2834 | else if(ostrcmp(afterevent, "nothing") == 0)
|
---|
2835 | node->afterevent = 1;
|
---|
2836 | else if(ostrcmp(afterevent, "standby") == 0)
|
---|
2837 | node->afterevent = 2;
|
---|
2838 | else if(ostrcmp(afterevent, "off") == 0)
|
---|
2839 | node->afterevent = 3;
|
---|
2840 | }
|
---|
2841 |
|
---|
2842 | if(repeat != NULL)
|
---|
2843 | node->repeate = atoi(repeat);
|
---|
2844 |
|
---|
2845 | loctime = olocaltime(&node->begin);
|
---|
2846 | if(loctime != NULL && begin != NULL)
|
---|
2847 | {
|
---|
2848 | tmpstr = strptime(begin, "%H:%M %d-%m-%Y", loctime);
|
---|
2849 | if(tmpstr != NULL) {
|
---|
2850 | loctime->tm_isdst = -1;
|
---|
2851 | node->begin = mktime(loctime);
|
---|
2852 | }
|
---|
2853 | }
|
---|
2854 | if(node->justplay == 0 && newnode == 1) node->begin -= getconfigint("recforerun" , NULL) * 60;
|
---|
2855 | node->begin -= (node->begin % 60);
|
---|
2856 | tmpstr = NULL;
|
---|
2857 | free(loctime); loctime = NULL;
|
---|
2858 |
|
---|
2859 | loctime = olocaltime(&node->end);
|
---|
2860 | if(loctime != NULL && end != NULL)
|
---|
2861 | {
|
---|
2862 | tmpstr = strptime(end, "%H:%M %d-%m-%Y", loctime);
|
---|
2863 | if(tmpstr != NULL) {
|
---|
2864 | loctime->tm_isdst = -1;
|
---|
2865 | node->end = mktime(loctime);
|
---|
2866 | }
|
---|
2867 | }
|
---|
2868 | if(node->justplay == 0 && newnode == 1) node->end += getconfigint("recoverrun" , NULL) * 60;
|
---|
2869 | node->end -= (node->end % 60);
|
---|
2870 | tmpstr = NULL;
|
---|
2871 | free(loctime); loctime = NULL;
|
---|
2872 |
|
---|
2873 | if(newnode == 1)
|
---|
2874 | node->disabled = 0;
|
---|
2875 |
|
---|
2876 | status.writerectimer = 1;
|
---|
2877 | writerectimer(getconfig("rectimerfile", NULL), 0);
|
---|
2878 |
|
---|
2879 | if(ext == NULL)
|
---|
2880 | buf = webgetrectimer(NULL, 0, fmt);
|
---|
2881 | else
|
---|
2882 | {
|
---|
2883 | buf = ostrcat(buf, "ok -> TimerID=", 1, 0);
|
---|
2884 | buf = ostrcat(buf, node->timestamp, 1, 0);
|
---|
2885 | }
|
---|
2886 | }
|
---|
2887 | else
|
---|
2888 | buf = ostrcat(buf, "Timer not ok", 1, 0);
|
---|
2889 |
|
---|
2890 | return buf;
|
---|
2891 | }
|
---|
2892 |
|
---|
2893 | char* webeditrectimer(char* param, int fmt)
|
---|
2894 | {
|
---|
2895 | char* buf = NULL, *buf1 = NULL, *buf2 = NULL;
|
---|
2896 | int maxlen = 0, pos = 0;
|
---|
2897 | struct rectimer *node = NULL;
|
---|
2898 | struct tm* loctime = NULL;
|
---|
2899 |
|
---|
2900 | node = getrectimerbytimestamp(param);
|
---|
2901 | if(node == NULL) return NULL;
|
---|
2902 |
|
---|
2903 | ostrcatbig(&buf, "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><link rel=\"stylesheet\" type=\"text/css\" href=\"titan.css\"></head>", &maxlen, &pos);
|
---|
2904 | ostrcatbig(&buf, "<body class=body ><center>", &maxlen, &pos);
|
---|
2905 | ostrcatbig(&buf, "<form name=F1 action=query method=get><br><br>", &maxlen, &pos);
|
---|
2906 | ostrcatbig(&buf, "<input type=\"hidden\" name=\"rectimersend&node\" value=\"", &maxlen, &pos);
|
---|
2907 | ostrcatbig(&buf, node->timestamp, &maxlen, &pos);
|
---|
2908 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
2909 | ostrcatbig(&buf, "<table border=\"0\"><tr>", &maxlen, &pos);
|
---|
2910 | ostrcatbig(&buf, "<td><font class=label>Name: </font></td>", &maxlen, &pos);
|
---|
2911 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"name\" value=\"", &maxlen, &pos);
|
---|
2912 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
2913 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2914 |
|
---|
2915 | ostrcatbig(&buf, "<td><font class=label>Type: </font></td>", &maxlen, &pos);
|
---|
2916 | ostrcatbig(&buf, "<td><select name=\"type\" border=0><option selected>", &maxlen, &pos);
|
---|
2917 | if( node->justplay == 0 )
|
---|
2918 | ostrcatbig(&buf, "record", &maxlen, &pos);
|
---|
2919 | else
|
---|
2920 | ostrcatbig(&buf, "switch channel", &maxlen, &pos);
|
---|
2921 | ostrcatbig(&buf, "<option>record<option>switch channel</select></td></tr>", &maxlen, &pos);
|
---|
2922 |
|
---|
2923 | /*ostrcatbig(&buf, "<td><font class=label>Repeate: </font></td>", &maxlen, &pos);
|
---|
2924 | ostrcatbig(&buf, "<td><select name=\"repeate\" border=0><option selected>", &maxlen, &pos);
|
---|
2925 | if( node->repeate == 0 )
|
---|
2926 | ostrcatbig(&buf, "once", &maxlen, &pos);
|
---|
2927 | else
|
---|
2928 | ostrcatbig(&buf, "repeate", &maxlen, &pos);
|
---|
2929 | ostrcatbig(&buf, "<option>once<option>repeate</select></td></tr>", &maxlen, &pos);
|
---|
2930 | */
|
---|
2931 |
|
---|
2932 | /*ostrcatbig(&buf, "<td><font class=label>Repeate type: </font></td>", &maxlen, &pos);
|
---|
2933 | ostrcatbig(&buf, "<td><select name=\"repeatetype\" border=0><option selected>", &maxlen, &pos);
|
---|
2934 | if( node->repeate == 0 )
|
---|
2935 | ostrcatbig(&buf, "daily", &maxlen, &pos);
|
---|
2936 | else if( node->repeate == 1 )
|
---|
2937 | ostrcatbig(&buf, "weekly", &maxlen, &pos);
|
---|
2938 | else if( node->repeate == 2 )
|
---|
2939 | ostrcatbig(&buf, "workdays", &maxlen, &pos);
|
---|
2940 | else
|
---|
2941 | ostrcatbig(&buf, "user defined", &maxlen, &pos);
|
---|
2942 | ostrcatbig(&buf, "<option>daily<option>weekly<option>workdays<option>user defined</select></td></tr>", &maxlen, &pos);
|
---|
2943 | */
|
---|
2944 |
|
---|
2945 | buf2 = malloc(20);
|
---|
2946 | loctime = olocaltime(&node->begin);
|
---|
2947 | if(loctime != NULL && buf2 != NULL)
|
---|
2948 | strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
|
---|
2949 | free(loctime); loctime = NULL;
|
---|
2950 |
|
---|
2951 | buf1 = ostrcat(buf2, NULL, 0, 0);
|
---|
2952 | ostrcatbig(&buf, "<td><font class=label>Begin: </font></td>", &maxlen, &pos);
|
---|
2953 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"begin\" value=\"", &maxlen, &pos);
|
---|
2954 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2955 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2956 | free(buf1); buf1 = NULL;
|
---|
2957 |
|
---|
2958 | loctime = olocaltime(&node->end);
|
---|
2959 | if(loctime != NULL && buf2 != NULL)
|
---|
2960 | strftime(buf2, 20, "%H:%M %d-%m-%Y", loctime);
|
---|
2961 | free(loctime); loctime = NULL;
|
---|
2962 |
|
---|
2963 | buf1 = ostrcat(buf2, NULL, 0, 0);
|
---|
2964 | ostrcatbig(&buf, "<td><font class=label>End: </font></td>", &maxlen, &pos);
|
---|
2965 | ostrcatbig(&buf, "<td><input class=inputbox type=\"text\" name=\"end\" value=\"", &maxlen, &pos);
|
---|
2966 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
2967 | ostrcatbig(&buf, "\" /></td></tr>", &maxlen, &pos);
|
---|
2968 | free(buf1); buf1 = NULL;
|
---|
2969 | free(buf2); buf2 = NULL;
|
---|
2970 |
|
---|
2971 | ostrcatbig(&buf, "<td><font class=label>after event: </font></td>", &maxlen, &pos);
|
---|
2972 | ostrcatbig(&buf, "<td><select name=\"afterevent\" border=0><option selected>", &maxlen, &pos);
|
---|
2973 | if( node->afterevent == 0 )
|
---|
2974 | ostrcatbig(&buf, "auto", &maxlen, &pos);
|
---|
2975 | else if( node->afterevent == 1 )
|
---|
2976 | ostrcatbig(&buf, "nothing", &maxlen, &pos);
|
---|
2977 | else if( node->afterevent == 2 )
|
---|
2978 | ostrcatbig(&buf, "standby", &maxlen, &pos);
|
---|
2979 | else if( node->afterevent == 3 )
|
---|
2980 | ostrcatbig(&buf, "off", &maxlen, &pos);
|
---|
2981 | else
|
---|
2982 | ostrcatbig(&buf, "auto", &maxlen, &pos);
|
---|
2983 | ostrcatbig(&buf, "<option>auto<option>nothing<option>standby<option>off</select></td></tr>", &maxlen, &pos);
|
---|
2984 |
|
---|
2985 | ostrcatbig(&buf, "</table><br><br><input class=button type=submit name=send value=\"Send\" onClick=\"return checkdaytime(begin.value, end.value)\"></input> <input class=button type=reset name=reset value=\"Reset\"></input></form></center></body></html>", &maxlen, &pos);
|
---|
2986 |
|
---|
2987 | //ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
2988 | return buf;
|
---|
2989 | }
|
---|
2990 |
|
---|
2991 | char* webdelrectimer(char* param, int fmt)
|
---|
2992 | {
|
---|
2993 | char* buf = NULL, *string = NULL, *timerid = NULL;
|
---|
2994 | struct rectimer *node = NULL;
|
---|
2995 | int ext = 0;
|
---|
2996 |
|
---|
2997 | timerid = ostrstr(param, "timerid=");
|
---|
2998 | if(timerid != NULL)
|
---|
2999 | {
|
---|
3000 | timerid = timerid + 8;
|
---|
3001 | ext = 1;
|
---|
3002 | }
|
---|
3003 |
|
---|
3004 | node = NULL;
|
---|
3005 | if(ext == 1)
|
---|
3006 | {
|
---|
3007 | string = param;
|
---|
3008 | while(string != NULL)
|
---|
3009 | {
|
---|
3010 | string = strchr(string, '&');
|
---|
3011 | if(string != NULL)
|
---|
3012 | *string++ = '\0';
|
---|
3013 | }
|
---|
3014 | node = getrectimerbytimestamp(timerid);
|
---|
3015 | }
|
---|
3016 | else
|
---|
3017 | node = getrectimerbytimestamp(param);
|
---|
3018 |
|
---|
3019 | if(node == NULL)
|
---|
3020 | {
|
---|
3021 | buf = ostrcat(buf, "ERROR: timer not found", 1, 0);
|
---|
3022 | return buf;
|
---|
3023 | }
|
---|
3024 |
|
---|
3025 | delrectimer(node, 1, 0);
|
---|
3026 |
|
---|
3027 | if(ext == 1)
|
---|
3028 | buf = ostrcat(buf, "ok -> timer deleted", 1, 0);
|
---|
3029 | else
|
---|
3030 | buf = webgetrectimer(NULL, 0, fmt);
|
---|
3031 |
|
---|
3032 | return buf;
|
---|
3033 | }
|
---|
3034 |
|
---|
3035 | void putxmessage(struct stimerthread* timernode, char* captiontime, char* body)
|
---|
3036 | {
|
---|
3037 | struct splitstr* ret1 = NULL;
|
---|
3038 | char* caption = NULL;
|
---|
3039 | int count1 = 0;
|
---|
3040 | int timeout = 5;
|
---|
3041 |
|
---|
3042 | ret1 = strsplit(captiontime, "\t", &count1);
|
---|
3043 |
|
---|
3044 | if(count1 >= 2)
|
---|
3045 | {
|
---|
3046 | caption = ostrcat(caption, (&ret1[0])->part, 1, 0);
|
---|
3047 | if((&ret1[1])->part != NULL)
|
---|
3048 | timeout = atoi((&ret1[1])->part);
|
---|
3049 | textbox(caption, body, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 280, timeout, 0);
|
---|
3050 | }
|
---|
3051 |
|
---|
3052 | free(caption); free(body); free(captiontime); free(ret1);
|
---|
3053 | }
|
---|
3054 |
|
---|
3055 | void xmessage(char* filename)
|
---|
3056 | {
|
---|
3057 | char* param=NULL, *param1 = NULL, *param2 = NULL, *param3 = NULL, *param4 = NULL;
|
---|
3058 | char* caption=NULL, *body=NULL;
|
---|
3059 | char* timeout=NULL;
|
---|
3060 |
|
---|
3061 | param4 = ostrstr(filename, "icon=");
|
---|
3062 | param3 = ostrstr(filename, "charset=");
|
---|
3063 | param2 = ostrstr(filename, "timeout=");
|
---|
3064 | param1 = ostrstr(filename, "caption=");
|
---|
3065 | param = ostrstr(filename, "body=");
|
---|
3066 |
|
---|
3067 | if(param4 != NULL)
|
---|
3068 | {
|
---|
3069 | param4 = param4 - 1;
|
---|
3070 | *param4 = '\0';
|
---|
3071 | param4 = param4 + 5;
|
---|
3072 | *param4++ = '\0';
|
---|
3073 | }
|
---|
3074 | if(param3 != NULL)
|
---|
3075 | {
|
---|
3076 | param3 = param3 - 1;
|
---|
3077 | *param3 = '\0';
|
---|
3078 | param3 = param3 + 8;
|
---|
3079 | *param3++ = '\0';
|
---|
3080 | }
|
---|
3081 | if(param2 != NULL)
|
---|
3082 | {
|
---|
3083 | param2 = param2 - 1;
|
---|
3084 | *param2 = '\0';
|
---|
3085 | param2 = param2 + 8;
|
---|
3086 | *param2++ = '\0';
|
---|
3087 | }
|
---|
3088 | if(param1 != NULL)
|
---|
3089 | {
|
---|
3090 | param1 = param1 - 1;
|
---|
3091 | *param1 = '\0';
|
---|
3092 | param1 = param1 + 8;
|
---|
3093 | *param1++ = '\0';
|
---|
3094 | }
|
---|
3095 | if(param != NULL)
|
---|
3096 | {
|
---|
3097 | param = param - 1;
|
---|
3098 | *param = '\0';
|
---|
3099 | param = param + 5;
|
---|
3100 | *param++ = '\0';
|
---|
3101 | body = ostrcat(body, param, 1, 0);
|
---|
3102 | }
|
---|
3103 | else
|
---|
3104 | body = ostrcat(body, " ", 1, 0);
|
---|
3105 |
|
---|
3106 | if(param2 != NULL)
|
---|
3107 | timeout = ostrcat(timeout, param2, 1, 0);
|
---|
3108 | else
|
---|
3109 | timeout = ostrcat(timeout, "5", 1, 0);
|
---|
3110 |
|
---|
3111 | if(param1 != NULL)
|
---|
3112 | caption = ostrcat(caption, param1, 1, 0);
|
---|
3113 | else
|
---|
3114 | caption = ostrcat(caption, "XMESSAGE", 1, 0);
|
---|
3115 |
|
---|
3116 | caption = ostrcat(caption, "\t", 1, 0);
|
---|
3117 | caption = ostrcat(caption, timeout, 1, 1);
|
---|
3118 |
|
---|
3119 | addtimer(&putxmessage, START, 1000, 1, (void*)caption, (void*)body, NULL);
|
---|
3120 | return;
|
---|
3121 | }
|
---|
3122 |
|
---|
3123 | char* webgetvol(int fmt)
|
---|
3124 | {
|
---|
3125 | char* buf = NULL;
|
---|
3126 |
|
---|
3127 | buf = oitoa(getvol());
|
---|
3128 | return buf;
|
---|
3129 | }
|
---|
3130 |
|
---|
3131 | char* webgetmute(int fmt)
|
---|
3132 | {
|
---|
3133 | char* buf = NULL;
|
---|
3134 |
|
---|
3135 | buf = oitoa(status.mute);
|
---|
3136 | return buf;
|
---|
3137 | }
|
---|
3138 |
|
---|
3139 | char* webgetrccodes(int fmt)
|
---|
3140 | {
|
---|
3141 | int i = 0;
|
---|
3142 | char* buf = NULL;
|
---|
3143 | struct clist* node = NULL;
|
---|
3144 |
|
---|
3145 | m_lock(&status.clistmutex, 12);
|
---|
3146 | struct clist **clist = rcconfig;
|
---|
3147 |
|
---|
3148 | for(i = 0; i < LISTHASHSIZE; i++)
|
---|
3149 | {
|
---|
3150 | node = clist[i];
|
---|
3151 |
|
---|
3152 | while(node != NULL)
|
---|
3153 | {
|
---|
3154 | buf = ostrcat(buf, node->key, 1, 0);
|
---|
3155 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3156 | buf = ostrcat(buf, node->value, 1, 0);
|
---|
3157 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3158 | node = node->next;
|
---|
3159 | }
|
---|
3160 | }
|
---|
3161 |
|
---|
3162 | m_unlock(&status.clistmutex, 12);
|
---|
3163 | return buf;
|
---|
3164 | }
|
---|
3165 |
|
---|
3166 | char* webgetconfig(int fmt)
|
---|
3167 | {
|
---|
3168 | char* buf = NULL;
|
---|
3169 | struct clist *node = NULL;
|
---|
3170 | int i = 0;
|
---|
3171 |
|
---|
3172 | m_lock(&status.clistmutex, 12);
|
---|
3173 | struct clist **clist = config;
|
---|
3174 |
|
---|
3175 | for(i = 0; i < LISTHASHSIZE; i++)
|
---|
3176 | {
|
---|
3177 | node = clist[i];
|
---|
3178 |
|
---|
3179 | while(node != NULL)
|
---|
3180 | {
|
---|
3181 | if(node->tmp != NULL && strlen(node->tmp) > 0)
|
---|
3182 | {
|
---|
3183 | buf = ostrcat(buf, node->key, 1, 0);
|
---|
3184 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3185 | buf = ostrcat(buf, node->tmp, 1, 0);
|
---|
3186 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3187 | }
|
---|
3188 | else if(node->value != NULL)
|
---|
3189 | {
|
---|
3190 | buf = ostrcat(buf, node->key, 1, 0);
|
---|
3191 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3192 | buf = ostrcat(buf, node->value, 1, 0);
|
---|
3193 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3194 | }
|
---|
3195 | else
|
---|
3196 | {
|
---|
3197 | buf = ostrcat(buf, node->key, 1, 0);
|
---|
3198 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3199 | buf = ostrcat(buf, node->def, 1, 0);
|
---|
3200 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3201 | }
|
---|
3202 |
|
---|
3203 | node = node->next;
|
---|
3204 | }
|
---|
3205 | }
|
---|
3206 |
|
---|
3207 | m_unlock(&status.clistmutex, 12);
|
---|
3208 | return buf;
|
---|
3209 | }
|
---|
3210 |
|
---|
3211 | char* webgetsysteminfo(int fmt)
|
---|
3212 | {
|
---|
3213 | char* buf = NULL;
|
---|
3214 | char* imgversion = NULL;
|
---|
3215 |
|
---|
3216 | buf = ostrcat(buf, PROGNAME, 1, 0);
|
---|
3217 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3218 | buf = ostrcat(buf, COPYRIGHT, 1, 0);
|
---|
3219 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3220 | buf = ostrcat(buf, OVERSION, 1, 0);
|
---|
3221 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3222 |
|
---|
3223 | if(isfile(getconfig("imagenamefile", NULL)) != 0)
|
---|
3224 | imgversion = readsys(getconfig("imagenamefile", NULL), 1);
|
---|
3225 | else
|
---|
3226 | imgversion = ostrcat("unknown", NULL, 0, 0);
|
---|
3227 |
|
---|
3228 | buf = ostrcat(buf, imgversion, 1, 1);
|
---|
3229 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3230 | buf = ostrcat(buf, getboxtype(), 1, 0);
|
---|
3231 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3232 | buf = ostrcat(buf, ollutoa(time(NULL)), 1, 1);
|
---|
3233 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3234 |
|
---|
3235 | if(status.standby == 0)
|
---|
3236 | buf = ostrcat(buf, "0", 1, 0);
|
---|
3237 | else
|
---|
3238 | buf = ostrcat(buf, "1", 1, 0);
|
---|
3239 |
|
---|
3240 | return buf;
|
---|
3241 | }
|
---|
3242 |
|
---|
3243 | char* webgetchannellock(char* param, int fmt)
|
---|
3244 | {
|
---|
3245 | char* buf = NULL, *param1 = NULL;
|
---|
3246 | struct channel* chnode = NULL;
|
---|
3247 |
|
---|
3248 | if(param == NULL) return NULL;
|
---|
3249 |
|
---|
3250 | //create param1
|
---|
3251 | param1 = strchr(param, '&');
|
---|
3252 | if(param1 != NULL)
|
---|
3253 | *param1++ = '\0';
|
---|
3254 |
|
---|
3255 | if(param1 == NULL) return NULL;
|
---|
3256 |
|
---|
3257 | chnode = getchannel(atoi(param), strtoull(param1, NULL, 10));
|
---|
3258 | if(chnode != NULL)
|
---|
3259 | {
|
---|
3260 | buf = ostrcat(buf, chnode->name, 1, 0);
|
---|
3261 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3262 | buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
|
---|
3263 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3264 | buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
|
---|
3265 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3266 |
|
---|
3267 | if(channelnottunable(chnode) == 1)
|
---|
3268 | buf = ostrcat(buf, "1", 1, 0);
|
---|
3269 | else
|
---|
3270 | buf = ostrcat(buf, "0", 1, 0);
|
---|
3271 | }
|
---|
3272 | else
|
---|
3273 | buf = ostrcat("no data", NULL, 0, 0);
|
---|
3274 |
|
---|
3275 | return buf;
|
---|
3276 | }
|
---|
3277 |
|
---|
3278 | char* webgetbouquetepg(char* param, int fmt)
|
---|
3279 | {
|
---|
3280 | char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
|
---|
3281 | char* param1 = NULL, *param2 = NULL, *param3 = NULL;
|
---|
3282 | struct mainbouquet *mbouquet = NULL;
|
---|
3283 | struct bouquet *node = NULL;
|
---|
3284 | struct channel* chnode = NULL;
|
---|
3285 | struct epg* epgnode = NULL;
|
---|
3286 | int longepg = 0;
|
---|
3287 | time_t start = 0, end = 0;
|
---|
3288 |
|
---|
3289 | if(param == NULL) return NULL;
|
---|
3290 |
|
---|
3291 | //create param1 + 2 + 3
|
---|
3292 | param1 = strchr(param, '&');
|
---|
3293 | if(param1 != NULL)
|
---|
3294 | {
|
---|
3295 | *param1++ = '\0';
|
---|
3296 | param2 = strchr(param1, '&');
|
---|
3297 | if(param2 != NULL)
|
---|
3298 | {
|
---|
3299 | *param2++ = '\0';
|
---|
3300 | param3 = strchr(param2, '&');
|
---|
3301 | if(param3 != NULL)
|
---|
3302 | *param3++ = '\0';
|
---|
3303 | }
|
---|
3304 | }
|
---|
3305 | if(param1 == NULL || param2 == NULL || param3 == NULL) return NULL;
|
---|
3306 |
|
---|
3307 | longepg = atoi(param1);
|
---|
3308 | start = atoi(param2);
|
---|
3309 | end = atoi(param3);
|
---|
3310 |
|
---|
3311 | mbouquet = getmainbouquet(param);
|
---|
3312 | if(mbouquet != NULL)
|
---|
3313 | {
|
---|
3314 | node = mbouquet->bouquet;
|
---|
3315 | tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
|
---|
3316 | tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
|
---|
3317 | tmpstr1 = htmlencode(tmpstr);
|
---|
3318 | free(tmpstr); tmpstr = NULL;
|
---|
3319 | while(node != NULL)
|
---|
3320 | {
|
---|
3321 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
3322 | if(chnode != NULL)
|
---|
3323 | {
|
---|
3324 | buf = ostrcat(buf, "BeginNewChannel", 1, 0);
|
---|
3325 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3326 | buf = ostrcat(buf, chnode->name, 1, 0);
|
---|
3327 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3328 | buf = ostrcat(buf, oitoa(chnode->serviceid), 1, 1);
|
---|
3329 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3330 | buf = ostrcat(buf, ollutoa(chnode->transponderid), 1, 1);
|
---|
3331 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3332 | buf = ostrcat(buf, oitoa(chnode->servicetype), 1, 1);
|
---|
3333 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3334 |
|
---|
3335 | epgnode = chnode->epg;
|
---|
3336 | while(epgnode != NULL)
|
---|
3337 | {
|
---|
3338 | if((epgnode->starttime >= start && epgnode->starttime < end) || (epgnode->endtime > start && epgnode->endtime <= end) || (epgnode->starttime < start && epgnode->endtime > end))
|
---|
3339 | {
|
---|
3340 | buf = ostrcat(buf, epgnode->title, 1, 0);
|
---|
3341 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3342 | buf = ostrcat(buf, olutoa(epgnode->starttime), 1, 1);
|
---|
3343 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3344 | buf = ostrcat(buf, olutoa(epgnode->endtime), 1, 1);
|
---|
3345 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3346 | buf = ostrcat(buf, epgnode->subtitle, 1, 0);
|
---|
3347 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3348 |
|
---|
3349 | if(longepg == 1)
|
---|
3350 | {
|
---|
3351 | tmpstr = epgdescunzip(epgnode);
|
---|
3352 | if(tmpstr != NULL)
|
---|
3353 | buf = ostrcat(buf, tmpstr, 1, 0);
|
---|
3354 | free(tmpstr); tmpstr = NULL;
|
---|
3355 | }
|
---|
3356 |
|
---|
3357 | buf = ostrcat(buf, "#", 1, 0);
|
---|
3358 | buf = ostrcat(buf, oitoa(epgnode->eventid), 1, 1);
|
---|
3359 | buf = ostrcat(buf, "\n", 1, 0);
|
---|
3360 | }
|
---|
3361 |
|
---|
3362 | epgnode = epgnode->next;
|
---|
3363 | }
|
---|
3364 | }
|
---|
3365 | node = node->next;
|
---|
3366 | }
|
---|
3367 | free(tmpstr1); tmpstr1 = NULL;
|
---|
3368 | }
|
---|
3369 |
|
---|
3370 | if(buf == NULL)
|
---|
3371 | buf = ostrcat("no data", NULL, 0, 0);
|
---|
3372 | return buf;
|
---|
3373 | }
|
---|
3374 |
|
---|
3375 | #endif
|
---|