1 | #ifndef SKINFUNC_H |
---|
2 | #define SKINFUNC_H |
---|
3 | |
---|
4 | char* getplaytext(struct skin* node, char* path) |
---|
5 | { |
---|
6 | char* tmpstr = NULL; |
---|
7 | |
---|
8 | if(status.pause > 0 && status.slowspeed == 0) |
---|
9 | tmpstr = ostrcat("Pause", NULL, 0, 0); |
---|
10 | else if(status.play > 0) |
---|
11 | tmpstr = ostrcat("Play", NULL, 0, 0); |
---|
12 | else if(status.playspeed == 1) |
---|
13 | tmpstr = ostrcat(">> 2x", NULL, 0, 0); |
---|
14 | else if(status.playspeed == 2) |
---|
15 | tmpstr = ostrcat(">> 4x", NULL, 0, 0); |
---|
16 | else if(status.playspeed == 3) |
---|
17 | tmpstr = ostrcat(">> 8x", NULL, 0, 0); |
---|
18 | else if(status.playspeed == 4) |
---|
19 | tmpstr = ostrcat(">> 16x", NULL, 0, 0); |
---|
20 | else if(status.playspeed == 5) |
---|
21 | tmpstr = ostrcat(">> 32x", NULL, 0, 0); |
---|
22 | else if(status.playspeed == 6) |
---|
23 | tmpstr = ostrcat(">> 64x", NULL, 0, 0); |
---|
24 | else if(status.playspeed == 7) |
---|
25 | tmpstr = ostrcat(">> 128x", NULL, 0, 0); |
---|
26 | else if(status.playspeed == -1) |
---|
27 | tmpstr = ostrcat("<< 2x", NULL, 0, 0); |
---|
28 | else if(status.playspeed == -2) |
---|
29 | tmpstr = ostrcat("<< 4x", NULL, 0, 0); |
---|
30 | else if(status.playspeed == -3) |
---|
31 | tmpstr = ostrcat("<< 8x", NULL, 0, 0); |
---|
32 | else if(status.playspeed == -4) |
---|
33 | tmpstr = ostrcat("<< 16x", NULL, 0, 0); |
---|
34 | else if(status.playspeed == -5) |
---|
35 | tmpstr = ostrcat("<< 32x", NULL, 0, 0); |
---|
36 | else if(status.playspeed == -6) |
---|
37 | tmpstr = ostrcat("<< 64x", NULL, 0, 0); |
---|
38 | else if(status.playspeed == -7) |
---|
39 | tmpstr = ostrcat("<< 128x", NULL, 0, 0); |
---|
40 | else if(status.slowspeed == 1) |
---|
41 | tmpstr = ostrcat("|| 2x", NULL, 0, 0); |
---|
42 | else if(status.slowspeed == 2) |
---|
43 | tmpstr = ostrcat("|| 4x", NULL, 0, 0); |
---|
44 | else if(status.slowspeed == 3) |
---|
45 | tmpstr = ostrcat("|| 8x", NULL, 0, 0); |
---|
46 | else if(status.slowspeed == 4) |
---|
47 | tmpstr = ostrcat("|| 16x", NULL, 0, 0); |
---|
48 | else if(status.slowspeed == 5) |
---|
49 | tmpstr = ostrcat("|| 32x", NULL, 0, 0); |
---|
50 | else if(status.slowspeed == 6) |
---|
51 | tmpstr = ostrcat("|| 64x", NULL, 0, 0); |
---|
52 | else if(status.slowspeed == 7) |
---|
53 | tmpstr = ostrcat("|| 128x", NULL, 0, 0); |
---|
54 | |
---|
55 | return tmpstr; |
---|
56 | } |
---|
57 | |
---|
58 | char* getplaypic(struct skin* node, char* path) |
---|
59 | { |
---|
60 | char* tmpstr = NULL; |
---|
61 | |
---|
62 | if(status.pause > 0 && status.slowspeed == 0) |
---|
63 | tmpstr = ostrcat("pause.png", NULL, 0, 0); |
---|
64 | else if(status.play > 0) |
---|
65 | tmpstr = ostrcat("play.png", NULL, 0, 0); |
---|
66 | else if(status.playspeed == 1) |
---|
67 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
68 | else if(status.playspeed == 2) |
---|
69 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
70 | else if(status.playspeed == 3) |
---|
71 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
72 | else if(status.playspeed == 4) |
---|
73 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
74 | else if(status.playspeed == 5) |
---|
75 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
76 | else if(status.playspeed == 6) |
---|
77 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
78 | else if(status.playspeed == 7) |
---|
79 | tmpstr = ostrcat("forward1.png", NULL, 0, 0); |
---|
80 | else if(status.playspeed == -1) |
---|
81 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
82 | else if(status.playspeed == -2) |
---|
83 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
84 | else if(status.playspeed == -3) |
---|
85 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
86 | else if(status.playspeed == -4) |
---|
87 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
88 | else if(status.playspeed == -5) |
---|
89 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
90 | else if(status.playspeed == -6) |
---|
91 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
92 | else if(status.playspeed == -7) |
---|
93 | tmpstr = ostrcat("rewind1.png", NULL, 0, 0); |
---|
94 | else if(status.slowspeed == 1) |
---|
95 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
96 | else if(status.slowspeed == 2) |
---|
97 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
98 | else if(status.slowspeed == 3) |
---|
99 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
100 | else if(status.slowspeed == 4) |
---|
101 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
102 | else if(status.slowspeed == 5) |
---|
103 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
104 | else if(status.slowspeed == 6) |
---|
105 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
106 | else if(status.slowspeed == 7) |
---|
107 | tmpstr = ostrcat("slow1.png", NULL, 0, 0); |
---|
108 | |
---|
109 | if(tmpstr != NULL) |
---|
110 | { |
---|
111 | if(path != NULL && tmpstr != NULL) |
---|
112 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
113 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
114 | } |
---|
115 | |
---|
116 | return tmpstr; |
---|
117 | } |
---|
118 | |
---|
119 | char* getreccount(struct skin* node) |
---|
120 | { |
---|
121 | char* tmpstr = NULL; |
---|
122 | |
---|
123 | if(status.recording > 0) |
---|
124 | tmpstr = oitoa(status.recording); |
---|
125 | |
---|
126 | return tmpstr; |
---|
127 | } |
---|
128 | |
---|
129 | char* getrec(struct skin* node, char* path) |
---|
130 | { |
---|
131 | char* tmpstr = NULL; |
---|
132 | |
---|
133 | if(status.recording > 0) |
---|
134 | { |
---|
135 | tmpstr = ostrcat("rec.png", NULL, 0, 0); |
---|
136 | |
---|
137 | if(path != NULL) |
---|
138 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
139 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
140 | } |
---|
141 | |
---|
142 | return tmpstr; |
---|
143 | } |
---|
144 | |
---|
145 | #ifdef MIPSEL |
---|
146 | ///rec png |
---|
147 | char* getoledrec(struct skin* node, char* path) |
---|
148 | { |
---|
149 | char* tmpstr = NULL; |
---|
150 | |
---|
151 | if(status.recording > 0) |
---|
152 | { |
---|
153 | tmpstr = ostrcat("oled_rec.png", NULL, 0, 0); |
---|
154 | |
---|
155 | if(path != NULL) |
---|
156 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
157 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
158 | } |
---|
159 | |
---|
160 | return tmpstr; |
---|
161 | } |
---|
162 | ///mute png |
---|
163 | char* getoledmute(struct skin* node, char* path) |
---|
164 | { |
---|
165 | char* tmpstr = NULL; |
---|
166 | |
---|
167 | if(status.mute > 0) |
---|
168 | { |
---|
169 | tmpstr = ostrcat("oled_mute.png", NULL, 0, 0); |
---|
170 | |
---|
171 | if(path != NULL) |
---|
172 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
173 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
174 | } |
---|
175 | |
---|
176 | return tmpstr; |
---|
177 | } |
---|
178 | |
---|
179 | ///timeshift png |
---|
180 | char* getoledtimeshift(struct skin* node, char* path) |
---|
181 | { |
---|
182 | char* tmpstr = NULL; |
---|
183 | |
---|
184 | if(status.timeshift > 0) |
---|
185 | { |
---|
186 | tmpstr = ostrcat("oled_timeshift.png", NULL, 0, 0); |
---|
187 | |
---|
188 | if(path != NULL) |
---|
189 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
190 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
191 | } |
---|
192 | |
---|
193 | return tmpstr; |
---|
194 | } |
---|
195 | |
---|
196 | #endif |
---|
197 | |
---|
198 | |
---|
199 | char* getcrypt(struct skin* node, char* path) |
---|
200 | { |
---|
201 | char* tmpstr = NULL; |
---|
202 | |
---|
203 | if(status.aktservice->channel != NULL) |
---|
204 | { |
---|
205 | if(status.aktservice->channel->crypt > 0) |
---|
206 | tmpstr = ostrcat("crypt.png", NULL, 0, 0); |
---|
207 | else |
---|
208 | tmpstr = ostrcat("nocrypt.png", NULL, 0, 0); |
---|
209 | |
---|
210 | if(path != NULL) |
---|
211 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
212 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
213 | } |
---|
214 | |
---|
215 | return tmpstr; |
---|
216 | } |
---|
217 | |
---|
218 | char* getaspectmode(struct skin* node, char* path) |
---|
219 | { |
---|
220 | char* tmpstr = NULL; |
---|
221 | |
---|
222 | tmpstr = getaspect(); |
---|
223 | if(ostrcmp(tmpstr, "4:3") == 0) |
---|
224 | { |
---|
225 | free(tmpstr); tmpstr = NULL; |
---|
226 | tmpstr = ostrcat(tmpstr, "4_3.png", 1, 0); |
---|
227 | } |
---|
228 | if(ostrcmp(tmpstr, "16:9") == 0) |
---|
229 | { |
---|
230 | free(tmpstr); tmpstr = NULL; |
---|
231 | tmpstr = ostrcat(tmpstr, "16_9.png", 1, 0); |
---|
232 | } |
---|
233 | |
---|
234 | if(path != NULL) |
---|
235 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
236 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
237 | |
---|
238 | return tmpstr; |
---|
239 | } |
---|
240 | |
---|
241 | char* getsdhd(struct skin* node, char* path) |
---|
242 | { |
---|
243 | char* tmpstr = NULL; |
---|
244 | |
---|
245 | videoreadqwidth(status.aktservice->videodev); |
---|
246 | |
---|
247 | if(getaktvideosize() == 0) //videosize is ok |
---|
248 | { |
---|
249 | if(status.videosize.w == 720) |
---|
250 | tmpstr = ostrcat("sd.png", NULL, 0, 0); |
---|
251 | else if(status.videosize.w == 1280) |
---|
252 | tmpstr = ostrcat("hdready.png", NULL, 0, 0); |
---|
253 | else if(status.videosize.w == 1920) |
---|
254 | tmpstr = ostrcat("hd.png", NULL, 0, 0); |
---|
255 | } |
---|
256 | |
---|
257 | if(tmpstr == NULL) tmpstr = ostrcat("novideo.png", NULL, 0, 0); |
---|
258 | |
---|
259 | if(path != NULL) |
---|
260 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
261 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
262 | |
---|
263 | return tmpstr; |
---|
264 | } |
---|
265 | |
---|
266 | char* getresolution(struct skin* node, char* path) |
---|
267 | { |
---|
268 | char* tmpstr = NULL; |
---|
269 | |
---|
270 | if(fb->width == 720 && fb->height == 576) |
---|
271 | tmpstr = ostrcat("576.png", NULL, 0, 0); |
---|
272 | else if(fb->width == 1280 && fb->height == 720) |
---|
273 | tmpstr = ostrcat("720.png", NULL, 0, 0); |
---|
274 | else if(fb->width == 1920 && fb->height == 1080) |
---|
275 | tmpstr = ostrcat("1080.png", NULL, 0, 0); |
---|
276 | |
---|
277 | if(path != NULL) |
---|
278 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
279 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
280 | |
---|
281 | return tmpstr; |
---|
282 | } |
---|
283 | |
---|
284 | char* getteletext(struct skin* node, char* path) |
---|
285 | { |
---|
286 | char* tmpstr = NULL; |
---|
287 | |
---|
288 | if(status.aktservice->channel != NULL) |
---|
289 | { |
---|
290 | if(status.aktservice->channel->txtpid > 0) |
---|
291 | tmpstr = ostrcat("teletext.png", NULL, 0, 0); |
---|
292 | else |
---|
293 | tmpstr = ostrcat("noteletext.png", NULL, 0, 0); |
---|
294 | |
---|
295 | if(path != NULL) |
---|
296 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
297 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
298 | } |
---|
299 | |
---|
300 | return tmpstr; |
---|
301 | } |
---|
302 | |
---|
303 | char* getsoundtype(struct skin* node, char* path) |
---|
304 | { |
---|
305 | char* tmpstr = NULL; |
---|
306 | |
---|
307 | if(status.aktservice->channel != NULL) |
---|
308 | { |
---|
309 | switch(status.aktservice->channel->audiocodec) |
---|
310 | { |
---|
311 | case AC3: |
---|
312 | tmpstr = ostrcat("ac3.png", NULL, 0, 0); |
---|
313 | break; |
---|
314 | case MPEGA: |
---|
315 | tmpstr = ostrcat("mpega.png", NULL, 0, 0); |
---|
316 | break; |
---|
317 | case DTS: |
---|
318 | tmpstr = ostrcat("dts.png", NULL, 0, 0); |
---|
319 | break; |
---|
320 | case LPCM: |
---|
321 | tmpstr = ostrcat("lpcm.png", NULL, 0, 0); |
---|
322 | break; |
---|
323 | case AAC: |
---|
324 | tmpstr = ostrcat("aac.png", NULL, 0, 0); |
---|
325 | break; |
---|
326 | case AACHE: |
---|
327 | tmpstr = ostrcat("aache.png", NULL, 0, 0); |
---|
328 | break; |
---|
329 | } |
---|
330 | if(path != NULL) |
---|
331 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
332 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
333 | } |
---|
334 | |
---|
335 | return tmpstr; |
---|
336 | } |
---|
337 | |
---|
338 | char* getprovidername(struct skin* node) |
---|
339 | { |
---|
340 | char* tmpstr = NULL; |
---|
341 | |
---|
342 | if(status.aktservice->channel != NULL && status.aktservice->channel->provider != NULL) |
---|
343 | tmpstr = ostrcat(status.aktservice->channel->provider->name, NULL, 0, 0); |
---|
344 | |
---|
345 | return tmpstr; |
---|
346 | } |
---|
347 | |
---|
348 | char* getsatname(struct skin* node) |
---|
349 | { |
---|
350 | struct sat* satnode = NULL; |
---|
351 | char* tmpstr = NULL; |
---|
352 | |
---|
353 | if(status.aktservice->channel != NULL && status.aktservice->channel->transponder != NULL) |
---|
354 | { |
---|
355 | satnode = getsatbyorbitalpos(status.aktservice->channel->transponder->orbitalpos); |
---|
356 | if(satnode != NULL) |
---|
357 | tmpstr = ostrcat(satnode->name, NULL, 0, 0); |
---|
358 | } |
---|
359 | |
---|
360 | return tmpstr; |
---|
361 | } |
---|
362 | |
---|
363 | char* getber(struct skin* node, char* format) |
---|
364 | { |
---|
365 | uint32_t ber = 0; |
---|
366 | char* buf = NULL, *buf1 = NULL; |
---|
367 | |
---|
368 | ber = fereadber(status.aktservice->fedev); |
---|
369 | |
---|
370 | buf = malloc(MINMALLOC); |
---|
371 | if(buf == NULL) |
---|
372 | { |
---|
373 | err("no mem"); |
---|
374 | return NULL; |
---|
375 | } |
---|
376 | |
---|
377 | snprintf(buf, MINMALLOC, format, ber); |
---|
378 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
379 | |
---|
380 | return buf1; |
---|
381 | } |
---|
382 | |
---|
383 | char* getsignal(struct skin* node, char* format) |
---|
384 | { |
---|
385 | uint16_t signal = 0; |
---|
386 | char* buf = NULL, *buf1 = NULL; |
---|
387 | |
---|
388 | signal = fereadsignalstrength(status.aktservice->fedev); |
---|
389 | signal = (signal * 100) / 0xffff; |
---|
390 | |
---|
391 | buf = malloc(MINMALLOC); |
---|
392 | if(buf == NULL) |
---|
393 | { |
---|
394 | err("no mem"); |
---|
395 | return NULL; |
---|
396 | } |
---|
397 | |
---|
398 | snprintf(buf, MINMALLOC, format, signal); |
---|
399 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
400 | |
---|
401 | return buf1; |
---|
402 | } |
---|
403 | |
---|
404 | char* getunc(struct skin* node, char* format) |
---|
405 | { |
---|
406 | uint32_t unc = 0; |
---|
407 | char* buf = NULL, *buf1 = NULL; |
---|
408 | |
---|
409 | unc = fereaduncorrectedblocks(status.aktservice->fedev); |
---|
410 | |
---|
411 | buf = malloc(MINMALLOC); |
---|
412 | if(buf == NULL) |
---|
413 | { |
---|
414 | err("no mem"); |
---|
415 | return NULL; |
---|
416 | } |
---|
417 | |
---|
418 | snprintf(buf, MINMALLOC, format, unc); |
---|
419 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
420 | |
---|
421 | return buf1; |
---|
422 | } |
---|
423 | |
---|
424 | char* getsnr(struct skin* node, char* format) |
---|
425 | { |
---|
426 | uint16_t snr = 0; |
---|
427 | char* buf = NULL, *buf1 = NULL; |
---|
428 | |
---|
429 | |
---|
430 | snr = fereadsnr(status.aktservice->fedev); |
---|
431 | snr = (snr * 100) / 0xffff; |
---|
432 | |
---|
433 | buf = malloc(MINMALLOC); |
---|
434 | if(buf == NULL) |
---|
435 | { |
---|
436 | err("no mem"); |
---|
437 | return NULL; |
---|
438 | } |
---|
439 | |
---|
440 | snprintf(buf, MINMALLOC, format, snr); |
---|
441 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
442 | |
---|
443 | return buf1; |
---|
444 | } |
---|
445 | |
---|
446 | char* getepgtimeline(struct skin* node, int akt) |
---|
447 | { |
---|
448 | struct epg* epgnode = NULL; |
---|
449 | struct channel* chnode = NULL; |
---|
450 | char* tmpstr = NULL, *tmpnr = NULL; |
---|
451 | int proz = 0; |
---|
452 | |
---|
453 | if(akt == 0) chnode = status.markedchannel; |
---|
454 | if(akt == 1) chnode = status.aktservice->channel; |
---|
455 | if(akt == 2 && node != NULL) chnode = (struct channel*)node->handle; |
---|
456 | |
---|
457 | if(chnode != NULL) |
---|
458 | { |
---|
459 | epgnode = getepgakt(chnode); |
---|
460 | if(epgnode != NULL) |
---|
461 | { |
---|
462 | proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime); |
---|
463 | tmpnr = oitoa(proz); |
---|
464 | tmpstr = ostrcat(tmpstr, tmpnr, 1, 1); |
---|
465 | return tmpstr; |
---|
466 | } |
---|
467 | } |
---|
468 | return NULL; |
---|
469 | } |
---|
470 | |
---|
471 | char* getepgmarkedtimeline(struct skin* node) |
---|
472 | { |
---|
473 | return getepgtimeline(node, 0); |
---|
474 | } |
---|
475 | |
---|
476 | char* getepgakttimeline(struct skin* node) |
---|
477 | { |
---|
478 | return getepgtimeline(node, 1); |
---|
479 | } |
---|
480 | |
---|
481 | char* getepgchanneltimeline(struct skin* node) |
---|
482 | { |
---|
483 | return getepgtimeline(node, 2); |
---|
484 | } |
---|
485 | |
---|
486 | char* getaktchannelname(struct skin* node) |
---|
487 | { |
---|
488 | char* tmpstr = NULL; |
---|
489 | |
---|
490 | if(status.aktservice->channel != NULL) |
---|
491 | { |
---|
492 | tmpstr = ostrcat(tmpstr, status.aktservice->channel->name, 1, 0); |
---|
493 | return tmpstr; |
---|
494 | } |
---|
495 | return NULL; |
---|
496 | } |
---|
497 | |
---|
498 | char* getepgtime(struct skin* node, char* format, int akt, int type) |
---|
499 | { |
---|
500 | // akt 0 = marked channel |
---|
501 | // akt 1 = akt channel now |
---|
502 | // akt 2 = akt channel next |
---|
503 | |
---|
504 | // type 0 = starttime |
---|
505 | // type 1 = endtime |
---|
506 | // type 2 = remainingtime |
---|
507 | |
---|
508 | struct epg* epgnode = NULL; |
---|
509 | struct tm *loctime = NULL; |
---|
510 | struct channel* chnode = NULL; |
---|
511 | char *buf = NULL, *buf1 = NULL; |
---|
512 | time_t min = 0; |
---|
513 | |
---|
514 | if(format == NULL) |
---|
515 | { |
---|
516 | err("NULL detect"); |
---|
517 | return NULL; |
---|
518 | } |
---|
519 | |
---|
520 | if(akt == 0) chnode = status.markedchannel; |
---|
521 | if(akt == 1 || akt == 2) chnode = status.aktservice->channel; |
---|
522 | |
---|
523 | if(chnode != NULL) |
---|
524 | { |
---|
525 | epgnode = getepgakt(chnode); |
---|
526 | |
---|
527 | if(akt == 2) |
---|
528 | { |
---|
529 | if(epgnode != NULL) |
---|
530 | epgnode = epgnode->next; |
---|
531 | } |
---|
532 | |
---|
533 | if(epgnode != NULL) |
---|
534 | { |
---|
535 | if(type == 0) |
---|
536 | loctime = olocaltime(&epgnode->starttime); |
---|
537 | else if(type == 1) |
---|
538 | loctime = olocaltime(&epgnode->endtime); |
---|
539 | else if(type == 2) |
---|
540 | { |
---|
541 | if(akt == 1) |
---|
542 | min = ((epgnode->endtime - (epgnode->endtime % 60)) - (time(NULL) - (time(NULL) % 60))) / 60; |
---|
543 | else if(akt == 2) |
---|
544 | min = ((epgnode->endtime - (epgnode->endtime % 60)) - (epgnode->starttime - (epgnode->starttime % 60))) / 60; |
---|
545 | if(min < 0) min = 0; |
---|
546 | } |
---|
547 | |
---|
548 | buf = malloc(MINMALLOC); |
---|
549 | if(buf == NULL) |
---|
550 | { |
---|
551 | free(loctime); |
---|
552 | err("no memory"); |
---|
553 | return NULL; |
---|
554 | } |
---|
555 | |
---|
556 | if(type == 2) |
---|
557 | snprintf(buf, MINMALLOC, format, min); |
---|
558 | else if(loctime != NULL) |
---|
559 | ostrftime(buf, MINMALLOC, format, loctime); |
---|
560 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
561 | |
---|
562 | buf1 = translate_time(buf1, 0); |
---|
563 | |
---|
564 | free(loctime); loctime = NULL; |
---|
565 | return buf1; |
---|
566 | } |
---|
567 | } |
---|
568 | return NULL; |
---|
569 | } |
---|
570 | |
---|
571 | char* getepgakttimeremaining(struct skin* node, char* format) |
---|
572 | { |
---|
573 | return getepgtime(node, format, 1, 2); |
---|
574 | } |
---|
575 | |
---|
576 | char* getepgnexttimeremaining(struct skin* node, char* format) |
---|
577 | { |
---|
578 | return getepgtime(node, format, 2, 2); |
---|
579 | } |
---|
580 | |
---|
581 | char* getepgmarkedstart(struct skin* node, char* format) |
---|
582 | { |
---|
583 | return getepgtime(node, format, 0, 0); |
---|
584 | } |
---|
585 | |
---|
586 | char* getepgmarkedend(struct skin* node, char* format) |
---|
587 | { |
---|
588 | return getepgtime(node, format, 0, 1); |
---|
589 | } |
---|
590 | |
---|
591 | char* getepgaktstart(struct skin* node, char* format) |
---|
592 | { |
---|
593 | return getepgtime(node, format, 1, 0); |
---|
594 | } |
---|
595 | |
---|
596 | char* getepgaktend(struct skin* node, char* format) |
---|
597 | { |
---|
598 | return getepgtime(node, format, 1, 1); |
---|
599 | } |
---|
600 | |
---|
601 | char* getepgnextstart(struct skin* node, char* format) |
---|
602 | { |
---|
603 | return getepgtime(node, format, 2, 0); |
---|
604 | } |
---|
605 | |
---|
606 | char* getepgnextend(struct skin* node, char* format) |
---|
607 | { |
---|
608 | return getepgtime(node, format, 2, 1); |
---|
609 | } |
---|
610 | |
---|
611 | char* getepgaktsubtitle(struct skin* node) |
---|
612 | { |
---|
613 | struct epg* epgnode = NULL; |
---|
614 | char* tmpstr = NULL; |
---|
615 | |
---|
616 | epgnode = getepgakt(status.aktservice->channel); |
---|
617 | if(epgnode != NULL) |
---|
618 | { |
---|
619 | tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0); |
---|
620 | return tmpstr; |
---|
621 | } |
---|
622 | |
---|
623 | return NULL; |
---|
624 | } |
---|
625 | |
---|
626 | char* getepgakttitle(struct skin* node) |
---|
627 | { |
---|
628 | struct epg* epgnode = NULL; |
---|
629 | char* tmpstr = NULL; |
---|
630 | |
---|
631 | epgnode = getepgakt(status.aktservice->channel); |
---|
632 | if(epgnode != NULL) |
---|
633 | { |
---|
634 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
635 | return tmpstr; |
---|
636 | } |
---|
637 | |
---|
638 | return NULL; |
---|
639 | } |
---|
640 | |
---|
641 | char* getepgnexttitle(struct skin* node) |
---|
642 | { |
---|
643 | struct epg* epgnode = NULL; |
---|
644 | char* tmpstr = NULL; |
---|
645 | |
---|
646 | epgnode = getepgakt(status.aktservice->channel); |
---|
647 | if(epgnode != NULL) |
---|
648 | { |
---|
649 | epgnode = epgnode->next; |
---|
650 | if(epgnode != NULL) |
---|
651 | { |
---|
652 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
653 | return tmpstr; |
---|
654 | } |
---|
655 | } |
---|
656 | |
---|
657 | return NULL; |
---|
658 | } |
---|
659 | |
---|
660 | char* getepgaktdesc(struct skin* node) |
---|
661 | { |
---|
662 | struct epg* epgnode = NULL; |
---|
663 | |
---|
664 | if(status.aktservice->channel != NULL) |
---|
665 | { |
---|
666 | epgnode = getepgakt(status.aktservice->channel); |
---|
667 | if(epgnode != NULL) |
---|
668 | return epgdescunzip(epgnode); |
---|
669 | } |
---|
670 | |
---|
671 | return NULL; |
---|
672 | } |
---|
673 | |
---|
674 | char* getepgnextdesc(struct skin* node) |
---|
675 | { |
---|
676 | struct epg* epgnode = NULL; |
---|
677 | |
---|
678 | if(status.aktservice->channel != NULL) |
---|
679 | { |
---|
680 | epgnode = getepgakt(status.aktservice->channel); |
---|
681 | if(epgnode != NULL) |
---|
682 | { |
---|
683 | epgnode = epgnode->next; |
---|
684 | if(epgnode != NULL) |
---|
685 | return epgdescunzip(epgnode); |
---|
686 | } |
---|
687 | } |
---|
688 | |
---|
689 | return NULL; |
---|
690 | } |
---|
691 | |
---|
692 | char* getepgmarkeddesc(struct skin* node) |
---|
693 | { |
---|
694 | struct epg* epgnode = NULL; |
---|
695 | |
---|
696 | if(status.markedchannel != NULL) |
---|
697 | { |
---|
698 | epgnode = getepgakt(status.markedchannel); |
---|
699 | if(epgnode != NULL) |
---|
700 | return epgdescunzip(epgnode); |
---|
701 | } |
---|
702 | |
---|
703 | return NULL; |
---|
704 | } |
---|
705 | |
---|
706 | char* getepgmarkedlist(struct skin* node, char* ccount) |
---|
707 | { |
---|
708 | struct epg* epgnode = NULL; |
---|
709 | char* tmpstr = NULL, *buf = NULL; |
---|
710 | int count = atoi(ccount); |
---|
711 | struct tm* loctime = NULL; |
---|
712 | |
---|
713 | buf = malloc(MINMALLOC); |
---|
714 | if(buf == NULL) |
---|
715 | { |
---|
716 | err("no memory"); |
---|
717 | return NULL; |
---|
718 | } |
---|
719 | |
---|
720 | if(status.markedchannel != NULL) |
---|
721 | { |
---|
722 | epgnode = getepgakt(status.markedchannel); |
---|
723 | while(epgnode != NULL) |
---|
724 | { |
---|
725 | epgnode = epgnode->next; |
---|
726 | if(epgnode != NULL) |
---|
727 | { |
---|
728 | loctime = olocaltime(&epgnode->starttime); |
---|
729 | if(loctime != NULL) |
---|
730 | strftime(buf, MINMALLOC, "%H:%M", loctime); |
---|
731 | free(loctime); loctime = NULL; |
---|
732 | tmpstr = ostrcat(tmpstr, buf, 1, 0); |
---|
733 | tmpstr = ostrcat(tmpstr, " ", 1, 0); |
---|
734 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
735 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
736 | count--; |
---|
737 | } |
---|
738 | if(count < 1) break; |
---|
739 | } |
---|
740 | } |
---|
741 | |
---|
742 | free(buf); |
---|
743 | return tmpstr; |
---|
744 | } |
---|
745 | |
---|
746 | char* getepgpicon(struct skin* node) |
---|
747 | { |
---|
748 | char* tmpstr = NULL; |
---|
749 | |
---|
750 | if(status.epgchannel != NULL) |
---|
751 | tmpstr = createpiconpath(status.epgchannel, 0); |
---|
752 | return tmpstr; |
---|
753 | } |
---|
754 | |
---|
755 | char* getpicon(struct skin* node) |
---|
756 | { |
---|
757 | char* tmpstr = NULL; |
---|
758 | tmpstr = createpiconpath(status.aktservice->channel, 0); |
---|
759 | return tmpstr; |
---|
760 | } |
---|
761 | |
---|
762 | char* getalternatepicon(struct skin* node) |
---|
763 | { |
---|
764 | char* tmpstr = NULL; |
---|
765 | tmpstr = createpiconpath(status.aktservice->channel, 1); |
---|
766 | return tmpstr; |
---|
767 | } |
---|
768 | |
---|
769 | char* gettime(struct skin* node, char* format) |
---|
770 | { |
---|
771 | time_t sec; |
---|
772 | struct tm *loctime = NULL; |
---|
773 | char *buf = NULL, *buf1 = NULL; |
---|
774 | |
---|
775 | if(format == NULL) |
---|
776 | { |
---|
777 | err("NULL detect"); |
---|
778 | return NULL; |
---|
779 | } |
---|
780 | |
---|
781 | buf = malloc(MINMALLOC); |
---|
782 | if(buf == NULL) |
---|
783 | { |
---|
784 | err("no memory"); |
---|
785 | return NULL; |
---|
786 | } |
---|
787 | |
---|
788 | sec = time(NULL); |
---|
789 | loctime = olocaltime(&sec); |
---|
790 | |
---|
791 | if(loctime != NULL) |
---|
792 | { |
---|
793 | ostrftime(buf, MINMALLOC, format, loctime); |
---|
794 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
795 | } |
---|
796 | |
---|
797 | buf1 = translate_time(buf1, 1); |
---|
798 | |
---|
799 | free(loctime); |
---|
800 | return buf1; |
---|
801 | } |
---|
802 | |
---|
803 | char* getchannelnr(struct skin* node, struct channel* chnode) |
---|
804 | { |
---|
805 | char *tmpstr = NULL, *tmpnr = NULL; |
---|
806 | |
---|
807 | if(chnode == NULL) chnode = status.aktservice->channel; |
---|
808 | |
---|
809 | if(status.servicetype == 0) |
---|
810 | tmpstr = getconfig("channellist", NULL); |
---|
811 | else |
---|
812 | tmpstr = getconfig("rchannellist", NULL); |
---|
813 | if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10) |
---|
814 | { |
---|
815 | struct mainbouquet* mainbouquetnode = NULL; |
---|
816 | int count = 0; |
---|
817 | |
---|
818 | mainbouquetnode = getmainbouquet(tmpstr + 10); |
---|
819 | if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL) |
---|
820 | { |
---|
821 | struct bouquet* bnode = mainbouquetnode->bouquet; |
---|
822 | |
---|
823 | while(bnode != NULL) |
---|
824 | { |
---|
825 | if(bnode->channel == chnode) |
---|
826 | { |
---|
827 | tmpnr = oitoa(mainbouquetnode->bouquet->nr + count); |
---|
828 | return tmpnr; |
---|
829 | } |
---|
830 | count++; |
---|
831 | bnode = bnode->next; |
---|
832 | } |
---|
833 | } |
---|
834 | return tmpnr; |
---|
835 | } |
---|
836 | else |
---|
837 | return tmpnr; |
---|
838 | } |
---|
839 | |
---|
840 | char* getakttuner(struct skin* node) |
---|
841 | { |
---|
842 | char* tmpstr = NULL; |
---|
843 | |
---|
844 | if(status.aktservice->fedev != NULL) |
---|
845 | { |
---|
846 | tmpstr = oitoa(status.aktservice->fedev->devnr); |
---|
847 | return tmpstr; |
---|
848 | } |
---|
849 | |
---|
850 | return NULL; |
---|
851 | } |
---|
852 | |
---|
853 | char* getchannellistname(struct skin* node) |
---|
854 | { |
---|
855 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
856 | |
---|
857 | if(status.servicetype == 0) |
---|
858 | tmpstr = getconfig("channellist", NULL); |
---|
859 | else |
---|
860 | tmpstr = getconfig("rchannellist", NULL); |
---|
861 | |
---|
862 | if(tmpstr != NULL) |
---|
863 | { |
---|
864 | if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10) |
---|
865 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0); |
---|
866 | |
---|
867 | else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6) |
---|
868 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0); |
---|
869 | |
---|
870 | else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6) |
---|
871 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0); |
---|
872 | |
---|
873 | else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6) |
---|
874 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0); |
---|
875 | } |
---|
876 | |
---|
877 | return tmpstr1; |
---|
878 | } |
---|
879 | |
---|
880 | char* getpowerofftime(struct skin* node, char* format) |
---|
881 | { |
---|
882 | char* buf = NULL, *buf1 = NULL; |
---|
883 | int resttime = 0; |
---|
884 | |
---|
885 | if(format == NULL) return NULL; |
---|
886 | |
---|
887 | if(status.sd_timer != NULL && status.sd_timer->active) |
---|
888 | { |
---|
889 | buf = malloc(MINMALLOC); |
---|
890 | if(buf == NULL) |
---|
891 | { |
---|
892 | err("no mem"); |
---|
893 | return NULL; |
---|
894 | } |
---|
895 | |
---|
896 | resttime = (status.sd_timer->shutdown_time - time(NULL)) / 60; |
---|
897 | if(resttime < 0) resttime = 0; |
---|
898 | snprintf(buf, MINMALLOC, format, resttime); |
---|
899 | buf1 = ostrcat(buf, NULL, 1, 0); |
---|
900 | } |
---|
901 | |
---|
902 | return buf1; |
---|
903 | } |
---|
904 | |
---|
905 | char* gettvpic(struct skin* node, char* pos) |
---|
906 | { |
---|
907 | struct splitstr* ret = NULL; |
---|
908 | char* tmpstr = NULL; |
---|
909 | int count = 0, left = 0, top = 0, width = 0; |
---|
910 | |
---|
911 | if(pos != NULL) |
---|
912 | { |
---|
913 | tmpstr = ostrcat(pos, NULL, 0, 0); |
---|
914 | ret = strsplit(tmpstr, ":", &count); |
---|
915 | if(count == 3) |
---|
916 | { |
---|
917 | if((&ret[0])->part != NULL) |
---|
918 | left = atoi((&ret[0])->part); |
---|
919 | if((&ret[1])->part != NULL) |
---|
920 | top = atoi((&ret[1])->part); |
---|
921 | if((&ret[2])->part != NULL) |
---|
922 | width = atoi((&ret[2])->part); |
---|
923 | |
---|
924 | setvmpegrect(status.aktservice->videodev, left, top, width, 0); |
---|
925 | } |
---|
926 | free(tmpstr); tmpstr = NULL; |
---|
927 | } |
---|
928 | |
---|
929 | free(ret); ret = NULL; |
---|
930 | return NULL; |
---|
931 | } |
---|
932 | |
---|
933 | char* getrecfreesize(struct skin* node) |
---|
934 | { |
---|
935 | int ret = 0; |
---|
936 | |
---|
937 | if(status.showrecfreesize > 0) |
---|
938 | { |
---|
939 | unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
940 | unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
941 | |
---|
942 | if(full > 0 && full >= free) ret = ((full - free) * 100) / full; |
---|
943 | |
---|
944 | if(ret < 0) ret = 0; |
---|
945 | if(ret > 100) ret = 100; |
---|
946 | } |
---|
947 | |
---|
948 | return oitoa(ret); |
---|
949 | } |
---|
950 | |
---|
951 | char* getrecfreesizetext(struct skin* node) |
---|
952 | { |
---|
953 | int ret = 0; |
---|
954 | char* tmpstr = NULL; |
---|
955 | |
---|
956 | if(status.showrecfreesize > 0) |
---|
957 | { |
---|
958 | unsigned long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
959 | unsigned long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
960 | |
---|
961 | if(full > 0 && full >= free) ret = ((full - free) * 100) / full; |
---|
962 | |
---|
963 | if(ret < 0) ret = 0; |
---|
964 | if(ret > 100) ret = 100; |
---|
965 | |
---|
966 | if(status.showrecfreesize == 1) |
---|
967 | tmpstr = ostrcat(oitoa(ret), " %", 1, 0); |
---|
968 | else |
---|
969 | tmpstr = ostrcat(ollutoa(free), " MB", 1, 0); |
---|
970 | } |
---|
971 | |
---|
972 | return tmpstr; |
---|
973 | } |
---|
974 | |
---|
975 | char* gethbbtv(struct skin* node, char* path) |
---|
976 | { |
---|
977 | char* tmpstr = NULL; |
---|
978 | |
---|
979 | if(status.aktservice->channel != NULL) |
---|
980 | { |
---|
981 | if(status.aktservice->channel->hbbtvurl != NULL) |
---|
982 | tmpstr = ostrcat("hbbtv_on.png", "", 0, 0); |
---|
983 | else |
---|
984 | tmpstr = ostrcat("hbbtv_off.png", "", 0, 0); |
---|
985 | |
---|
986 | if(path != NULL) |
---|
987 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
988 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
989 | } |
---|
990 | |
---|
991 | return tmpstr; |
---|
992 | } |
---|
993 | |
---|
994 | char* getimgname(struct skin* node) |
---|
995 | { |
---|
996 | return getimgnamereal(); |
---|
997 | } |
---|
998 | |
---|
999 | char* getoscamcaid(struct skin* node) |
---|
1000 | { |
---|
1001 | char* buf = NULL, *tmpstr = NULL; |
---|
1002 | |
---|
1003 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1004 | tmpstr = ostrstr(buf, "caid:"); |
---|
1005 | if(tmpstr != NULL) |
---|
1006 | { |
---|
1007 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1008 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1009 | } |
---|
1010 | free(buf); buf = NULL; |
---|
1011 | |
---|
1012 | return tmpstr; |
---|
1013 | } |
---|
1014 | |
---|
1015 | char* getoscampid(struct skin* node) |
---|
1016 | { |
---|
1017 | char* buf = NULL, *tmpstr = NULL; |
---|
1018 | |
---|
1019 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1020 | tmpstr = ostrstr(buf, "pid:"); |
---|
1021 | if(tmpstr != NULL) |
---|
1022 | { |
---|
1023 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1024 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1025 | } |
---|
1026 | free(buf); buf = NULL; |
---|
1027 | |
---|
1028 | return tmpstr; |
---|
1029 | } |
---|
1030 | |
---|
1031 | char* getoscamprov(struct skin* node) |
---|
1032 | { |
---|
1033 | char* buf = NULL, *tmpstr = NULL; |
---|
1034 | |
---|
1035 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1036 | tmpstr = ostrstr(buf, "prov:"); |
---|
1037 | if(tmpstr != NULL) |
---|
1038 | { |
---|
1039 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1040 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1041 | } |
---|
1042 | free(buf); buf = NULL; |
---|
1043 | |
---|
1044 | return tmpstr; |
---|
1045 | } |
---|
1046 | |
---|
1047 | char* getoscamreader(struct skin* node) |
---|
1048 | { |
---|
1049 | char* buf = NULL, *tmpstr = NULL; |
---|
1050 | |
---|
1051 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1052 | tmpstr = ostrstr(buf, "reader:"); |
---|
1053 | if(tmpstr != NULL) |
---|
1054 | { |
---|
1055 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1056 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1057 | } |
---|
1058 | free(buf); buf = NULL; |
---|
1059 | |
---|
1060 | return tmpstr; |
---|
1061 | } |
---|
1062 | |
---|
1063 | char* getoscamfrom(struct skin* node) |
---|
1064 | { |
---|
1065 | char* buf = NULL, *tmpstr = NULL; |
---|
1066 | |
---|
1067 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1068 | tmpstr = ostrstr(buf, "from:"); |
---|
1069 | if(tmpstr != NULL) |
---|
1070 | { |
---|
1071 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1072 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1073 | } |
---|
1074 | free(buf); buf = NULL; |
---|
1075 | |
---|
1076 | return tmpstr; |
---|
1077 | } |
---|
1078 | |
---|
1079 | char* getoscamprotocol(struct skin* node) |
---|
1080 | { |
---|
1081 | char* buf = NULL, *tmpstr = NULL; |
---|
1082 | |
---|
1083 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1084 | tmpstr = ostrstr(buf, "protocol:"); |
---|
1085 | if(tmpstr != NULL) |
---|
1086 | { |
---|
1087 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1088 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1089 | } |
---|
1090 | free(buf); buf = NULL; |
---|
1091 | |
---|
1092 | return tmpstr; |
---|
1093 | } |
---|
1094 | |
---|
1095 | char* getoscamhops(struct skin* node) |
---|
1096 | { |
---|
1097 | char* buf = NULL, *tmpstr = NULL; |
---|
1098 | |
---|
1099 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1100 | tmpstr = ostrstr(buf, "hops:"); |
---|
1101 | if(tmpstr != NULL) |
---|
1102 | { |
---|
1103 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1104 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1105 | } |
---|
1106 | free(buf); buf = NULL; |
---|
1107 | |
---|
1108 | return tmpstr; |
---|
1109 | } |
---|
1110 | |
---|
1111 | char* getoscamecmtime(struct skin* node) |
---|
1112 | { |
---|
1113 | char* buf = NULL, *tmpstr = NULL; |
---|
1114 | |
---|
1115 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1116 | tmpstr = ostrstr(buf, "ecm time:"); |
---|
1117 | if(tmpstr != NULL) |
---|
1118 | { |
---|
1119 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1120 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1121 | } |
---|
1122 | free(buf); buf = NULL; |
---|
1123 | |
---|
1124 | return tmpstr; |
---|
1125 | } |
---|
1126 | |
---|
1127 | char* getoscamcw0(struct skin* node) |
---|
1128 | { |
---|
1129 | char* buf = NULL, *tmpstr = NULL; |
---|
1130 | |
---|
1131 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1132 | tmpstr = ostrstr(buf, "cw0:"); |
---|
1133 | if(tmpstr != NULL) |
---|
1134 | { |
---|
1135 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1136 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1137 | } |
---|
1138 | free(buf); buf = NULL; |
---|
1139 | |
---|
1140 | return tmpstr; |
---|
1141 | } |
---|
1142 | |
---|
1143 | char* getoscamcw1(struct skin* node) |
---|
1144 | { |
---|
1145 | char* buf = NULL, *tmpstr = NULL; |
---|
1146 | |
---|
1147 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1148 | tmpstr = ostrstr(buf, "cw1:"); |
---|
1149 | if(tmpstr != NULL) |
---|
1150 | { |
---|
1151 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1152 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1153 | } |
---|
1154 | free(buf); buf = NULL; |
---|
1155 | |
---|
1156 | return tmpstr; |
---|
1157 | } |
---|
1158 | |
---|
1159 | char* getoscamsystem(struct skin* node) |
---|
1160 | { |
---|
1161 | char* buf = NULL, *tmpstr = NULL; |
---|
1162 | |
---|
1163 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1164 | tmpstr = ostrstr(buf, "system:"); |
---|
1165 | if(tmpstr != NULL) |
---|
1166 | { |
---|
1167 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1168 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1169 | } |
---|
1170 | free(buf); buf = NULL; |
---|
1171 | |
---|
1172 | return tmpstr; |
---|
1173 | } |
---|
1174 | |
---|
1175 | char* getoscamsource(struct skin* node) |
---|
1176 | { |
---|
1177 | char* buf = NULL, *tmpstr = NULL; |
---|
1178 | |
---|
1179 | buf = readfiletomem("/tmp/ecm.info", 1); |
---|
1180 | tmpstr = ostrstr(buf, "source:"); |
---|
1181 | if(tmpstr != NULL) |
---|
1182 | { |
---|
1183 | tmpstr = stringreplacecharonce(tmpstr, '\n', '\0'); |
---|
1184 | tmpstr = ostrcat(tmpstr, NULL, 0, 0); |
---|
1185 | } |
---|
1186 | free(buf); buf = NULL; |
---|
1187 | |
---|
1188 | return tmpstr; |
---|
1189 | } |
---|
1190 | |
---|
1191 | char* getemu(struct skin* node) |
---|
1192 | { |
---|
1193 | char* tmpstr = NULL; |
---|
1194 | char* tmpstr1 = NULL; |
---|
1195 | tmpstr = string_newline(command("emu.sh infoname")); |
---|
1196 | |
---|
1197 | if(ostrstr(tmpstr, "not found") != NULL) |
---|
1198 | { |
---|
1199 | free(tmpstr); |
---|
1200 | tmpstr = NULL; |
---|
1201 | } |
---|
1202 | else |
---|
1203 | { |
---|
1204 | tmpstr1 = ostrcat(tmpstr, NULL, 0, 0); |
---|
1205 | free(tmpstr),tmpstr = NULL; |
---|
1206 | tmpstr = ostrcat("emu: ", tmpstr1, 0, 0); |
---|
1207 | free(tmpstr1),tmpstr1 = NULL; |
---|
1208 | } |
---|
1209 | return tmpstr; |
---|
1210 | } |
---|
1211 | |
---|
1212 | char* getbufferstatus(struct skin* node) |
---|
1213 | { |
---|
1214 | int ret = 0; |
---|
1215 | |
---|
1216 | #ifdef EPLAYER4 |
---|
1217 | /* |
---|
1218 | GstMessage *msg = NULL; |
---|
1219 | gint percent = 0; |
---|
1220 | gst_message_parse_buffering (msg, &percent); |
---|
1221 | g_print ("Buffering (%3d%%)\r", percent); |
---|
1222 | ret = (int)percent; |
---|
1223 | */ |
---|
1224 | ret = status.bufferpercent; |
---|
1225 | #else |
---|
1226 | int size = 0, status = 0; |
---|
1227 | size = playergetbuffersize(); |
---|
1228 | if(size > 0) |
---|
1229 | status = playergetbufferstatus(); |
---|
1230 | |
---|
1231 | if(size > 0 && size >= status) ret = 100 - (((size - status) * 100) / size); |
---|
1232 | #endif |
---|
1233 | |
---|
1234 | if(ret < 0) ret = 0; |
---|
1235 | if(ret > 100) ret = 100; |
---|
1236 | |
---|
1237 | return oitoa(ret); |
---|
1238 | } |
---|
1239 | |
---|
1240 | char* getwlanlinkquality(struct skin* node) |
---|
1241 | { |
---|
1242 | int quality = 0; |
---|
1243 | |
---|
1244 | quality = wlanlinkquality(); |
---|
1245 | |
---|
1246 | if(quality < 0) quality = 0; |
---|
1247 | if(quality > 100) quality = 100; |
---|
1248 | |
---|
1249 | return oitoa(quality); |
---|
1250 | } |
---|
1251 | |
---|
1252 | char* getwlanlinkqualitytext(struct skin* node) |
---|
1253 | { |
---|
1254 | int quality = 0; |
---|
1255 | char* tmpstr = NULL; |
---|
1256 | |
---|
1257 | quality = wlanlinkquality(); |
---|
1258 | |
---|
1259 | if(quality < 0) quality = 0; |
---|
1260 | if(quality > 100) quality = 100; |
---|
1261 | |
---|
1262 | tmpstr = ostrcat(oitoa(quality), " %", 1, 0); |
---|
1263 | |
---|
1264 | return tmpstr; |
---|
1265 | } |
---|
1266 | |
---|
1267 | #endif |
---|