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)
|
---|
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(line == 0)
|
---|
108 | ostrcatbig(buf, "<tr class=line1>", maxlen, pos);
|
---|
109 | else
|
---|
110 | ostrcatbig(buf, "<tr class=line2>", maxlen, pos);
|
---|
111 |
|
---|
112 |
|
---|
113 | if(epgnode != NULL)
|
---|
114 | {
|
---|
115 | proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime);
|
---|
116 | if(proz > 100) proz = 100;
|
---|
117 | if(proz < 0) proz = 0;
|
---|
118 | }
|
---|
119 |
|
---|
120 | ostrcatbig(buf, "<td width=100% valign=middle nowrap class=link><div class=timelineborder><div class=timelinebar style=\"width: ", maxlen, pos);
|
---|
121 | tmpstr = oitoa(proz);
|
---|
122 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
123 | free(tmpstr); tmpstr = NULL;
|
---|
124 | ostrcatbig(buf, "%;\"> </div></div>", maxlen, pos);
|
---|
125 |
|
---|
126 | serviceid = oitoa(chnode->serviceid);
|
---|
127 | transponderid = oitoa(chnode->transponderid);
|
---|
128 |
|
---|
129 | if(ret == 0)
|
---|
130 | {
|
---|
131 | ostrcatbig(buf, "<a target=aktservice class=link href=query?switch&", maxlen, pos);
|
---|
132 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
133 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
134 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
135 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
136 | ostrcatbig(buf, channellist, maxlen, pos);
|
---|
137 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
138 | }
|
---|
139 |
|
---|
140 | ostrcatbig(buf, chnode->name, maxlen, pos);
|
---|
141 | if(ret == 0) ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
142 |
|
---|
143 | //akt epg
|
---|
144 | if(epgnode != NULL)
|
---|
145 | {
|
---|
146 | if(flag == 0)
|
---|
147 | ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
148 | else
|
---|
149 | ostrcatbig(buf, " <a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
150 |
|
---|
151 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
152 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
153 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
154 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
155 | tmpstr = oitoa(epgnode->eventid);
|
---|
156 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
157 | free(tmpstr); tmpstr = NULL;
|
---|
158 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
159 |
|
---|
160 | loctime = olocaltime(&epgnode->starttime);
|
---|
161 | if(loctime != NULL)
|
---|
162 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
163 | free(loctime); loctime = NULL;
|
---|
164 | loctime = olocaltime(&epgnode->endtime);
|
---|
165 | if(loctime != NULL)
|
---|
166 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
167 | free(loctime); loctime = NULL;
|
---|
168 |
|
---|
169 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
170 | ostrcatbig(buf, epgnode->title, maxlen, pos);
|
---|
171 |
|
---|
172 | max = (epgnode->endtime - epgnode->starttime) / 60;
|
---|
173 | akt = (epgnode->endtime - (time(NULL) - 60)) / 60;
|
---|
174 | if(max < 0) max = 0;
|
---|
175 | if(akt < 0) akt = 0;
|
---|
176 | snprintf(buf1, MINMALLOC, " (%ld from %ld min, %d%%)", akt, max, proz);
|
---|
177 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
178 |
|
---|
179 | ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
180 |
|
---|
181 | //next epg
|
---|
182 | epgnode = epgnode->next;
|
---|
183 | if(flag == 0 && epgnode != NULL)
|
---|
184 | {
|
---|
185 | ostrcatbig(buf, "<br><a target=main class=smalllink href=query?getepg&", maxlen, pos);
|
---|
186 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
187 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
188 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
189 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
190 | tmpstr = oitoa(epgnode->eventid);
|
---|
191 | ostrcatbig(buf, tmpstr, maxlen, pos);
|
---|
192 | free(tmpstr); tmpstr = NULL;
|
---|
193 | ostrcatbig(buf, ">", maxlen, pos);
|
---|
194 |
|
---|
195 | loctime = olocaltime(&epgnode->starttime);
|
---|
196 | if(loctime != NULL)
|
---|
197 | strftime(buf1, 8, "%H:%M -", loctime);
|
---|
198 | free(loctime); loctime = NULL;
|
---|
199 | loctime = olocaltime(&epgnode->endtime);
|
---|
200 | if(loctime != NULL)
|
---|
201 | strftime(&buf1[7], 8, " %H:%M ", loctime);
|
---|
202 | free(loctime); loctime = NULL;
|
---|
203 |
|
---|
204 | ostrcatbig(buf, buf1, maxlen, pos);
|
---|
205 | ostrcatbig(buf, epgnode->title, maxlen, pos);
|
---|
206 | ostrcatbig(buf, "</a>", maxlen, pos);
|
---|
207 | }
|
---|
208 | }
|
---|
209 |
|
---|
210 | //tv - radio
|
---|
211 | if(chnode->servicetype == 0)
|
---|
212 | 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);
|
---|
213 | else
|
---|
214 | 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);
|
---|
215 |
|
---|
216 | //single epg
|
---|
217 | ostrcatbig(buf, "<a target=main href=query?getsingleepg&", maxlen, pos);
|
---|
218 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
219 | ostrcatbig(buf, "&", maxlen, pos);
|
---|
220 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
221 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/singleepg.png alt=\"Single EPG\" width=16 height=16></a>", maxlen, pos);
|
---|
222 |
|
---|
223 | //m3u stream + webstream
|
---|
224 | if(ret == 0)
|
---|
225 | {
|
---|
226 | ostrcatbig(buf, "<a target=nothing href=query?getm3u&", maxlen, pos);
|
---|
227 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
228 | ostrcatbig(buf, ",", maxlen, pos);
|
---|
229 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
230 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/stream.png alt=Stream width=16 height=16></a>", maxlen, pos);
|
---|
231 |
|
---|
232 | ostrcatbig(buf, "<a target=_blank href=query?getvideo&", maxlen, pos);
|
---|
233 | ostrcatbig(buf, serviceid, maxlen, pos);
|
---|
234 | ostrcatbig(buf, ",", maxlen, pos);
|
---|
235 | ostrcatbig(buf, transponderid, maxlen, pos);
|
---|
236 | ostrcatbig(buf, "><img style=\"margin-left: 5\" border=0 src=img/webstream.png alt=WebStream width=16 height=16></a>", maxlen, pos);
|
---|
237 | }
|
---|
238 | else
|
---|
239 | ostrcatbig(buf, "<img style=\"margin-left: 5\" border=0 src=img/cross.png alt=\"Channel not availabel\" width=16 height=16>", maxlen, pos);
|
---|
240 | ostrcatbig(buf, "</td></tr>", maxlen, pos);
|
---|
241 |
|
---|
242 | free(buf1);
|
---|
243 | free(serviceid);
|
---|
244 | free(transponderid);
|
---|
245 | }
|
---|
246 |
|
---|
247 | char* webgetbouquetchannel(char* param)
|
---|
248 | {
|
---|
249 | char* buf = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
|
---|
250 | struct mainbouquet *mbouquet = NULL;
|
---|
251 | struct bouquet *node = NULL;
|
---|
252 | struct channel* chnode = NULL;
|
---|
253 | int line = 0, maxlen = 0, pos = 0;
|
---|
254 |
|
---|
255 | if(param == NULL) return NULL;
|
---|
256 |
|
---|
257 | webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=15>", &pos, 0);
|
---|
258 |
|
---|
259 | mbouquet = getmainbouquet(param);
|
---|
260 | if(mbouquet != NULL)
|
---|
261 | {
|
---|
262 | node = mbouquet->bouquet;
|
---|
263 | tmpstr = ostrcat(tmpstr, "(BOUQUET)-", 1, 0);
|
---|
264 | tmpstr = ostrcat(tmpstr, mbouquet->name, 1, 0);
|
---|
265 | tmpstr1 = htmlencode(tmpstr);
|
---|
266 | free(tmpstr); tmpstr = NULL;
|
---|
267 | while(node != NULL)
|
---|
268 | {
|
---|
269 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
270 | if(chnode != NULL)
|
---|
271 | {
|
---|
272 | webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0);
|
---|
273 | if(line == 0)
|
---|
274 | line = 1;
|
---|
275 | else
|
---|
276 | line = 0;
|
---|
277 | }
|
---|
278 | node = node->next;
|
---|
279 | }
|
---|
280 | free(tmpstr1); tmpstr1 = NULL;
|
---|
281 | }
|
---|
282 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
283 |
|
---|
284 | return buf;
|
---|
285 | }
|
---|
286 |
|
---|
287 | //flag 0: all
|
---|
288 | //flag 1: sat
|
---|
289 | //flag 2: provider
|
---|
290 | //flag 3: A-Z
|
---|
291 | char* webgetchannel(int param, int flag, int page)
|
---|
292 | {
|
---|
293 | char* buf = NULL, *tmpnr = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
|
---|
294 | struct channel* chnode = channel;
|
---|
295 | int line = 0, maxcount = 0, maxlen = 0, pos = 0;
|
---|
296 |
|
---|
297 | webcreateheadbig(&buf, &maxlen, "<meta http-equiv=refresh content=15>", &pos, 0);
|
---|
298 |
|
---|
299 | if(flag == 0) tmpstr1 = ostrcat(tmpstr1, "(ALL)", 1, 0);
|
---|
300 | if(flag == 1)
|
---|
301 | {
|
---|
302 | struct sat* node = getsatbyorbitalpos(param);
|
---|
303 | if(node != NULL)
|
---|
304 | {
|
---|
305 | tmpstr = ostrcat(tmpstr, "(SAT)-", 1, 0);
|
---|
306 | tmpstr = ostrcat(tmpstr, node->name, 1, 0);
|
---|
307 | tmpstr1 = htmlencode(tmpstr);
|
---|
308 | free(tmpstr); tmpstr = NULL;
|
---|
309 | }
|
---|
310 | }
|
---|
311 | if(flag == 2)
|
---|
312 | {
|
---|
313 | struct provider* node = getprovider(param);
|
---|
314 | if(node != NULL)
|
---|
315 | {
|
---|
316 | tmpstr = ostrcat(tmpstr, "(PROVIDER)-", 1, 0);
|
---|
317 | tmpstr = ostrcat(tmpstr, node->name, 1, 0);
|
---|
318 | tmpstr1 = htmlencode(tmpstr);
|
---|
319 | free(tmpstr); tmpstr = NULL;
|
---|
320 | }
|
---|
321 | }
|
---|
322 | if(flag == 3)
|
---|
323 | {
|
---|
324 | tmpstr = malloc(2);
|
---|
325 | if(tmpstr != NULL)
|
---|
326 | snprintf(tmpstr, 2, "%c", param);
|
---|
327 | tmpstr = ostrcat("(A-Z)-", tmpstr, 0, 1);
|
---|
328 | tmpstr1 = htmlencode(tmpstr);
|
---|
329 | free(tmpstr); tmpstr = NULL;
|
---|
330 | }
|
---|
331 |
|
---|
332 | while(chnode != NULL)
|
---|
333 | {
|
---|
334 | if(chnode->transponder == NULL)
|
---|
335 | {
|
---|
336 | chnode = chnode->next;
|
---|
337 | continue;
|
---|
338 | }
|
---|
339 | if(chnode->name == NULL)
|
---|
340 | {
|
---|
341 | chnode = chnode->next;
|
---|
342 | continue;
|
---|
343 | }
|
---|
344 | if(flag == 1 && chnode->transponder->orbitalpos != param)
|
---|
345 | {
|
---|
346 | chnode = chnode->next;
|
---|
347 | continue;
|
---|
348 | }
|
---|
349 | if(flag == 2 && chnode->providerid != param)
|
---|
350 | {
|
---|
351 | chnode = chnode->next;
|
---|
352 | continue;
|
---|
353 | }
|
---|
354 | if(flag == 3 && chnode->name[0] != param && chnode->name[0] != param + 32)
|
---|
355 | {
|
---|
356 | chnode = chnode->next;
|
---|
357 | continue;
|
---|
358 | }
|
---|
359 |
|
---|
360 | maxcount++;
|
---|
361 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
362 | {
|
---|
363 | chnode = chnode->next;
|
---|
364 | continue;
|
---|
365 | }
|
---|
366 | webcreatechannelbody(&buf, line, chnode, tmpstr1, &maxlen, &pos, 0);
|
---|
367 |
|
---|
368 | if(line == 0)
|
---|
369 | line = 1;
|
---|
370 | else
|
---|
371 | line = 0;
|
---|
372 |
|
---|
373 | chnode = chnode->next;
|
---|
374 | }
|
---|
375 | free(tmpstr); tmpstr = NULL;
|
---|
376 |
|
---|
377 | if(maxcount > MAXHTMLLINE)
|
---|
378 | {
|
---|
379 | int i;
|
---|
380 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
381 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
382 | {
|
---|
383 | if(page == i)
|
---|
384 | ostrcatbig(&buf, "<a class=pagesellink href=query?getchannelpage&", &maxlen, &pos);
|
---|
385 | else
|
---|
386 | ostrcatbig(&buf, "<a class=pagelink href=query?getchannelpage&", &maxlen, &pos);
|
---|
387 | tmpnr = oitoa(param);
|
---|
388 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
389 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
390 | free(tmpnr); tmpnr = NULL;
|
---|
391 | tmpnr = oitoa(flag);
|
---|
392 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
393 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
394 | free(tmpnr); tmpnr = NULL;
|
---|
395 |
|
---|
396 | tmpnr = oitoa(i);
|
---|
397 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
398 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
399 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
400 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
401 | free(tmpnr); tmpnr = NULL;
|
---|
402 | }
|
---|
403 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
404 | }
|
---|
405 |
|
---|
406 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
407 | return buf;
|
---|
408 | }
|
---|
409 |
|
---|
410 | char* webgetprovider()
|
---|
411 | {
|
---|
412 | char* buf = NULL, *tmpstr = NULL;
|
---|
413 | struct provider* node = provider;
|
---|
414 | int line = 0, maxlen = 0, pos = 0;
|
---|
415 |
|
---|
416 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
417 |
|
---|
418 | while(node != NULL)
|
---|
419 | {
|
---|
420 | if(line == 0)
|
---|
421 | {
|
---|
422 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
|
---|
423 | tmpstr = oitoa(node->providerid);
|
---|
424 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
425 | free(tmpstr); tmpstr = NULL;
|
---|
426 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
427 | line = 1;
|
---|
428 | }
|
---|
429 | else
|
---|
430 | {
|
---|
431 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getproviderchannel&", &maxlen, &pos);
|
---|
432 | tmpstr = oitoa(node->providerid);
|
---|
433 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
434 | free(tmpstr); tmpstr = NULL;
|
---|
435 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
436 | line = 0;
|
---|
437 | }
|
---|
438 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
439 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
440 |
|
---|
441 | node = node->next;
|
---|
442 | }
|
---|
443 |
|
---|
444 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
445 | return buf;
|
---|
446 | }
|
---|
447 |
|
---|
448 | char* webgetsat()
|
---|
449 | {
|
---|
450 | char* buf = NULL, *tmpstr = NULL;
|
---|
451 | struct sat* node = sat;
|
---|
452 | int line = 0, maxlen = 0, pos = 0;
|
---|
453 |
|
---|
454 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
455 |
|
---|
456 | while(node != NULL)
|
---|
457 | {
|
---|
458 | if(line == 0)
|
---|
459 | {
|
---|
460 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
|
---|
461 | tmpstr = oitoa(node->orbitalpos);
|
---|
462 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
463 | free(tmpstr); tmpstr = NULL;
|
---|
464 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
465 | line = 1;
|
---|
466 | }
|
---|
467 | else
|
---|
468 | {
|
---|
469 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getsatchannel&", &maxlen, &pos);
|
---|
470 | tmpstr = oitoa(node->orbitalpos);
|
---|
471 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
472 | free(tmpstr); tmpstr = NULL;
|
---|
473 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
474 | line = 0;
|
---|
475 | }
|
---|
476 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
477 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
478 |
|
---|
479 | node = node->next;
|
---|
480 | }
|
---|
481 |
|
---|
482 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
483 | return buf;
|
---|
484 | }
|
---|
485 |
|
---|
486 | char* webgetaz()
|
---|
487 | {
|
---|
488 | char* buf = NULL, *tmpstr = NULL, *tmpnr = NULL;
|
---|
489 | int line = 0, maxlen = 0, pos = 0, i;
|
---|
490 |
|
---|
491 | tmpstr = malloc(2);
|
---|
492 | if(tmpstr == NULL)
|
---|
493 | {
|
---|
494 | err("no memory");
|
---|
495 | return NULL;
|
---|
496 | }
|
---|
497 |
|
---|
498 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
499 |
|
---|
500 | for(i = 65; i < 91; i++)
|
---|
501 | {
|
---|
502 | if(line == 0)
|
---|
503 | {
|
---|
504 | ostrcatbig(&buf, "<tr class=line1><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
|
---|
505 | tmpnr = oitoa(i);
|
---|
506 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
507 | free(tmpnr); tmpnr = NULL;
|
---|
508 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
509 | line = 1;
|
---|
510 | }
|
---|
511 | else
|
---|
512 | {
|
---|
513 | ostrcatbig(&buf, "<tr class=line2><td nowrap><a class=link href=\"query?getazchannel&", &maxlen, &pos);
|
---|
514 | tmpnr = oitoa(i);
|
---|
515 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
516 | free(tmpnr); tmpnr = NULL;
|
---|
517 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
518 | line = 0;
|
---|
519 | }
|
---|
520 | snprintf(tmpstr, 2, "%c", i);
|
---|
521 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
522 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
523 | }
|
---|
524 |
|
---|
525 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
526 | free(tmpstr);
|
---|
527 | return buf;
|
---|
528 | }
|
---|
529 |
|
---|
530 | char* webgetbouquet()
|
---|
531 | {
|
---|
532 | char* buf = NULL;
|
---|
533 | struct mainbouquet* node = mainbouquet;
|
---|
534 | int line = 0, maxlen = 0, pos = 0;
|
---|
535 |
|
---|
536 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
537 |
|
---|
538 | while(node != NULL)
|
---|
539 | {
|
---|
540 | if(line == 0)
|
---|
541 | {
|
---|
542 | ostrcatbig(&buf, "<tr class=line1><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
|
---|
543 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
544 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
545 | line = 1;
|
---|
546 | }
|
---|
547 | else
|
---|
548 | {
|
---|
549 | ostrcatbig(&buf, "<tr class=line2><td width=100% nowrap><a class=link href=\"query?getbouquetchannel&", &maxlen, &pos);
|
---|
550 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
551 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
552 | line = 0;
|
---|
553 | }
|
---|
554 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
555 | ostrcatbig(&buf, "</a></td>", &maxlen, &pos);
|
---|
556 |
|
---|
557 | ostrcatbig(&buf, "<td width=50 nowrap align=right valign=middle><img style=\"margin-left: 5\" border=0 src=", &maxlen, &pos);
|
---|
558 |
|
---|
559 | if(node->type == 0)
|
---|
560 | ostrcatbig(&buf, "img/tv.png width=16 height=16 alt=TV>", &maxlen, &pos);
|
---|
561 | else
|
---|
562 | ostrcatbig(&buf, "img/radio.png width=16 height=16 alt=Radio>", &maxlen, &pos);
|
---|
563 | ostrcatbig(&buf, "<a href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
564 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
565 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
566 | ostrcatbig(&buf, "<img style=\"margin-left: 5\" border=0 width=16 height=16 alt=\"Graphical Multi EPG\" src=img/gmultiepg.png></a>", &maxlen, &pos);
|
---|
567 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
568 |
|
---|
569 | node = node->next;
|
---|
570 | }
|
---|
571 |
|
---|
572 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
573 | return buf;
|
---|
574 | }
|
---|
575 |
|
---|
576 | char* websetmute(char* param)
|
---|
577 | {
|
---|
578 | char* buf = NULL;
|
---|
579 | int mute = status.mute;
|
---|
580 |
|
---|
581 | if(param != NULL)
|
---|
582 | mute = atoi(param);
|
---|
583 |
|
---|
584 | 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);
|
---|
585 | if(mute == 0)
|
---|
586 | buf = ostrcat(buf, "<a href=query?setmute&1><img src=img/speak_on.png border=0 alt=\"Mute on\"></img></a>", 1, 0);
|
---|
587 | else
|
---|
588 | buf = ostrcat(buf, "<a href=query?setmute&0><img src=img/speak_off.png border=0 alt=\"Mute off\"></img></a>", 1, 0);
|
---|
589 | buf = ostrcat(buf, "</center></body></html>", 1, 0);
|
---|
590 |
|
---|
591 | if(mute != status.mute)
|
---|
592 | screenmute(0);
|
---|
593 |
|
---|
594 | return buf;
|
---|
595 | }
|
---|
596 |
|
---|
597 | char* websetvol(char* param)
|
---|
598 | {
|
---|
599 | char* buf = NULL;
|
---|
600 | int vol = 30;
|
---|
601 |
|
---|
602 | if(param == NULL)
|
---|
603 | vol = getvol();
|
---|
604 | else
|
---|
605 | vol = atoi(param);
|
---|
606 |
|
---|
607 | 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);
|
---|
608 | if(vol >=10)
|
---|
609 | buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
610 | else
|
---|
611 | buf = ostrcat(buf, "<a href=query?setvol&10><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
612 | if(vol >=20)
|
---|
613 | buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
614 | else
|
---|
615 | buf = ostrcat(buf, "<a href=query?setvol&20><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
616 | if(vol >=30)
|
---|
617 | buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
618 | else
|
---|
619 | buf = ostrcat(buf, "<a href=query?setvol&30><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
620 | if(vol >=40)
|
---|
621 | buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
622 | else
|
---|
623 | buf = ostrcat(buf, "<a href=query?setvol&40><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
624 | if(vol >=50)
|
---|
625 | buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
626 | else
|
---|
627 | buf = ostrcat(buf, "<a href=query?setvol&50><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
628 | if(vol >=60)
|
---|
629 | buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
630 | else
|
---|
631 | buf = ostrcat(buf, "<a href=query?setvol&60><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
632 | if(vol >=70)
|
---|
633 | buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
634 | else
|
---|
635 | buf = ostrcat(buf, "<a href=query?setvol&70><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
636 | if(vol >=80)
|
---|
637 | buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
638 | else
|
---|
639 | buf = ostrcat(buf, "<a href=query?setvol&80><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
640 | if(vol >=90)
|
---|
641 | buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
642 | else
|
---|
643 | buf = ostrcat(buf, "<a href=query?setvol&90><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
644 | if(vol >=100)
|
---|
645 | buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_on.png border=0></img></a> ", 1, 0);
|
---|
646 | else
|
---|
647 | buf = ostrcat(buf, "<a href=query?setvol&100><img src=img/led_off.png border=0></img></a> ", 1, 0);
|
---|
648 | buf = ostrcat(buf, "</center></body></html>", 1, 0);
|
---|
649 |
|
---|
650 | if(param != NULL)
|
---|
651 | {
|
---|
652 | setvol(vol);
|
---|
653 | if(status.mute == 1)
|
---|
654 | screenmute(0);
|
---|
655 | }
|
---|
656 | return buf;
|
---|
657 | }
|
---|
658 |
|
---|
659 | char* webgetaktservice()
|
---|
660 | {
|
---|
661 | char* buf = NULL;
|
---|
662 | struct channel* chnode = status.aktservice->channel;
|
---|
663 | int line = 0, maxlen = 0, pos = 0;
|
---|
664 |
|
---|
665 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 1);
|
---|
666 | webcreatechannelbody(&buf, line, chnode, getconfig("channellist", NULL), &maxlen, &pos ,1);
|
---|
667 | webcreatetailbig(&buf, &maxlen, &pos, 1);
|
---|
668 |
|
---|
669 | return buf;
|
---|
670 | }
|
---|
671 |
|
---|
672 | char* webswitch(char* param)
|
---|
673 | {
|
---|
674 | int ret = 0;
|
---|
675 | char* param1 = NULL, *param2 = NULL;
|
---|
676 | struct channel* chnode = NULL;
|
---|
677 |
|
---|
678 | if(param == NULL) return NULL;
|
---|
679 |
|
---|
680 | //create param1
|
---|
681 | param1 = strchr(param, '&');
|
---|
682 | if(param1 != NULL)
|
---|
683 | {
|
---|
684 | *param1++ = '\0';
|
---|
685 | param2 = strchr(param1, '&');
|
---|
686 | if(param2 != NULL)
|
---|
687 | *param2++ = '\0';
|
---|
688 | }
|
---|
689 |
|
---|
690 | if(param1 == NULL) return NULL;
|
---|
691 |
|
---|
692 | chnode = getchannel(atoi(param), atoi(param1));
|
---|
693 | if(chnode != NULL)
|
---|
694 | {
|
---|
695 | ret = channelnottunable(chnode);
|
---|
696 | if(ret == 0)
|
---|
697 | ret = servicestart(chnode, NULL, 0);
|
---|
698 | {
|
---|
699 | if(param2 != NULL && ret != 20 && ret != 21 && ret != 22)
|
---|
700 | addconfig("channellist", param2);
|
---|
701 | }
|
---|
702 | }
|
---|
703 |
|
---|
704 | return webgetaktservice();
|
---|
705 | }
|
---|
706 |
|
---|
707 | char* webgetm3u(char* param, int connfd)
|
---|
708 | {
|
---|
709 | char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
|
---|
710 | struct sockaddr_in sin;
|
---|
711 | socklen_t len = sizeof(sin);
|
---|
712 |
|
---|
713 | if(param == NULL) return NULL;
|
---|
714 |
|
---|
715 | if(getsockname(connfd, &sin, &len) < 0)
|
---|
716 | {
|
---|
717 | perr("getsockname");
|
---|
718 | return NULL;
|
---|
719 | }
|
---|
720 |
|
---|
721 | ip = inet_ntoa(sin.sin_addr);
|
---|
722 | if(ip == NULL) return NULL;
|
---|
723 |
|
---|
724 | buf = ostrcat(buf, "#EXTM3U\n", 1, 0);
|
---|
725 | buf = ostrcat(buf, "#EXTVLCOPT--http-reconnect=true\n", 1, 0);
|
---|
726 | buf = ostrcat(buf, "http://", 1, 0);
|
---|
727 | buf = ostrcat(buf, ip, 1, 0);
|
---|
728 | buf = ostrcat(buf, ":", 1, 0);
|
---|
729 | buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
|
---|
730 | buf = ostrcat(buf, "/", 1, 0);
|
---|
731 |
|
---|
732 | tmpbuf = htmlencode(param);
|
---|
733 | if(tmpbuf != NULL)
|
---|
734 | param = tmpbuf;
|
---|
735 |
|
---|
736 | buf = ostrcat(buf, param, 1, 0);
|
---|
737 | free(tmpbuf); tmpbuf = NULL;
|
---|
738 |
|
---|
739 | return buf;
|
---|
740 | }
|
---|
741 |
|
---|
742 | char* webgetvideo(char* param, int connfd)
|
---|
743 | {
|
---|
744 | char* buf = NULL, *ip = NULL, *tmpbuf = NULL;
|
---|
745 | struct sockaddr_in sin;
|
---|
746 | socklen_t len = sizeof(sin);
|
---|
747 |
|
---|
748 | if(param == NULL) return NULL;
|
---|
749 |
|
---|
750 | if(getsockname(connfd, &sin, &len) < 0)
|
---|
751 | {
|
---|
752 | perr("getsockname");
|
---|
753 | return NULL;
|
---|
754 | }
|
---|
755 |
|
---|
756 | ip = inet_ntoa(sin.sin_addr);
|
---|
757 | if(ip == NULL) return NULL;
|
---|
758 |
|
---|
759 | 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);
|
---|
760 | buf = ostrcat(buf, "<embed width=100% height=100% type=application/x-vlc-plugin name=video autoplay=yes target=\"http://", 1, 0);
|
---|
761 | buf = ostrcat(buf, ip, 1, 0);
|
---|
762 | buf = ostrcat(buf, ":", 1, 0);
|
---|
763 | buf = ostrcat(buf, getconfig("streamport", NULL), 1, 0);
|
---|
764 | buf = ostrcat(buf, "/", 1, 0);
|
---|
765 |
|
---|
766 | tmpbuf = htmlencode(param);
|
---|
767 | if(tmpbuf != NULL)
|
---|
768 | param = tmpbuf;
|
---|
769 |
|
---|
770 | buf = ostrcat(buf, param, 1, 0);
|
---|
771 | free(tmpbuf); tmpbuf = NULL;
|
---|
772 | buf = ostrcat(buf, "\" />", 1, 0);
|
---|
773 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.play()'>Play</a>", 1, 0);
|
---|
774 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.stop()'>Stop</a>", 1, 0);
|
---|
775 | //buf = ostrcat(buf, "<a href=javascript:; onclick='document.video.fullscreen()'>Fullscreen</a>", 1, 0);
|
---|
776 | buf = ostrcat(buf, "</td></tr></body></html>", 1, 0);
|
---|
777 |
|
---|
778 | return buf;
|
---|
779 | }
|
---|
780 |
|
---|
781 | char* webgetchannelpage(char* param)
|
---|
782 | {
|
---|
783 | char* param1 = NULL, *param2 = NULL;
|
---|
784 |
|
---|
785 | if(param == NULL) return NULL;
|
---|
786 |
|
---|
787 | //create param1 + 2
|
---|
788 | param1 = strchr(param, '&');
|
---|
789 | if(param1 != NULL)
|
---|
790 | {
|
---|
791 | *param1++ = '\0';
|
---|
792 | param2 = strchr(param1, '&');
|
---|
793 | if(param2 != NULL)
|
---|
794 | *param2++ = '\0';
|
---|
795 | }
|
---|
796 |
|
---|
797 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
798 |
|
---|
799 | return webgetchannel(atoi(param), atoi(param1), atoi(param2));
|
---|
800 | }
|
---|
801 |
|
---|
802 | void webmessage(struct stimerthread* timernode, char* text, int flag)
|
---|
803 | {
|
---|
804 | textbox(_("Message"), text, _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 0, 0);
|
---|
805 | free(text);
|
---|
806 | }
|
---|
807 |
|
---|
808 | char* websendmessage(char* param)
|
---|
809 | {
|
---|
810 | char* text = NULL, *buf = NULL;
|
---|
811 |
|
---|
812 | if(param == NULL) return NULL;
|
---|
813 | param = strchr(param, '=');
|
---|
814 | if(param != NULL)
|
---|
815 | {
|
---|
816 | param++;
|
---|
817 | stringreplacechar(param, '+', ' ');
|
---|
818 | text = ostrcat(text, param, 1, 0);
|
---|
819 | }
|
---|
820 | addtimer(&webmessage, START, 1000, 1, (void*)text, NULL, NULL);
|
---|
821 |
|
---|
822 | buf = webcreatehead(buf, NULL, 1);
|
---|
823 | buf = ostrcat(buf, "<tr><td align=center valign=top><font class=biglabel><br><br>Message Send !!!</font></td></tr>", 1, 0);
|
---|
824 | buf = webcreatetail(buf, 1);
|
---|
825 |
|
---|
826 | return buf;
|
---|
827 | }
|
---|
828 |
|
---|
829 | char* webgetsignal()
|
---|
830 | {
|
---|
831 | char* buf = NULL, *tmpnr = NULL;
|
---|
832 | uint16_t snr = 0, signal = 0;
|
---|
833 | uint32_t ber = 0, unc = 0;
|
---|
834 |
|
---|
835 | ber = fereadber(status.aktservice->fedev);
|
---|
836 | unc = fereaduncorrectedblocks(status.aktservice->fedev);
|
---|
837 | signal = fereadsignalstrength(status.aktservice->fedev);
|
---|
838 | snr = fereadsnr(status.aktservice->fedev);
|
---|
839 | snr = (snr * 100) / 0xffff;
|
---|
840 |
|
---|
841 | buf = webcreatehead(buf, "<meta http-equiv=refresh content=1>", 0);
|
---|
842 |
|
---|
843 | buf = ostrcat(buf, "<tr><td align=center><font class=biglabel><br><br>BER: ", 1, 0);
|
---|
844 | tmpnr = oitoa(ber);
|
---|
845 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
846 | free(tmpnr); tmpnr = NULL;
|
---|
847 |
|
---|
848 | buf = ostrcat(buf, "<br>UNC: ", 1, 0);
|
---|
849 | tmpnr = oitoa(unc);
|
---|
850 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
851 | free(tmpnr); tmpnr = NULL;
|
---|
852 |
|
---|
853 | buf = ostrcat(buf, "<br>SIG: ", 1, 0);
|
---|
854 | tmpnr = oitoa(signal);
|
---|
855 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
856 | free(tmpnr); tmpnr = NULL;
|
---|
857 |
|
---|
858 | buf = ostrcat(buf, "<br>SNR: ", 1, 0);
|
---|
859 | tmpnr = oitoa(snr);
|
---|
860 | buf = ostrcat(buf, tmpnr, 1, 0);
|
---|
861 | free(tmpnr); tmpnr = NULL;
|
---|
862 |
|
---|
863 | buf = ostrcat(buf, "</font></td></tr>", 1, 0);
|
---|
864 | buf = webcreatetail(buf, 0);
|
---|
865 | return buf;
|
---|
866 | }
|
---|
867 |
|
---|
868 | char* webgetepg(char* param)
|
---|
869 | {
|
---|
870 | char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *param1 = NULL, *param2 = NULL;
|
---|
871 | struct epg* epgnode = NULL;
|
---|
872 | struct channel* chnode = NULL;
|
---|
873 | struct tm *loctime = NULL;
|
---|
874 |
|
---|
875 | if(param == NULL) return NULL;
|
---|
876 |
|
---|
877 | //create param1 + 2
|
---|
878 | param1 = strchr(param, '&');
|
---|
879 | if(param1 != NULL)
|
---|
880 | {
|
---|
881 | *param1++ = '\0';
|
---|
882 | param2 = strchr(param1, '&');
|
---|
883 | if(param2 != NULL)
|
---|
884 | *param2++ = '\0';
|
---|
885 | }
|
---|
886 |
|
---|
887 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
888 |
|
---|
889 | chnode = getchannel(atoi(param), atoi(param1));
|
---|
890 | if(chnode == NULL) return NULL;
|
---|
891 |
|
---|
892 | epgnode = getepg(chnode, atoi(param2), 0);
|
---|
893 | if(epgnode == NULL) return NULL;
|
---|
894 |
|
---|
895 | buf = webcreatehead(buf, NULL, 0);
|
---|
896 |
|
---|
897 | buf1 = malloc(MINMALLOC);
|
---|
898 | if(buf1 == NULL)
|
---|
899 | {
|
---|
900 | err("no mem");
|
---|
901 | return buf;
|
---|
902 | }
|
---|
903 |
|
---|
904 | buf = ostrcat(buf, "<tr><td><font class=biglabel>", 1, 0);
|
---|
905 | if(epgnode->title != NULL)
|
---|
906 | {
|
---|
907 | buf = ostrcat(buf, epgnode->title, 1, 0);
|
---|
908 | buf = ostrcat(buf, " (", 1, 0);
|
---|
909 | loctime = olocaltime(&epgnode->starttime);
|
---|
910 | if(loctime != NULL)
|
---|
911 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
912 | free(loctime); loctime = NULL;
|
---|
913 | loctime = olocaltime(&epgnode->endtime);
|
---|
914 | if(loctime != NULL)
|
---|
915 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M", loctime);
|
---|
916 | free(loctime); loctime = NULL;
|
---|
917 | buf = ostrcat(buf, buf1, 1, 0);
|
---|
918 | buf = ostrcat(buf, ")", 1, 0);
|
---|
919 | }
|
---|
920 | buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
|
---|
921 |
|
---|
922 | buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
|
---|
923 | if(epgnode->subtitle != NULL)
|
---|
924 | buf = ostrcat(buf, epgnode->subtitle, 1, 0);
|
---|
925 | buf = ostrcat(buf, "<br><br></font></td></tr>", 1, 0);
|
---|
926 |
|
---|
927 | buf = ostrcat(buf, "<tr><td><font class=label>", 1, 0);
|
---|
928 | tmpstr = epgdescunzip(epgnode);
|
---|
929 | if(tmpstr != NULL)
|
---|
930 | buf = ostrcat(buf, tmpstr, 1, 0);
|
---|
931 | free(tmpstr); tmpstr = NULL;
|
---|
932 | buf = ostrcat(buf, "</font></td></tr>", 1, 0);
|
---|
933 |
|
---|
934 | buf = webcreatetail(buf, 0);
|
---|
935 |
|
---|
936 | free(buf1);
|
---|
937 | return buf;
|
---|
938 | }
|
---|
939 |
|
---|
940 | char* webgetsingleepg(char* param)
|
---|
941 | {
|
---|
942 | int line = 0, maxlen = 0, pos = 0;
|
---|
943 | char* buf = NULL, *buf1 = NULL, *param1 = NULL, *tmpstr = NULL;
|
---|
944 | struct epg* epgnode = NULL;
|
---|
945 | struct channel* chnode = NULL;
|
---|
946 | struct tm *loctime = NULL;
|
---|
947 |
|
---|
948 | //create param1
|
---|
949 | param1 = strchr(param, '&');
|
---|
950 | if(param1 != NULL)
|
---|
951 | *param1++ = '\0';
|
---|
952 |
|
---|
953 | if(param1 == NULL) return NULL;
|
---|
954 |
|
---|
955 | chnode = getchannel(atoi(param), atoi(param1));
|
---|
956 | if(chnode == NULL) return NULL;
|
---|
957 | epgnode = getepgakt(chnode);;
|
---|
958 |
|
---|
959 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
960 |
|
---|
961 | buf1 = malloc(MINMALLOC);
|
---|
962 | if(buf1 == NULL)
|
---|
963 | {
|
---|
964 | err("no mem");
|
---|
965 | return buf;
|
---|
966 | }
|
---|
967 |
|
---|
968 | while(epgnode != NULL)
|
---|
969 | {
|
---|
970 | if(line == 0)
|
---|
971 | {
|
---|
972 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
973 | line = 1;
|
---|
974 | }
|
---|
975 | else
|
---|
976 | {
|
---|
977 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
978 | line = 0;
|
---|
979 | }
|
---|
980 |
|
---|
981 | ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
|
---|
982 | tmpstr = oitoa(chnode->serviceid);
|
---|
983 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
984 | free(tmpstr); tmpstr = NULL;
|
---|
985 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
986 | tmpstr = oitoa(chnode->transponderid);
|
---|
987 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
988 | free(tmpstr); tmpstr = NULL;
|
---|
989 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
990 | tmpstr = oitoa(epgnode->eventid);
|
---|
991 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
992 | free(tmpstr); tmpstr = NULL;
|
---|
993 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
994 |
|
---|
995 | loctime = olocaltime(&epgnode->starttime);
|
---|
996 | if(loctime != NULL)
|
---|
997 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
998 | free(loctime); loctime = NULL;
|
---|
999 | loctime = olocaltime(&epgnode->endtime);
|
---|
1000 | if(loctime != NULL)
|
---|
1001 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
1002 | free(loctime); loctime = NULL;
|
---|
1003 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
1004 | ostrcatbig(&buf, " ", &maxlen, &pos);
|
---|
1005 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1006 | if(epgnode->subtitle != NULL)
|
---|
1007 | {
|
---|
1008 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1009 | ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
|
---|
1010 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1011 | }
|
---|
1012 | ostrcatbig(&buf, "</a></td></tr>", &maxlen, &pos);
|
---|
1013 |
|
---|
1014 | epgnode = epgnode->next;
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1018 |
|
---|
1019 | free(buf1);
|
---|
1020 | return buf;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | //TODO: create rectimer line
|
---|
1024 | void webcalcrecline(char** buf, int* maxlen, int* pos)
|
---|
1025 | {
|
---|
1026 | //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);
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | char* webgetgmultiepg(char* param)
|
---|
1030 | {
|
---|
1031 | int page = 1, i, line = 0, treffer = 0, maxlen = 0, pos = 0;
|
---|
1032 | char* buf = NULL, *tmpnr = NULL, *param1 = NULL;
|
---|
1033 | struct mainbouquet *mbouquet = NULL;
|
---|
1034 | struct bouquet *node = NULL;
|
---|
1035 | struct channel* chnode = NULL;
|
---|
1036 | struct epg* epgnode = NULL;
|
---|
1037 | time_t akttime = 0, difftime = 0, starttime = 0, endtime = 0, lastendtime = 0;
|
---|
1038 |
|
---|
1039 | if(param == NULL) return NULL;
|
---|
1040 |
|
---|
1041 | //create param1
|
---|
1042 | param1 = strchr(param, '&');
|
---|
1043 | if(param1 != NULL)
|
---|
1044 | *param1++ = '\0';
|
---|
1045 |
|
---|
1046 | if(param1 != NULL) page = atoi(param1);
|
---|
1047 |
|
---|
1048 | 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);
|
---|
1049 |
|
---|
1050 | akttime = webcreatetimeline(&buf, &maxlen, &pos);
|
---|
1051 | akttime += ((page - 1) * 1440);
|
---|
1052 | ostrcatbig(&buf, "</tr></thead><tbody>", &maxlen, &pos);
|
---|
1053 |
|
---|
1054 | mbouquet = getmainbouquet(param);
|
---|
1055 | if(mbouquet != NULL)
|
---|
1056 | {
|
---|
1057 | node = mbouquet->bouquet;
|
---|
1058 | while(node != NULL)
|
---|
1059 | {
|
---|
1060 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
1061 | if(chnode != NULL)
|
---|
1062 | {
|
---|
1063 | if(line == 0)
|
---|
1064 | {
|
---|
1065 | ostrcatbig(&buf, "<tr><th class=gepgchannel1>", &maxlen, &pos);
|
---|
1066 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1067 | ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
|
---|
1068 | webcalcrecline(&buf, &maxlen, &pos);
|
---|
1069 | ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line1>", &maxlen, &pos);
|
---|
1070 | line = 1;
|
---|
1071 | }
|
---|
1072 | else
|
---|
1073 | {
|
---|
1074 | ostrcatbig(&buf, "<tr><th class=gepgchannel2>", &maxlen, &pos);
|
---|
1075 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1076 | ostrcatbig(&buf, "</th><td class=gepgchannelcell colspan=1000>", &maxlen, &pos);
|
---|
1077 | webcalcrecline(&buf, &maxlen, &pos);
|
---|
1078 |
|
---|
1079 | ostrcatbig(&buf, "<table border=0 cellpadding=0 cellspacing=0 style=\"table-layout: fixed;\"><tr class=line2>", &maxlen, &pos);
|
---|
1080 | line = 0;
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | treffer = 0;
|
---|
1084 | lastendtime = 0;
|
---|
1085 | epgnode = getepgakt(chnode);
|
---|
1086 | while(epgnode != NULL)
|
---|
1087 | {
|
---|
1088 | treffer = 1;
|
---|
1089 | starttime = epgnode->starttime / 60;
|
---|
1090 | endtime = epgnode->endtime / 60;
|
---|
1091 |
|
---|
1092 | if(endtime <= starttime || starttime >= akttime + 1440)
|
---|
1093 | {
|
---|
1094 | epgnode = epgnode->next;
|
---|
1095 | continue;
|
---|
1096 | }
|
---|
1097 |
|
---|
1098 | //check if old endtime > new starttime
|
---|
1099 | if(lastendtime > 0 && starttime > lastendtime)
|
---|
1100 | {
|
---|
1101 | difftime = (starttime - lastendtime) * 5;
|
---|
1102 |
|
---|
1103 | if(difftime <= 0)
|
---|
1104 | {
|
---|
1105 | epgnode = epgnode->next;
|
---|
1106 | continue;
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | ostrcatbig(&buf, "<td class=gepgcellblank style=\"", &maxlen, &pos);
|
---|
1110 | tmpnr = oitoa(difftime);
|
---|
1111 | ostrcatbig(&buf, "width:", &maxlen, &pos);
|
---|
1112 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1113 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1114 | ostrcatbig(&buf, "min-width:", &maxlen, &pos);
|
---|
1115 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1116 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1117 | ostrcatbig(&buf, "max-width:", &maxlen, &pos);
|
---|
1118 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1119 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1120 | free(tmpnr); tmpnr = NULL;
|
---|
1121 |
|
---|
1122 | ostrcatbig(&buf, "\"> </td>", &maxlen, &pos);
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | //check if starttime < last endtime
|
---|
1126 | if(starttime < lastendtime)
|
---|
1127 | starttime = lastendtime;
|
---|
1128 |
|
---|
1129 | //check if endtime is in next day
|
---|
1130 | if(endtime > akttime + 1440)
|
---|
1131 | endtime = endtime - (endtime - (akttime + 1440));
|
---|
1132 |
|
---|
1133 | //check if starttime is in prev day
|
---|
1134 | if(starttime < akttime)
|
---|
1135 | difftime = (endtime - akttime) * 5;
|
---|
1136 | else
|
---|
1137 | difftime = (endtime - starttime) * 5;
|
---|
1138 |
|
---|
1139 | if(difftime <= 0)
|
---|
1140 | {
|
---|
1141 | epgnode = epgnode->next;
|
---|
1142 | continue;
|
---|
1143 | }
|
---|
1144 |
|
---|
1145 | lastendtime = endtime;
|
---|
1146 |
|
---|
1147 | ostrcatbig(&buf, "<td class=gepgcell style=\"", &maxlen, &pos);
|
---|
1148 | tmpnr = oitoa(difftime);
|
---|
1149 | ostrcatbig(&buf, "width:", &maxlen, &pos);
|
---|
1150 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1151 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1152 | ostrcatbig(&buf, "min-width:", &maxlen, &pos);
|
---|
1153 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1154 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1155 | ostrcatbig(&buf, "max-width:", &maxlen, &pos);
|
---|
1156 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1157 | ostrcatbig(&buf, "px;", &maxlen, &pos);
|
---|
1158 | free(tmpnr); tmpnr = NULL;
|
---|
1159 |
|
---|
1160 | ostrcatbig(&buf, "\"><div class=gepgcellborder>", &maxlen, &pos);
|
---|
1161 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1162 | ostrcatbig(&buf, "</div></div></td>", &maxlen, &pos);
|
---|
1163 |
|
---|
1164 | epgnode = epgnode->next;
|
---|
1165 | }
|
---|
1166 | if(treffer == 0)
|
---|
1167 | ostrcatbig(&buf, "<td class=gepgcellblank> </td>", &maxlen, &pos);
|
---|
1168 | }
|
---|
1169 | ostrcatbig(&buf, "</tr></table></td></tr>", &maxlen, &pos);
|
---|
1170 |
|
---|
1171 | node = node->next;
|
---|
1172 | }
|
---|
1173 | }
|
---|
1174 | ostrcatbig(&buf, "<script type=text/javascript>if(typeof tableScroll == 'function'){tableScroll('gmultiepg');}</script></tbody></table></td></tr><tr><td align=center>", &maxlen, &pos);
|
---|
1175 |
|
---|
1176 | for(i = 1; i <= 14; i++)
|
---|
1177 | {
|
---|
1178 | if(page == i)
|
---|
1179 | ostrcatbig(&buf, "<a class=pagesellink href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
1180 | else
|
---|
1181 | ostrcatbig(&buf, "<a class=pagelink href=\"query?getgmultiepg&", &maxlen, &pos);
|
---|
1182 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1183 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1184 | tmpnr = oitoa(i);
|
---|
1185 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1186 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1187 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1188 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
1189 | free(tmpnr); tmpnr = NULL;
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 | ostrcatbig(&buf, "</td></tr></table></center></body></html>", &maxlen, &pos);
|
---|
1193 | return buf;
|
---|
1194 | }
|
---|
1195 |
|
---|
1196 | void webgetshoot(char* param)
|
---|
1197 | {
|
---|
1198 | char* cmd = NULL, *tmpstr = NULL;
|
---|
1199 |
|
---|
1200 | if(ostrcmp(param, "1") == 0) //OSD
|
---|
1201 | cmd = ostrcat(cmd, "stfbshot PNG /tmp/dump.png", 1, 0);
|
---|
1202 |
|
---|
1203 | if(ostrcmp(param, "2") == 0) //Video
|
---|
1204 | {
|
---|
1205 | if(status.aktservice->channel != NULL)
|
---|
1206 | {
|
---|
1207 | cmd = ostrcat(cmd, "ffmpeg -itsoffset -4 -i http://127.0.0.1:", 1, 0);
|
---|
1208 | cmd = ostrcat(cmd, getconfig("streamport", NULL), 1, 0);
|
---|
1209 | cmd = ostrcat(cmd, "/", 1, 0);
|
---|
1210 | tmpstr = oitoa(status.aktservice->channel->serviceid);
|
---|
1211 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1212 | free(tmpstr); tmpstr = NULL;
|
---|
1213 | cmd = ostrcat(cmd, ",", 1, 0);
|
---|
1214 | tmpstr = oitoa(status.aktservice->channel->transponderid);
|
---|
1215 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1216 | free(tmpstr); tmpstr = NULL;
|
---|
1217 | cmd = ostrcat(cmd, " -vframes 1 -vcodec png -sn -an -y -f image2 /tmp/dump.png", 1, 0);
|
---|
1218 | }
|
---|
1219 | }
|
---|
1220 |
|
---|
1221 | if(ostrcmp(param, "3") == 0) //OSD + Video
|
---|
1222 | {
|
---|
1223 | if(status.aktservice->channel != NULL)
|
---|
1224 | {
|
---|
1225 | cmd = ostrcat(cmd, "grab.sh ", 1, 0);
|
---|
1226 | tmpstr = oitoa(status.aktservice->channel->serviceid);
|
---|
1227 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1228 | free(tmpstr); tmpstr = NULL;
|
---|
1229 | cmd = ostrcat(cmd, ",", 1, 0);
|
---|
1230 | tmpstr = oitoa(status.aktservice->channel->transponderid);
|
---|
1231 | cmd = ostrcat(cmd, tmpstr, 1, 0);
|
---|
1232 | free(tmpstr); tmpstr = NULL;
|
---|
1233 | cmd = ostrcat(cmd, " titan", 1, 0);
|
---|
1234 | }
|
---|
1235 | }
|
---|
1236 |
|
---|
1237 | if(cmd != NULL)
|
---|
1238 | system(cmd);
|
---|
1239 | free(cmd);
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | char* webgetepgsearch(char* query, char* param)
|
---|
1243 | {
|
---|
1244 | int line = 0, maxlen = 0, pos = 0, maxcount = 0, page = 1;
|
---|
1245 | char* buf = NULL, *buf1 = NULL, *tmpstr = NULL, *tmpnr = NULL, * param1 = NULL;
|
---|
1246 | struct channel* chnode = channel;
|
---|
1247 | struct epg* epgnode = NULL;
|
---|
1248 | struct tm *loctime = NULL;
|
---|
1249 |
|
---|
1250 | if(query == NULL) return NULL;
|
---|
1251 |
|
---|
1252 | if(param == NULL)
|
---|
1253 | {
|
---|
1254 | query = strchr(query, '=');
|
---|
1255 | if(query != NULL)
|
---|
1256 | {
|
---|
1257 | query++;
|
---|
1258 | stringreplacechar(param, '+', ' ');
|
---|
1259 | param = query;
|
---|
1260 | }
|
---|
1261 | }
|
---|
1262 | else
|
---|
1263 | {
|
---|
1264 | //create param1
|
---|
1265 | param1 = strchr(param, '&');
|
---|
1266 | if(param1 != NULL)
|
---|
1267 | {
|
---|
1268 | *param1++ = '\0';
|
---|
1269 | page = atoi(param1);
|
---|
1270 | }
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | buf1 = malloc(MINMALLOC);
|
---|
1274 | if(buf1 == NULL)
|
---|
1275 | {
|
---|
1276 | err("no mem");
|
---|
1277 | return buf;
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
1281 | while(chnode != NULL)
|
---|
1282 | {
|
---|
1283 | epgnode = getepgakt(chnode);
|
---|
1284 | while(epgnode != NULL)
|
---|
1285 | {
|
---|
1286 | //TODO: case sensitiv search
|
---|
1287 | if(epgnode->title != NULL && strstr(epgnode->title, param) != NULL)
|
---|
1288 | {
|
---|
1289 |
|
---|
1290 | maxcount++;
|
---|
1291 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
1292 | {
|
---|
1293 | epgnode = epgnode->next;
|
---|
1294 | continue;
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | if(line == 0)
|
---|
1298 | {
|
---|
1299 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
1300 | line = 1;
|
---|
1301 | }
|
---|
1302 | else
|
---|
1303 | {
|
---|
1304 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
1305 | line = 0;
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | ostrcatbig(&buf, "<td nowrap><a target=main class=link href=query?getepg&", &maxlen, &pos);
|
---|
1309 | tmpstr = oitoa(chnode->serviceid);
|
---|
1310 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1311 | free(tmpstr); tmpstr = NULL;
|
---|
1312 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1313 | tmpstr = oitoa(chnode->transponderid);
|
---|
1314 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1315 | free(tmpstr); tmpstr = NULL;
|
---|
1316 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1317 | tmpstr = oitoa(epgnode->eventid);
|
---|
1318 | ostrcatbig(&buf, tmpstr, &maxlen, &pos);
|
---|
1319 | free(tmpstr); tmpstr = NULL;
|
---|
1320 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1321 |
|
---|
1322 | loctime = olocaltime(&epgnode->starttime);
|
---|
1323 | if(loctime != NULL)
|
---|
1324 | strftime(buf1, MINMALLOC, "%H:%M -", loctime);
|
---|
1325 | free(loctime); loctime = NULL;
|
---|
1326 | loctime = olocaltime(&epgnode->endtime);
|
---|
1327 | if(loctime != NULL)
|
---|
1328 | strftime(&buf1[7], MINMALLOC - 8, " %H:%M ", loctime);
|
---|
1329 | free(loctime); loctime = NULL;
|
---|
1330 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
1331 | ostrcatbig(&buf, " ", &maxlen, &pos);
|
---|
1332 |
|
---|
1333 | ostrcatbig(&buf, epgnode->title, &maxlen, &pos);
|
---|
1334 | if(chnode->name != NULL)
|
---|
1335 | {
|
---|
1336 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1337 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1338 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1339 | }
|
---|
1340 | ostrcatbig(&buf, "</a><br><font class=smalllabel1>", &maxlen, &pos);
|
---|
1341 | ostrcatbig(&buf, epgnode->subtitle, &maxlen, &pos);
|
---|
1342 | ostrcatbig(&buf, "</font></td></tr>", &maxlen, &pos);
|
---|
1343 | }
|
---|
1344 | epgnode = epgnode->next;
|
---|
1345 | }
|
---|
1346 | chnode = chnode->next;
|
---|
1347 | }
|
---|
1348 |
|
---|
1349 | if(maxcount > MAXHTMLLINE)
|
---|
1350 | {
|
---|
1351 | int i;
|
---|
1352 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
1353 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
1354 | {
|
---|
1355 | if(page == i)
|
---|
1356 | ostrcatbig(&buf, "<a class=pagesellink href=query?getepgsearch&", &maxlen, &pos);
|
---|
1357 | else
|
---|
1358 | ostrcatbig(&buf, "<a class=pagelink href=query?getepgsearch&", &maxlen, &pos);
|
---|
1359 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1360 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1361 | free(tmpnr); tmpnr = NULL;
|
---|
1362 |
|
---|
1363 | tmpnr = oitoa(i);
|
---|
1364 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1365 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1366 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1367 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
1368 | free(tmpnr); tmpnr = NULL;
|
---|
1369 | }
|
---|
1370 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
1371 | }
|
---|
1372 |
|
---|
1373 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1374 | free(buf1);
|
---|
1375 | return buf;
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | //flagbit 0: restrict to path
|
---|
1379 | //flagbit 1: show epg icon
|
---|
1380 | //flagbit 2: show delete icon
|
---|
1381 | //flagbit 3: show stream icon
|
---|
1382 | //flagbit 4: show websteam icon
|
---|
1383 | char* webgetfilelist(char* param, char* link, char* dellink, char* path, char* mask, int flag)
|
---|
1384 | {
|
---|
1385 | char* buf = NULL, *tmppath = NULL, *tmpnr = NULL, *param1 = NULL;
|
---|
1386 | int maxlen = 0, pos = 0, line = 0, maxcount = 0, page = 1;
|
---|
1387 | struct skin* webdir = getscreen("webdir");
|
---|
1388 | struct skin* filelist = getscreennode(webdir, "filelist");
|
---|
1389 | struct skin* filelistpath = getscreennode(webdir, "filelistpath");
|
---|
1390 | struct skin* node = NULL;
|
---|
1391 |
|
---|
1392 | if(param == NULL) param = path;
|
---|
1393 |
|
---|
1394 | //create param1
|
---|
1395 | param1 = strchr(param, '&');
|
---|
1396 | if(param1 != NULL)
|
---|
1397 | *param1++ = '\0';
|
---|
1398 |
|
---|
1399 | if(param1 != NULL) page = atoi(param1);
|
---|
1400 |
|
---|
1401 | if(strlen(param) == 0 || !isdir(param))
|
---|
1402 | tmppath = ostrcat(path, "", 0, 0);
|
---|
1403 | else
|
---|
1404 | tmppath = ostrcat(param, "", 0, 0);
|
---|
1405 |
|
---|
1406 | char* tmppath1 = createpath(tmppath, "");
|
---|
1407 | free(tmppath); tmppath = tmppath1;
|
---|
1408 |
|
---|
1409 | if(checkbit(flag, 0) == 1)
|
---|
1410 | {
|
---|
1411 | if(strstr(tmppath, path) != tmppath)
|
---|
1412 | {
|
---|
1413 | free(tmppath); tmppath = NULL;
|
---|
1414 | tmppath = ostrcat(path, "", 0, 0);
|
---|
1415 | }
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 | changemask(filelist, mask);
|
---|
1419 | changeinput(filelist, tmppath);
|
---|
1420 | changetext(filelistpath, filelist->input);
|
---|
1421 |
|
---|
1422 | free(tmppath); tmppath = NULL;
|
---|
1423 |
|
---|
1424 | delmarkedscreennodes(webdir, FILELISTDELMARK);
|
---|
1425 | createfilelist(webdir, filelist);
|
---|
1426 |
|
---|
1427 | 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);
|
---|
1428 |
|
---|
1429 | node = filelist;
|
---|
1430 | while(node != NULL)
|
---|
1431 | {
|
---|
1432 | if(node->del == FILELISTDELMARK)
|
---|
1433 | {
|
---|
1434 | maxcount++;
|
---|
1435 | if(maxcount <= (MAXHTMLLINE * page) - MAXHTMLLINE || maxcount > MAXHTMLLINE * page)
|
---|
1436 | {
|
---|
1437 | node = node->next;
|
---|
1438 | continue;
|
---|
1439 | }
|
---|
1440 |
|
---|
1441 | if(line == 0)
|
---|
1442 | {
|
---|
1443 | ostrcatbig(&buf, "<tr class=line1>", &maxlen, &pos);
|
---|
1444 | line = 1;
|
---|
1445 | }
|
---|
1446 | else
|
---|
1447 | {
|
---|
1448 | ostrcatbig(&buf, "<tr class=line2>", &maxlen, &pos);
|
---|
1449 | line = 0;
|
---|
1450 | }
|
---|
1451 |
|
---|
1452 | ostrcatbig(&buf, "<td>", &maxlen, &pos);
|
---|
1453 | if(node->input != NULL) //dir
|
---|
1454 | {
|
---|
1455 | ostrcatbig(&buf, "<img border=0 width=16 height=16 src=img/folder.png alt=Directory> <a class=link href=\"query?", &maxlen, &pos);
|
---|
1456 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
1457 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1458 | ostrcatbig(&buf, node->input, &maxlen, &pos);
|
---|
1459 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1460 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1461 | ostrcatbig(&buf, "</a><td> </td>", &maxlen, &pos);
|
---|
1462 | }
|
---|
1463 | else
|
---|
1464 | {
|
---|
1465 | ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
|
---|
1466 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1467 | ostrcatbig(&buf, "</font></td>", &maxlen, &pos);
|
---|
1468 |
|
---|
1469 | ostrcatbig(&buf, "<td width=80 align=right>", &maxlen, &pos);
|
---|
1470 | //epg png
|
---|
1471 | if(checkbit(flag, 1) == 1)
|
---|
1472 | {
|
---|
1473 | ostrcatbig(&buf, "<a href=\"query?getmovieepg&", &maxlen, &pos);
|
---|
1474 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1475 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1476 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1477 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1478 | ostrcatbig(&buf, "<img border=0 src=img/movieepg.png width=16 height=16 alt=EPG></a>", &maxlen, &pos);
|
---|
1479 | }
|
---|
1480 | //delete png
|
---|
1481 | if(checkbit(flag, 2) == 1)
|
---|
1482 | {
|
---|
1483 | ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
|
---|
1484 | ostrcatbig(&buf, "query?", &maxlen, &pos);
|
---|
1485 | ostrcatbig(&buf, dellink, &maxlen, &pos);
|
---|
1486 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1487 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1488 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1489 | tmpnr = oitoa(page);
|
---|
1490 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1491 | free(tmpnr); tmpnr = NULL;
|
---|
1492 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1493 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1494 | ostrcatbig(&buf, "\");'>", &maxlen, &pos);
|
---|
1495 | }
|
---|
1496 | //stream png
|
---|
1497 | if(checkbit(flag, 3) == 1)
|
---|
1498 | {
|
---|
1499 | ostrcatbig(&buf, "<a target=nothing href=\"query?getm3u&0,0,", &maxlen, &pos);
|
---|
1500 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1501 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1502 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1503 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1504 |
|
---|
1505 | ostrcatbig(&buf, "<img border=0 src=img/stream.png width=16 height=16 alt=Stream></a>", &maxlen, &pos);
|
---|
1506 | }
|
---|
1507 | //webstream png
|
---|
1508 | if(checkbit(flag, 4) == 1)
|
---|
1509 | {
|
---|
1510 | ostrcatbig(&buf, "<a target=_blank href=\"query?getvideo&0,0,", &maxlen, &pos);
|
---|
1511 | ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1512 | ostrcatbig(&buf, "/", &maxlen, &pos);
|
---|
1513 | ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1514 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1515 |
|
---|
1516 | ostrcatbig(&buf, "<img border=0 src=img/webstream.png width=16 height=16 alt=WebStream></a>", &maxlen, &pos);
|
---|
1517 | }
|
---|
1518 | }
|
---|
1519 | ostrcatbig(&buf, "</td>", &maxlen, &pos);
|
---|
1520 | ostrcatbig(&buf, "</tr>", &maxlen, &pos);
|
---|
1521 | }
|
---|
1522 |
|
---|
1523 | node = node->next;
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | if(maxcount > MAXHTMLLINE)
|
---|
1527 | {
|
---|
1528 | int i;
|
---|
1529 | ostrcatbig(&buf, "<tr><td align=center><br>", &maxlen, &pos);
|
---|
1530 | for(i = 1; i <= (int)ceil(((float)maxcount / MAXHTMLLINE)); i++)
|
---|
1531 | {
|
---|
1532 | if(page == i)
|
---|
1533 | {
|
---|
1534 | ostrcatbig(&buf, "<a class=pagesellink href=query?", &maxlen, &pos);
|
---|
1535 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
1536 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1537 | }
|
---|
1538 | else
|
---|
1539 | {
|
---|
1540 | ostrcatbig(&buf, "<a class=pagelink href=query?", &maxlen, &pos);
|
---|
1541 | ostrcatbig(&buf, link, &maxlen, &pos);
|
---|
1542 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1543 | }
|
---|
1544 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1545 | ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1546 |
|
---|
1547 | tmpnr = oitoa(i);
|
---|
1548 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1549 | ostrcatbig(&buf, ">", &maxlen, &pos);
|
---|
1550 | ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1551 | ostrcatbig(&buf, "</a>", &maxlen, &pos);
|
---|
1552 | free(tmpnr); tmpnr = NULL;
|
---|
1553 | }
|
---|
1554 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
1555 | }
|
---|
1556 |
|
---|
1557 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1558 | delmarkedscreennodes(webdir, FILELISTDELMARK);
|
---|
1559 | return buf;
|
---|
1560 | }
|
---|
1561 |
|
---|
1562 | char* webgetmovieepg(char* param, char* path, int flag)
|
---|
1563 | {
|
---|
1564 | char* buf = NULL, *tmpstr = NULL;
|
---|
1565 | char tstr[2];
|
---|
1566 | char c = 0;
|
---|
1567 | int first = 1, maxlen = 0, pos = 0;
|
---|
1568 | FILE* fd = NULL;
|
---|
1569 |
|
---|
1570 | webcreateheadbig(&buf, &maxlen, NULL, &pos, 0);
|
---|
1571 | ostrcatbig(&buf, "<tr><td><font class=biglabel>", &maxlen, &pos);
|
---|
1572 |
|
---|
1573 | if(flag == 1)
|
---|
1574 | {
|
---|
1575 | if(param != NULL && strstr(param, path) == param)
|
---|
1576 | {
|
---|
1577 | tmpstr = changefilenameext(param, ".epg");
|
---|
1578 | fd = fopen(tmpstr, "r");
|
---|
1579 | }
|
---|
1580 | }
|
---|
1581 | else
|
---|
1582 | {
|
---|
1583 | tmpstr = changefilenameext(param, ".epg");
|
---|
1584 | fd = fopen(tmpstr, "r");
|
---|
1585 | }
|
---|
1586 |
|
---|
1587 | if(fd != NULL)
|
---|
1588 | {
|
---|
1589 | while(c != EOF)
|
---|
1590 | {
|
---|
1591 | c = fgetc(fd);
|
---|
1592 | if(c == '\n')
|
---|
1593 | {
|
---|
1594 | if(first == 1)
|
---|
1595 | {
|
---|
1596 | ostrcatbig(&buf, "</font><br><font class=label>", &maxlen, &pos);
|
---|
1597 | first = 0;
|
---|
1598 | }
|
---|
1599 | ostrcatbig(&buf, "<br>", &maxlen, &pos);
|
---|
1600 | continue;
|
---|
1601 | }
|
---|
1602 | sprintf(tstr, "%c", c);
|
---|
1603 | ostrcatbig(&buf, tstr, &maxlen, &pos);
|
---|
1604 | }
|
---|
1605 | fclose(fd);
|
---|
1606 | }
|
---|
1607 | ostrcatbig(&buf, "</font></td></tr>", &maxlen, &pos);
|
---|
1608 |
|
---|
1609 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1610 |
|
---|
1611 | free(tmpstr); tmpstr = NULL;
|
---|
1612 | return buf;
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | char* webdelfile(char* param, char* link, char* dellink, char* path, char* mask, int flag)
|
---|
1616 | {
|
---|
1617 | char* buf = NULL, *param1 = NULL, *param2 = NULL, *tmpparam = NULL;
|
---|
1618 |
|
---|
1619 | if(param == NULL) return NULL;
|
---|
1620 |
|
---|
1621 | //create param1 + 2
|
---|
1622 | param1 = strchr(param, '&');
|
---|
1623 | if(param1 != NULL)
|
---|
1624 | {
|
---|
1625 | *param1++ = '\0';
|
---|
1626 | param2 = strchr(param1, '&');
|
---|
1627 | if(param2 != NULL)
|
---|
1628 | *param2++ = '\0';
|
---|
1629 | }
|
---|
1630 |
|
---|
1631 | if(param1 == NULL || param2 == NULL) return NULL;
|
---|
1632 |
|
---|
1633 | tmpparam = createpath(param, param2);
|
---|
1634 |
|
---|
1635 | if(checkbit(flag, 0) == 1)
|
---|
1636 | {
|
---|
1637 | if(tmpparam != NULL && strstr(tmpparam, path) == tmpparam)
|
---|
1638 | unlink(tmpparam);
|
---|
1639 | }
|
---|
1640 | else
|
---|
1641 | unlink(tmpparam);
|
---|
1642 |
|
---|
1643 | free(tmpparam); tmpparam = NULL;
|
---|
1644 | tmpparam = ostrcat(tmpparam, param, 1, 0);
|
---|
1645 | tmpparam = ostrcat(tmpparam, "&", 1, 0);
|
---|
1646 | tmpparam = ostrcat(tmpparam, param1, 1, 0);
|
---|
1647 |
|
---|
1648 | buf = webgetfilelist(tmpparam, link, dellink, path, mask, flag);
|
---|
1649 | free(tmpparam); tmpparam = NULL;
|
---|
1650 | return buf;
|
---|
1651 | }
|
---|
1652 |
|
---|
1653 | void websendrc(char* param)
|
---|
1654 | {
|
---|
1655 | int rccode = 0;
|
---|
1656 |
|
---|
1657 | rccode = getrcconfigint(param, NULL);
|
---|
1658 | writerc(rccode);
|
---|
1659 | }
|
---|
1660 |
|
---|
1661 | //flag 0: get aktiv timer
|
---|
1662 | //flag 1: get old timer
|
---|
1663 | char* webgetrectimer(char* param, int flag)
|
---|
1664 | {
|
---|
1665 | char* buf = NULL, *buf1 = NULL;
|
---|
1666 | struct rectimer* node = rectimer;
|
---|
1667 | struct channel* chnode = NULL;
|
---|
1668 | int line = 0, maxlen = 0, pos = 0;
|
---|
1669 | struct tm *loctime = NULL;
|
---|
1670 |
|
---|
1671 | buf1 = malloc(MINMALLOC);
|
---|
1672 | if(buf1 == NULL)
|
---|
1673 | {
|
---|
1674 | err("no mem");
|
---|
1675 | return NULL;
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | 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);
|
---|
1679 |
|
---|
1680 | while(node != NULL)
|
---|
1681 | {
|
---|
1682 | if((flag == 0 && (node->status == 2 || node->status == 3)) || (flag == 1 && (node->status == 0 || node->status == 1)))
|
---|
1683 | {
|
---|
1684 | node = node->next;
|
---|
1685 | continue;
|
---|
1686 | }
|
---|
1687 | if(line == 0)
|
---|
1688 | {
|
---|
1689 | ostrcatbig(&buf, "<tr class=line1><td>", &maxlen, &pos);
|
---|
1690 | line = 1;
|
---|
1691 | }
|
---|
1692 | else
|
---|
1693 | {
|
---|
1694 | ostrcatbig(&buf, "<tr class=line2><td>", &maxlen, &pos);
|
---|
1695 | line = 0;
|
---|
1696 | }
|
---|
1697 |
|
---|
1698 | loctime = olocaltime(&node->begin);
|
---|
1699 | if(loctime != NULL)
|
---|
1700 | strftime(buf1, MINMALLOC, "%d-%m-%Y %H:%M -", loctime);
|
---|
1701 | free(loctime); loctime = NULL;
|
---|
1702 | loctime = olocaltime(&node->end);
|
---|
1703 | if(loctime != NULL)
|
---|
1704 | strftime(&buf1[18], MINMALLOC - 19, " %H:%M ", loctime);
|
---|
1705 | free(loctime); loctime = NULL;
|
---|
1706 |
|
---|
1707 | ostrcatbig(&buf, "<font class=label1>", &maxlen, &pos);
|
---|
1708 | ostrcatbig(&buf, buf1, &maxlen, &pos);
|
---|
1709 |
|
---|
1710 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1711 | if(node->justplay == 0)
|
---|
1712 | ostrcatbig(&buf, "rec - ", &maxlen, &pos);
|
---|
1713 | else
|
---|
1714 | ostrcatbig(&buf, "switch - ", &maxlen, &pos);
|
---|
1715 | if(node->repeate == 0)
|
---|
1716 | ostrcatbig(&buf, "once", &maxlen, &pos);
|
---|
1717 | else
|
---|
1718 | ostrcatbig(&buf, "repeate", &maxlen, &pos);
|
---|
1719 |
|
---|
1720 | ostrcatbig(&buf, ")</font><br><font class=smalllabel1>", &maxlen, &pos);
|
---|
1721 | if(node->name == NULL || strlen(node->name) == 0)
|
---|
1722 | ostrcatbig(&buf, "---", &maxlen, &pos);
|
---|
1723 | else
|
---|
1724 | ostrcatbig(&buf, node->name, &maxlen, &pos);
|
---|
1725 |
|
---|
1726 | chnode = getchannel(node->serviceid, node->transponderid);
|
---|
1727 | if(chnode != NULL)
|
---|
1728 | {
|
---|
1729 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1730 | ostrcatbig(&buf, chnode->name, &maxlen, &pos);
|
---|
1731 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1732 | }
|
---|
1733 | ostrcatbig(&buf, "<br>", &maxlen, &pos);
|
---|
1734 |
|
---|
1735 | if(node->status == 0)
|
---|
1736 | ostrcatbig(&buf, "waiting", &maxlen, &pos);
|
---|
1737 | else if(node->status == 1)
|
---|
1738 | ostrcatbig(&buf, "running", &maxlen, &pos);
|
---|
1739 | else if(node->status == 2)
|
---|
1740 | ostrcatbig(&buf, "succes", &maxlen, &pos);
|
---|
1741 | else if(node->status == 3)
|
---|
1742 | {
|
---|
1743 | ostrcatbig(&buf, "error", &maxlen, &pos);
|
---|
1744 | if(node->errstr != NULL && strlen(node->errstr) > 0)
|
---|
1745 | {
|
---|
1746 | ostrcatbig(&buf, " (", &maxlen, &pos);
|
---|
1747 | ostrcatbig(&buf, node->errstr, &maxlen, &pos);
|
---|
1748 | ostrcatbig(&buf, ")", &maxlen, &pos);
|
---|
1749 | }
|
---|
1750 | }
|
---|
1751 |
|
---|
1752 | ostrcatbig(&buf, "</font>", &maxlen, &pos);
|
---|
1753 |
|
---|
1754 | if(flag == 0)
|
---|
1755 | {
|
---|
1756 | ostrcatbig(&buf, "</td><td width=40 align=right>", &maxlen, &pos);
|
---|
1757 |
|
---|
1758 | //edit png
|
---|
1759 | ostrcatbig(&buf, "<a target=main href=\"query?editrectimer", &maxlen, &pos);
|
---|
1760 | //ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1761 | ostrcatbig(&buf, "\">", &maxlen, &pos);
|
---|
1762 |
|
---|
1763 | ostrcatbig(&buf, "<img border=0 src=img/edit.png width=16 height=16 alt=\"Edit Timer\"></a>", &maxlen, &pos);
|
---|
1764 |
|
---|
1765 | //delete png
|
---|
1766 | ostrcatbig(&buf, "<img border=0 src=img/delete.png width=16 height=16 alt=Delete onclick='delquestion(\"", &maxlen, &pos);
|
---|
1767 | ostrcatbig(&buf, "query?delrectimer", &maxlen, &pos);
|
---|
1768 | //ostrcatbig(&buf, dellink, &maxlen, &pos);
|
---|
1769 | //ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1770 | //ostrcatbig(&buf, filelistpath->text, &maxlen, &pos);
|
---|
1771 | //ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1772 | //tmpnr = oitoa(page);
|
---|
1773 | //ostrcatbig(&buf, tmpnr, &maxlen, &pos);
|
---|
1774 | //free(tmpnr); tmpnr = NULL;
|
---|
1775 | //ostrcatbig(&buf, "&", &maxlen, &pos);
|
---|
1776 | //ostrcatbig(&buf, node->text, &maxlen, &pos);
|
---|
1777 | ostrcatbig(&buf, "\");'>", &maxlen, &pos);
|
---|
1778 | }
|
---|
1779 |
|
---|
1780 | ostrcatbig(&buf, "</td></tr>", &maxlen, &pos);
|
---|
1781 |
|
---|
1782 | node = node->next;
|
---|
1783 | }
|
---|
1784 |
|
---|
1785 | webcreatetailbig(&buf, &maxlen, &pos, 0);
|
---|
1786 |
|
---|
1787 | free(buf1);
|
---|
1788 | return buf;
|
---|
1789 | }
|
---|
1790 |
|
---|
1791 | char* webaddrectimer(char* param)
|
---|
1792 | {
|
---|
1793 | char* buf = NULL;
|
---|
1794 | int maxlen = 0, pos = 0;
|
---|
1795 |
|
---|
1796 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1797 | return buf;
|
---|
1798 | }
|
---|
1799 |
|
---|
1800 | char* webeditrectimer(char* param)
|
---|
1801 | {
|
---|
1802 | char* buf = NULL;
|
---|
1803 | int maxlen = 0, pos = 0;
|
---|
1804 |
|
---|
1805 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1806 | return buf;
|
---|
1807 | }
|
---|
1808 |
|
---|
1809 | char* webdelrectimer(char* param)
|
---|
1810 | {
|
---|
1811 | char* buf = NULL;
|
---|
1812 | int maxlen = 0, pos = 0;
|
---|
1813 |
|
---|
1814 | ostrcatbig(&buf, param, &maxlen, &pos);
|
---|
1815 | return buf;
|
---|
1816 | }
|
---|
1817 |
|
---|
1818 | void putxmessage(struct stimerthread* timernode, char* captiontime, char* body)
|
---|
1819 | {
|
---|
1820 | struct splitstr* ret1 = NULL;
|
---|
1821 | char* caption = NULL;
|
---|
1822 | int count1 = 0;
|
---|
1823 | int timeout = 0;
|
---|
1824 | ret1 = strsplit(captiontime, "\t", &count1);
|
---|
1825 | caption = ostrcat(caption, (&ret1[0])->part, 1, 0);
|
---|
1826 | timeout = atoi((&ret1[1])->part);
|
---|
1827 | textbox(caption, body, _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 280, timeout, 0);
|
---|
1828 | free(caption); free(body); free(captiontime); free(ret1);
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 | void xmessage(char* filename)
|
---|
1832 | {
|
---|
1833 | char* param=NULL, *param1 = NULL, *param2 = NULL, *param3 = NULL, *param4 = NULL;
|
---|
1834 | char* caption=NULL, *body=NULL;
|
---|
1835 | char* timeout=NULL;
|
---|
1836 | param4 = strstr(filename, "icon=");
|
---|
1837 | param3 = strstr(filename, "charset=");
|
---|
1838 | param2 = strstr(filename, "timeout=");
|
---|
1839 | param1 = strstr(filename, "caption=");
|
---|
1840 | param = strstr(filename, "body=");
|
---|
1841 |
|
---|
1842 | if(param4 != NULL) {
|
---|
1843 | param4 = param4 - 1;
|
---|
1844 | *param4 = '\0';
|
---|
1845 | param4 = param4 + 5;
|
---|
1846 | *param4++ = '\0';
|
---|
1847 | }
|
---|
1848 | if(param3 != NULL) {
|
---|
1849 | param3 = param3 - 1;
|
---|
1850 | *param3 = '\0';
|
---|
1851 | param3 = param3 + 8;
|
---|
1852 | *param3++ = '\0';
|
---|
1853 | }
|
---|
1854 | if(param2 != NULL) {
|
---|
1855 | param2 = param2 - 1;
|
---|
1856 | *param2 = '\0';
|
---|
1857 | param2 = param2 + 8;
|
---|
1858 | *param2++ = '\0';
|
---|
1859 | }
|
---|
1860 | if(param1 != NULL) {
|
---|
1861 | param1 = param1 - 1;
|
---|
1862 | *param1 = '\0';
|
---|
1863 | param1 = param1 + 8;
|
---|
1864 | *param1++ = '\0';
|
---|
1865 | }
|
---|
1866 | if(param != NULL) {
|
---|
1867 | param = param - 1;
|
---|
1868 | *param = '\0';
|
---|
1869 | param = param + 5;
|
---|
1870 | *param++ = '\0';
|
---|
1871 | body=ostrcat(body, param, 1, 0);
|
---|
1872 | }
|
---|
1873 | else
|
---|
1874 | body=ostrcat(body, " ", 1, 0);
|
---|
1875 |
|
---|
1876 | if(param2 != NULL)
|
---|
1877 | timeout = ostrcat(timeout, param2, 1, 0);
|
---|
1878 | else
|
---|
1879 | timeout = ostrcat(timeout, "5", 1, 0);
|
---|
1880 |
|
---|
1881 | if(param1 != NULL)
|
---|
1882 | caption = ostrcat(caption, param1, 1, 0);
|
---|
1883 | else
|
---|
1884 | caption = ostrcat(caption, "XMESSAGE", 1, 0);
|
---|
1885 |
|
---|
1886 | caption = ostrcat(caption, "\t", 1, 0);
|
---|
1887 | caption = ostrcat(caption, timeout, 1, 0);
|
---|
1888 |
|
---|
1889 | //addtimer(&putxmessage, START, 1000, 1, (void*)caption, (void*)body, (void*)timeout);
|
---|
1890 | addtimer(&putxmessage, START, 1000, 1,(void*)caption, (void*)body, NULL);
|
---|
1891 | return;
|
---|
1892 | }
|
---|
1893 |
|
---|
1894 | #endif
|
---|