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