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) |
---|
9 | tmpstr = ostrcat("Pause", "", 0, 0); |
---|
10 | else if(status.play > 0) |
---|
11 | tmpstr = ostrcat("Play", "", 0, 0); |
---|
12 | else if(status.playspeed == 1) |
---|
13 | tmpstr = ostrcat(">> 2x", "", 0, 0); |
---|
14 | else if(status.playspeed == 2) |
---|
15 | tmpstr = ostrcat(">> 4x", "", 0, 0); |
---|
16 | else if(status.playspeed == 3) |
---|
17 | tmpstr = ostrcat(">> 8x", "", 0, 0); |
---|
18 | else if(status.playspeed == 4) |
---|
19 | tmpstr = ostrcat(">> 16x", "", 0, 0); |
---|
20 | else if(status.playspeed == 5) |
---|
21 | tmpstr = ostrcat(">> 32x", "", 0, 0); |
---|
22 | else if(status.playspeed == 6) |
---|
23 | tmpstr = ostrcat(">> 64x", "", 0, 0); |
---|
24 | else if(status.playspeed == 7) |
---|
25 | tmpstr = ostrcat(">> 128x", "", 0, 0); |
---|
26 | else if(status.playspeed == -1) |
---|
27 | tmpstr = ostrcat("<< 2x", "", 0, 0); |
---|
28 | else if(status.playspeed == -2) |
---|
29 | tmpstr = ostrcat("<< 4x", "", 0, 0); |
---|
30 | else if(status.playspeed == -3) |
---|
31 | tmpstr = ostrcat("<< 8x", "", 0, 0); |
---|
32 | else if(status.playspeed == -4) |
---|
33 | tmpstr = ostrcat("<< 16x", "", 0, 0); |
---|
34 | else if(status.playspeed == -5) |
---|
35 | tmpstr = ostrcat("<< 32x", "", 0, 0); |
---|
36 | else if(status.playspeed == -6) |
---|
37 | tmpstr = ostrcat("<< 64x", "", 0, 0); |
---|
38 | else if(status.playspeed == -7) |
---|
39 | tmpstr = ostrcat("<< 128x", "", 0, 0); |
---|
40 | |
---|
41 | return tmpstr; |
---|
42 | } |
---|
43 | |
---|
44 | char* getplaypic(struct skin* node, char* path) |
---|
45 | { |
---|
46 | char* tmpstr = NULL; |
---|
47 | |
---|
48 | if(status.pause > 0) |
---|
49 | tmpstr = ostrcat("pause.png", "", 0, 0); |
---|
50 | else if(status.play > 0) |
---|
51 | tmpstr = ostrcat("play.png", "", 0, 0); |
---|
52 | else if(status.playspeed == 1) |
---|
53 | tmpstr = ostrcat("forward1.png", "", 0, 0); |
---|
54 | else if(status.playspeed == 2) |
---|
55 | tmpstr = ostrcat("forward2.png", "", 0, 0); |
---|
56 | else if(status.playspeed == 3) |
---|
57 | tmpstr = ostrcat("forward3.png", "", 0, 0); |
---|
58 | else if(status.playspeed == 4) |
---|
59 | tmpstr = ostrcat("forward4.png", "", 0, 0); |
---|
60 | else if(status.playspeed == 5) |
---|
61 | tmpstr = ostrcat("forward5.png", "", 0, 0); |
---|
62 | else if(status.playspeed == 6) |
---|
63 | tmpstr = ostrcat("forward6.png", "", 0, 0); |
---|
64 | else if(status.playspeed == 7) |
---|
65 | tmpstr = ostrcat("forward7.png", "", 0, 0); |
---|
66 | else if(status.playspeed == -1) |
---|
67 | tmpstr = ostrcat("rewind1.png", "", 0, 0); |
---|
68 | else if(status.playspeed == -2) |
---|
69 | tmpstr = ostrcat("rewind2.png", "", 0, 0); |
---|
70 | else if(status.playspeed == -3) |
---|
71 | tmpstr = ostrcat("rewind3.png", "", 0, 0); |
---|
72 | else if(status.playspeed == -4) |
---|
73 | tmpstr = ostrcat("rewind4.png", "", 0, 0); |
---|
74 | else if(status.playspeed == -5) |
---|
75 | tmpstr = ostrcat("rewind5.png", "", 0, 0); |
---|
76 | else if(status.playspeed == -6) |
---|
77 | tmpstr = ostrcat("rewind6.png", "", 0, 0); |
---|
78 | else if(status.playspeed == -7) |
---|
79 | tmpstr = ostrcat("rewind7.png", "", 0, 0); |
---|
80 | |
---|
81 | if(tmpstr != NULL) |
---|
82 | { |
---|
83 | if(path != NULL && tmpstr != NULL) |
---|
84 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
85 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
86 | } |
---|
87 | |
---|
88 | return tmpstr; |
---|
89 | } |
---|
90 | |
---|
91 | char* getreccount(struct skin* node) |
---|
92 | { |
---|
93 | char* tmpstr = NULL; |
---|
94 | |
---|
95 | if(status.recording > 0) |
---|
96 | tmpstr = oitoa(status.recording); |
---|
97 | |
---|
98 | return tmpstr; |
---|
99 | } |
---|
100 | |
---|
101 | char* getrec(struct skin* node, char* path) |
---|
102 | { |
---|
103 | char* tmpstr = NULL; |
---|
104 | |
---|
105 | if(status.recording > 0) |
---|
106 | { |
---|
107 | tmpstr = ostrcat("rec.png", "", 0, 0); |
---|
108 | |
---|
109 | if(path != NULL) |
---|
110 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
111 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
112 | } |
---|
113 | |
---|
114 | return tmpstr; |
---|
115 | } |
---|
116 | |
---|
117 | char* getcrypt(struct skin* node, char* path) |
---|
118 | { |
---|
119 | char* tmpstr = NULL; |
---|
120 | |
---|
121 | if(status.aktservice->channel != NULL) |
---|
122 | { |
---|
123 | if(status.aktservice->channel->crypt > 0) |
---|
124 | tmpstr = ostrcat("crypt.png", "", 0, 0); |
---|
125 | else |
---|
126 | tmpstr = ostrcat("nocrypt.png", "", 0, 0); |
---|
127 | |
---|
128 | if(path != NULL) |
---|
129 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
130 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
131 | } |
---|
132 | |
---|
133 | return tmpstr; |
---|
134 | } |
---|
135 | |
---|
136 | char* getaspectmode(struct skin* node, char* path) |
---|
137 | { |
---|
138 | char* tmpstr = NULL; |
---|
139 | |
---|
140 | tmpstr = getaspect(); |
---|
141 | if(ostrcmp(tmpstr, "4:3") == 0) |
---|
142 | { |
---|
143 | free(tmpstr); tmpstr = NULL; |
---|
144 | tmpstr = ostrcat(tmpstr, "4_3.png", 1, 0); |
---|
145 | } |
---|
146 | if(ostrcmp(tmpstr, "16:9") == 0) |
---|
147 | { |
---|
148 | free(tmpstr); tmpstr = NULL; |
---|
149 | tmpstr = ostrcat(tmpstr, "16_9.png", 1, 0); |
---|
150 | } |
---|
151 | |
---|
152 | if(path != NULL) |
---|
153 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
154 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
155 | |
---|
156 | return tmpstr; |
---|
157 | } |
---|
158 | |
---|
159 | char* getsdhd(struct skin* node, char* path) |
---|
160 | { |
---|
161 | char* tmpstr = NULL; |
---|
162 | |
---|
163 | videoreadqwidth(status.aktservice->videodev); |
---|
164 | |
---|
165 | if(getaktvideosize() == 0) //videosize is ok |
---|
166 | { |
---|
167 | if(status.videosize.w == 720) |
---|
168 | tmpstr = ostrcat("sd.png", "", 0, 0); |
---|
169 | else if(status.videosize.w == 1280) |
---|
170 | tmpstr = ostrcat("hdready.png", "", 0, 0); |
---|
171 | else if(status.videosize.w == 1920) |
---|
172 | tmpstr = ostrcat("hd.png", "", 0, 0); |
---|
173 | } |
---|
174 | |
---|
175 | if(tmpstr == NULL) tmpstr = ostrcat("novideo.png", "", 0, 0); |
---|
176 | |
---|
177 | if(path != NULL) |
---|
178 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
179 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
180 | |
---|
181 | return tmpstr; |
---|
182 | } |
---|
183 | |
---|
184 | char* getresolution(struct skin* node, char* path) |
---|
185 | { |
---|
186 | char* tmpstr = NULL; |
---|
187 | |
---|
188 | if(fb->width == 720 && fb->height == 576) |
---|
189 | tmpstr = ostrcat("576.png", "", 0, 0); |
---|
190 | else if(fb->width == 1280 && fb->height == 720) |
---|
191 | tmpstr = ostrcat("720.png", "", 0, 0); |
---|
192 | else if(fb->width == 1920 && fb->height == 1080) |
---|
193 | tmpstr = ostrcat("1080.png", "", 0, 0); |
---|
194 | |
---|
195 | if(path != NULL) |
---|
196 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
197 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
198 | |
---|
199 | return tmpstr; |
---|
200 | } |
---|
201 | |
---|
202 | char* getteletext(struct skin* node, char* path) |
---|
203 | { |
---|
204 | char* tmpstr = NULL; |
---|
205 | |
---|
206 | if(status.aktservice->channel != NULL) |
---|
207 | { |
---|
208 | if(status.aktservice->channel->txtpid > 0) |
---|
209 | tmpstr = ostrcat("teletext.png", "", 0, 0); |
---|
210 | else |
---|
211 | tmpstr = ostrcat("noteletext.png", "", 0, 0); |
---|
212 | |
---|
213 | if(path != NULL) |
---|
214 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
215 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
216 | } |
---|
217 | |
---|
218 | return tmpstr; |
---|
219 | } |
---|
220 | |
---|
221 | char* getsoundtype(struct skin* node, char* path) |
---|
222 | { |
---|
223 | char* tmpstr = NULL; |
---|
224 | |
---|
225 | if(status.aktservice->channel != NULL) |
---|
226 | { |
---|
227 | switch(status.aktservice->channel->audiocodec) |
---|
228 | { |
---|
229 | case AC3: |
---|
230 | tmpstr = ostrcat("ac3.png", "", 0, 0); |
---|
231 | break; |
---|
232 | case MPEGA: |
---|
233 | tmpstr = ostrcat("mpega.png", "", 0, 0); |
---|
234 | break; |
---|
235 | case DTS: |
---|
236 | tmpstr = ostrcat("dts.png", "", 0, 0); |
---|
237 | break; |
---|
238 | case LPCM: |
---|
239 | tmpstr = ostrcat("lpcm.png", "", 0, 0); |
---|
240 | break; |
---|
241 | case AAC: |
---|
242 | tmpstr = ostrcat("aac.png", "", 0, 0); |
---|
243 | break; |
---|
244 | case AACHE: |
---|
245 | tmpstr = ostrcat("aache.png", "", 0, 0); |
---|
246 | break; |
---|
247 | } |
---|
248 | if(path != NULL) |
---|
249 | tmpstr = ostrcat("/", tmpstr, 0, 1); |
---|
250 | tmpstr = ostrcat(path, tmpstr, 0, 1); |
---|
251 | } |
---|
252 | |
---|
253 | return tmpstr; |
---|
254 | } |
---|
255 | |
---|
256 | char* getprovidername(struct skin* node) |
---|
257 | { |
---|
258 | char* tmpstr = NULL; |
---|
259 | |
---|
260 | if(status.aktservice->channel != NULL && status.aktservice->channel->provider != NULL) |
---|
261 | tmpstr = ostrcat(status.aktservice->channel->provider->name, "", 0, 0); |
---|
262 | |
---|
263 | return tmpstr; |
---|
264 | } |
---|
265 | |
---|
266 | char* getsatname(struct skin* node) |
---|
267 | { |
---|
268 | struct sat* satnode = NULL; |
---|
269 | char* tmpstr = NULL; |
---|
270 | |
---|
271 | if(status.aktservice->channel != NULL && status.aktservice->channel->transponder != NULL) |
---|
272 | { |
---|
273 | satnode = getsatbyorbitalpos(status.aktservice->channel->transponder->orbitalpos); |
---|
274 | if(satnode != NULL) |
---|
275 | tmpstr = ostrcat(satnode->name, "", 0, 0); |
---|
276 | } |
---|
277 | |
---|
278 | return tmpstr; |
---|
279 | } |
---|
280 | |
---|
281 | char* getber(struct skin* node, char* format) |
---|
282 | { |
---|
283 | uint32_t ber = 0; |
---|
284 | char* buf = NULL, *buf1 = NULL; |
---|
285 | |
---|
286 | ber = fereadber(status.aktservice->fedev); |
---|
287 | |
---|
288 | buf = malloc(MINMALLOC); |
---|
289 | if(buf == NULL) |
---|
290 | { |
---|
291 | err("no mem"); |
---|
292 | return NULL; |
---|
293 | } |
---|
294 | |
---|
295 | snprintf(buf, MINMALLOC, format, ber); |
---|
296 | buf1 = ostrcat(buf, "", 1, 0); |
---|
297 | |
---|
298 | return buf1; |
---|
299 | } |
---|
300 | |
---|
301 | char* getsignal(struct skin* node, char* format) |
---|
302 | { |
---|
303 | uint16_t signal = 0; |
---|
304 | char* buf = NULL, *buf1 = NULL; |
---|
305 | |
---|
306 | signal = fereadsignalstrength(status.aktservice->fedev); |
---|
307 | signal = (signal * 100) / 0xffff; |
---|
308 | |
---|
309 | buf = malloc(MINMALLOC); |
---|
310 | if(buf == NULL) |
---|
311 | { |
---|
312 | err("no mem"); |
---|
313 | return NULL; |
---|
314 | } |
---|
315 | |
---|
316 | snprintf(buf, MINMALLOC, format, signal); |
---|
317 | buf1 = ostrcat(buf, "", 1, 0); |
---|
318 | |
---|
319 | return buf1; |
---|
320 | } |
---|
321 | |
---|
322 | char* getunc(struct skin* node, char* format) |
---|
323 | { |
---|
324 | uint32_t unc = 0; |
---|
325 | char* buf = NULL, *buf1 = NULL; |
---|
326 | |
---|
327 | unc = fereaduncorrectedblocks(status.aktservice->fedev); |
---|
328 | |
---|
329 | buf = malloc(MINMALLOC); |
---|
330 | if(buf == NULL) |
---|
331 | { |
---|
332 | err("no mem"); |
---|
333 | return NULL; |
---|
334 | } |
---|
335 | |
---|
336 | snprintf(buf, MINMALLOC, format, unc); |
---|
337 | buf1 = ostrcat(buf, "", 1, 0); |
---|
338 | |
---|
339 | return buf1; |
---|
340 | } |
---|
341 | |
---|
342 | char* getsnr(struct skin* node, char* format) |
---|
343 | { |
---|
344 | uint16_t snr = 0; |
---|
345 | char* buf = NULL, *buf1 = NULL; |
---|
346 | |
---|
347 | |
---|
348 | snr = fereadsnr(status.aktservice->fedev); |
---|
349 | snr = (snr * 100) / 0xffff; |
---|
350 | |
---|
351 | buf = malloc(MINMALLOC); |
---|
352 | if(buf == NULL) |
---|
353 | { |
---|
354 | err("no mem"); |
---|
355 | return NULL; |
---|
356 | } |
---|
357 | |
---|
358 | snprintf(buf, MINMALLOC, format, snr); |
---|
359 | buf1 = ostrcat(buf, "", 1, 0); |
---|
360 | |
---|
361 | return buf1; |
---|
362 | } |
---|
363 | |
---|
364 | char* getepgtimeline(struct skin* node, int akt) |
---|
365 | { |
---|
366 | struct epg* epgnode = NULL; |
---|
367 | struct channel* chnode = NULL; |
---|
368 | char* tmpstr = NULL, *tmpnr = NULL; |
---|
369 | int proz = 0; |
---|
370 | |
---|
371 | if(akt == 0) chnode = status.markedchannel; |
---|
372 | if(akt == 1) chnode = status.aktservice->channel; |
---|
373 | if(akt == 2 && node != NULL) chnode = (struct channel*)node->handle; |
---|
374 | |
---|
375 | if(chnode != NULL) |
---|
376 | { |
---|
377 | epgnode = getepgakt(chnode); |
---|
378 | if(epgnode != NULL) |
---|
379 | { |
---|
380 | proz = (time(NULL) - epgnode->starttime) * 100 / (epgnode->endtime - epgnode->starttime); |
---|
381 | tmpnr = oitoa(proz); |
---|
382 | tmpstr = ostrcat(tmpstr, tmpnr, 1, 1); |
---|
383 | return tmpstr; |
---|
384 | } |
---|
385 | } |
---|
386 | return NULL; |
---|
387 | } |
---|
388 | |
---|
389 | char* getepgmarkedtimeline(struct skin* node) |
---|
390 | { |
---|
391 | return getepgtimeline(node, 0); |
---|
392 | } |
---|
393 | |
---|
394 | char* getepgakttimeline(struct skin* node) |
---|
395 | { |
---|
396 | return getepgtimeline(node, 1); |
---|
397 | } |
---|
398 | |
---|
399 | char* getepgchanneltimeline(struct skin* node) |
---|
400 | { |
---|
401 | return getepgtimeline(node, 2); |
---|
402 | } |
---|
403 | |
---|
404 | char* getaktchannelname(struct skin* node) |
---|
405 | { |
---|
406 | char* tmpstr = NULL; |
---|
407 | |
---|
408 | if(status.aktservice->channel != NULL) |
---|
409 | { |
---|
410 | tmpstr = ostrcat(tmpstr, status.aktservice->channel->name, 1, 0); |
---|
411 | return tmpstr; |
---|
412 | } |
---|
413 | return NULL; |
---|
414 | } |
---|
415 | |
---|
416 | char* getepgtime(struct skin* node, char* format, int akt, int type) |
---|
417 | { |
---|
418 | // akt 0 = marked channel |
---|
419 | // akt 1 = akt channel now |
---|
420 | // akt 2 = akt channel next |
---|
421 | |
---|
422 | // type 0 = starttime |
---|
423 | // type 1 = endtime |
---|
424 | // type 2 = remainingtime |
---|
425 | |
---|
426 | debug(1000, "in"); |
---|
427 | struct epg* epgnode = NULL; |
---|
428 | struct tm *loctime = NULL; |
---|
429 | struct channel* chnode = NULL; |
---|
430 | char *buf = NULL, *buf1 = NULL; |
---|
431 | time_t min = 0; |
---|
432 | |
---|
433 | if(format == NULL) |
---|
434 | { |
---|
435 | debug(1000, "out -> NULL detect"); |
---|
436 | return NULL; |
---|
437 | } |
---|
438 | |
---|
439 | if(akt == 0) chnode = status.markedchannel; |
---|
440 | if(akt == 1 || akt == 2) chnode = status.aktservice->channel; |
---|
441 | |
---|
442 | if(chnode != NULL) |
---|
443 | { |
---|
444 | epgnode = getepgakt(chnode); |
---|
445 | |
---|
446 | if(akt == 2) |
---|
447 | { |
---|
448 | if(epgnode != NULL) |
---|
449 | epgnode = epgnode->next; |
---|
450 | } |
---|
451 | |
---|
452 | if(epgnode != NULL) |
---|
453 | { |
---|
454 | if(type == 0) |
---|
455 | loctime = olocaltime(&epgnode->starttime); |
---|
456 | else if(type == 1) |
---|
457 | loctime = olocaltime(&epgnode->endtime); |
---|
458 | else if(type == 2) |
---|
459 | { |
---|
460 | if(akt == 1) |
---|
461 | min = (epgnode->endtime - (time(NULL) - 60)) / 60; |
---|
462 | else if(akt == 2) |
---|
463 | min = (epgnode->endtime - epgnode->starttime) / 60; |
---|
464 | if(min < 0) min = 0; |
---|
465 | } |
---|
466 | |
---|
467 | buf = malloc(MINMALLOC); |
---|
468 | if(buf == NULL) |
---|
469 | { |
---|
470 | free(loctime); |
---|
471 | err("no memory"); |
---|
472 | return NULL; |
---|
473 | } |
---|
474 | |
---|
475 | if(type == 2) |
---|
476 | snprintf(buf, MINMALLOC, format, min); |
---|
477 | else if(loctime != NULL) |
---|
478 | ostrftime(buf, MINMALLOC, format, loctime); |
---|
479 | buf1 = ostrcat(buf, "", 1, 0); |
---|
480 | |
---|
481 | free(loctime); loctime = NULL; |
---|
482 | debug(1000, "out"); |
---|
483 | return buf1; |
---|
484 | } |
---|
485 | } |
---|
486 | debug(1000, "out"); |
---|
487 | return NULL; |
---|
488 | } |
---|
489 | |
---|
490 | char* getepgakttimeremaining(struct skin* node, char* format) |
---|
491 | { |
---|
492 | return getepgtime(node, format, 1, 2); |
---|
493 | } |
---|
494 | |
---|
495 | char* getepgnexttimeremaining(struct skin* node, char* format) |
---|
496 | { |
---|
497 | return getepgtime(node, format, 2, 2); |
---|
498 | } |
---|
499 | |
---|
500 | char* getepgmarkedstart(struct skin* node, char* format) |
---|
501 | { |
---|
502 | return getepgtime(node, format, 0, 0); |
---|
503 | } |
---|
504 | |
---|
505 | char* getepgmarkedend(struct skin* node, char* format) |
---|
506 | { |
---|
507 | return getepgtime(node, format, 0, 1); |
---|
508 | } |
---|
509 | |
---|
510 | char* getepgaktstart(struct skin* node, char* format) |
---|
511 | { |
---|
512 | return getepgtime(node, format, 1, 0); |
---|
513 | } |
---|
514 | |
---|
515 | char* getepgaktend(struct skin* node, char* format) |
---|
516 | { |
---|
517 | return getepgtime(node, format, 1, 1); |
---|
518 | } |
---|
519 | |
---|
520 | char* getepgnextstart(struct skin* node, char* format) |
---|
521 | { |
---|
522 | return getepgtime(node, format, 2, 0); |
---|
523 | } |
---|
524 | |
---|
525 | char* getepgnextend(struct skin* node, char* format) |
---|
526 | { |
---|
527 | return getepgtime(node, format, 2, 1); |
---|
528 | } |
---|
529 | |
---|
530 | char* getepgaktsubtitle(struct skin* node) |
---|
531 | { |
---|
532 | struct epg* epgnode = NULL; |
---|
533 | char* tmpstr = NULL; |
---|
534 | |
---|
535 | epgnode = getepgakt(status.aktservice->channel); |
---|
536 | if(epgnode != NULL) |
---|
537 | { |
---|
538 | tmpstr = ostrcat(tmpstr, epgnode->subtitle, 1, 0); |
---|
539 | return tmpstr; |
---|
540 | } |
---|
541 | |
---|
542 | return NULL; |
---|
543 | } |
---|
544 | |
---|
545 | char* getepgakttitle(struct skin* node) |
---|
546 | { |
---|
547 | struct epg* epgnode = NULL; |
---|
548 | char* tmpstr = NULL; |
---|
549 | |
---|
550 | epgnode = getepgakt(status.aktservice->channel); |
---|
551 | if(epgnode != NULL) |
---|
552 | { |
---|
553 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
554 | return tmpstr; |
---|
555 | } |
---|
556 | |
---|
557 | return NULL; |
---|
558 | } |
---|
559 | |
---|
560 | char* getepgnexttitle(struct skin* node) |
---|
561 | { |
---|
562 | struct epg* epgnode = NULL; |
---|
563 | char* tmpstr = NULL; |
---|
564 | |
---|
565 | epgnode = getepgakt(status.aktservice->channel); |
---|
566 | if(epgnode != NULL) |
---|
567 | { |
---|
568 | epgnode = epgnode->next; |
---|
569 | if(epgnode != NULL) |
---|
570 | { |
---|
571 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
572 | return tmpstr; |
---|
573 | } |
---|
574 | } |
---|
575 | |
---|
576 | return NULL; |
---|
577 | } |
---|
578 | |
---|
579 | char* getepgaktdesc(struct skin* node) |
---|
580 | { |
---|
581 | struct epg* epgnode = NULL; |
---|
582 | |
---|
583 | if(status.aktservice->channel != NULL) |
---|
584 | { |
---|
585 | epgnode = getepgakt(status.aktservice->channel); |
---|
586 | if(epgnode != NULL) |
---|
587 | return epgdescunzip(epgnode); |
---|
588 | } |
---|
589 | |
---|
590 | return NULL; |
---|
591 | } |
---|
592 | |
---|
593 | char* getepgmarkeddesc(struct skin* node) |
---|
594 | { |
---|
595 | struct epg* epgnode = NULL; |
---|
596 | |
---|
597 | if(status.markedchannel != NULL) |
---|
598 | { |
---|
599 | epgnode = getepgakt(status.markedchannel); |
---|
600 | if(epgnode != NULL) |
---|
601 | return epgdescunzip(epgnode); |
---|
602 | } |
---|
603 | |
---|
604 | return NULL; |
---|
605 | } |
---|
606 | |
---|
607 | char* getepgmarkedlist(struct skin* node, char* ccount) |
---|
608 | { |
---|
609 | struct epg* epgnode = NULL; |
---|
610 | char* tmpstr = NULL, *buf = NULL; |
---|
611 | int count = atoi(ccount); |
---|
612 | struct tm* loctime = NULL; |
---|
613 | |
---|
614 | buf = malloc(MINMALLOC); |
---|
615 | if(buf == NULL) |
---|
616 | { |
---|
617 | err("no memory"); |
---|
618 | return NULL; |
---|
619 | } |
---|
620 | |
---|
621 | if(status.markedchannel != NULL) |
---|
622 | { |
---|
623 | epgnode = getepgakt(status.markedchannel); |
---|
624 | while(epgnode != NULL) |
---|
625 | { |
---|
626 | epgnode = epgnode->next; |
---|
627 | if(epgnode != NULL) |
---|
628 | { |
---|
629 | loctime = olocaltime(&epgnode->starttime); |
---|
630 | if(loctime != NULL) |
---|
631 | strftime(buf, MINMALLOC, "%H:%M", loctime); |
---|
632 | free(loctime); loctime = NULL; |
---|
633 | tmpstr = ostrcat(tmpstr, buf, 1, 0); |
---|
634 | tmpstr = ostrcat(tmpstr, " ", 1, 0); |
---|
635 | tmpstr = ostrcat(tmpstr, epgnode->title, 1, 0); |
---|
636 | tmpstr = ostrcat(tmpstr, "\n", 1, 0); |
---|
637 | count--; |
---|
638 | } |
---|
639 | if(count < 1) break; |
---|
640 | } |
---|
641 | } |
---|
642 | |
---|
643 | free(buf); |
---|
644 | return tmpstr; |
---|
645 | } |
---|
646 | |
---|
647 | char* getepgpicon(struct skin* node) |
---|
648 | { |
---|
649 | char* tmpstr = NULL; |
---|
650 | |
---|
651 | if(status.epgchannel != NULL) |
---|
652 | tmpstr = createpiconpath(status.epgchannel, 0); |
---|
653 | return tmpstr; |
---|
654 | } |
---|
655 | |
---|
656 | char* getpicon(struct skin* node) |
---|
657 | { |
---|
658 | char* tmpstr = NULL; |
---|
659 | tmpstr = createpiconpath(status.aktservice->channel, 0); |
---|
660 | return tmpstr; |
---|
661 | } |
---|
662 | |
---|
663 | char* getalternatepicon(struct skin* node) |
---|
664 | { |
---|
665 | char* tmpstr = NULL; |
---|
666 | tmpstr = createpiconpath(status.aktservice->channel, 1); |
---|
667 | return tmpstr; |
---|
668 | } |
---|
669 | |
---|
670 | char* gettime(struct skin* node, char* format) |
---|
671 | { |
---|
672 | debug(1000, "in"); |
---|
673 | time_t sec; |
---|
674 | struct tm *loctime = NULL; |
---|
675 | char *buf = NULL, *buf1 = NULL; |
---|
676 | |
---|
677 | if(format == NULL) |
---|
678 | { |
---|
679 | debug(1000, "out -> NULL detect"); |
---|
680 | return NULL; |
---|
681 | } |
---|
682 | |
---|
683 | buf = malloc(MINMALLOC); |
---|
684 | if(buf == NULL) |
---|
685 | { |
---|
686 | err("no memory"); |
---|
687 | return NULL; |
---|
688 | } |
---|
689 | |
---|
690 | sec = time(NULL); |
---|
691 | loctime = olocaltime(&sec); |
---|
692 | |
---|
693 | if(loctime != NULL) |
---|
694 | { |
---|
695 | ostrftime(buf, MINMALLOC, format, loctime); |
---|
696 | buf1 = ostrcat(buf, "", 1, 0); |
---|
697 | } |
---|
698 | |
---|
699 | free(loctime); |
---|
700 | debug(1000, "out"); |
---|
701 | return buf1; |
---|
702 | } |
---|
703 | |
---|
704 | char* getchannelnr(struct skin* node, struct channel* chnode) |
---|
705 | { |
---|
706 | char *tmpstr = NULL, *tmpnr = NULL; |
---|
707 | |
---|
708 | if(chnode == NULL) chnode = status.aktservice->channel; |
---|
709 | |
---|
710 | if(status.servicetype == 0) |
---|
711 | tmpstr = getconfig("channellist", NULL); |
---|
712 | else |
---|
713 | tmpstr = getconfig("rchannellist", NULL); |
---|
714 | if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10) |
---|
715 | { |
---|
716 | struct mainbouquet* mainbouquetnode = NULL; |
---|
717 | int count = 0; |
---|
718 | |
---|
719 | mainbouquetnode = getmainbouquet(tmpstr + 10); |
---|
720 | if(mainbouquetnode != NULL && mainbouquetnode->bouquet != NULL) |
---|
721 | { |
---|
722 | struct bouquet* bnode = mainbouquetnode->bouquet; |
---|
723 | |
---|
724 | while(bnode != NULL) |
---|
725 | { |
---|
726 | if(bnode->channel == chnode) |
---|
727 | { |
---|
728 | tmpnr = oitoa(mainbouquetnode->bouquet->nr + count); |
---|
729 | return tmpnr; |
---|
730 | } |
---|
731 | count++; |
---|
732 | bnode = bnode->next; |
---|
733 | } |
---|
734 | } |
---|
735 | return tmpnr; |
---|
736 | } |
---|
737 | else |
---|
738 | return tmpnr; |
---|
739 | } |
---|
740 | |
---|
741 | char* getakttuner(struct skin* node) |
---|
742 | { |
---|
743 | char* tmpstr = NULL; |
---|
744 | |
---|
745 | if(status.aktservice->fedev != NULL) |
---|
746 | { |
---|
747 | tmpstr = oitoa(status.aktservice->fedev->devnr); |
---|
748 | return tmpstr; |
---|
749 | } |
---|
750 | |
---|
751 | return NULL; |
---|
752 | } |
---|
753 | |
---|
754 | char* getchannellistname(struct skin* node) |
---|
755 | { |
---|
756 | char* tmpstr = NULL, *tmpstr1 = NULL; |
---|
757 | |
---|
758 | if(status.servicetype == 0) |
---|
759 | tmpstr = getconfig("channellist", NULL); |
---|
760 | else |
---|
761 | tmpstr = getconfig("rchannellist", NULL); |
---|
762 | |
---|
763 | if(tmpstr != NULL) |
---|
764 | { |
---|
765 | if(ostrncmp("(BOUQUET)-", tmpstr, 10) == 0 && strlen(tmpstr) > 10) |
---|
766 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 10, 1, 0); |
---|
767 | |
---|
768 | else if(ostrncmp("(A-Z)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6) |
---|
769 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0); |
---|
770 | |
---|
771 | else if(ostrncmp("(SAT)-", tmpstr, 6) == 0 && strlen(tmpstr) > 6) |
---|
772 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 6, 1, 0); |
---|
773 | |
---|
774 | else if(ostrncmp("(PROVIDER)-", tmpstr, 11) == 0 && strlen(tmpstr) > 6) |
---|
775 | tmpstr1 = ostrcat(tmpstr1, tmpstr + 11, 1, 0); |
---|
776 | } |
---|
777 | |
---|
778 | return tmpstr1; |
---|
779 | } |
---|
780 | |
---|
781 | char* getpowerofftime(struct skin* node, char* format) |
---|
782 | { |
---|
783 | char* buf = NULL, *buf1 = NULL; |
---|
784 | int resttime = 0; |
---|
785 | |
---|
786 | if(format == NULL) return NULL; |
---|
787 | |
---|
788 | if(status.sd_timer != NULL && status.sd_timer->active) |
---|
789 | { |
---|
790 | buf = malloc(MINMALLOC); |
---|
791 | if(buf == NULL) |
---|
792 | { |
---|
793 | err("no mem"); |
---|
794 | return NULL; |
---|
795 | } |
---|
796 | |
---|
797 | resttime = (status.sd_timer->shutdown_time - time(NULL)) / 60; |
---|
798 | if(resttime < 0) resttime = 0; |
---|
799 | snprintf(buf, MINMALLOC, format, resttime); |
---|
800 | buf1 = ostrcat(buf, "", 1, 0); |
---|
801 | } |
---|
802 | |
---|
803 | return buf1; |
---|
804 | } |
---|
805 | |
---|
806 | char* gettvpic(struct skin* node, char* pos) |
---|
807 | { |
---|
808 | struct splitstr* ret = NULL; |
---|
809 | char* tmpstr = NULL; |
---|
810 | int count = 0, left = 0, top = 0, width = 0; |
---|
811 | |
---|
812 | if(pos != NULL) |
---|
813 | { |
---|
814 | tmpstr = ostrcat(pos, NULL, 0, 0); |
---|
815 | ret = strsplit(tmpstr, ":", &count); |
---|
816 | if(count == 3) |
---|
817 | { |
---|
818 | if((&ret[0])->part != NULL) |
---|
819 | left = atoi((&ret[0])->part); |
---|
820 | if((&ret[1])->part != NULL) |
---|
821 | top = atoi((&ret[1])->part); |
---|
822 | if((&ret[2])->part != NULL) |
---|
823 | width = atoi((&ret[2])->part); |
---|
824 | |
---|
825 | setvmpegrect(status.aktservice->videodev, left, top, width, 0); |
---|
826 | } |
---|
827 | free(tmpstr); tmpstr = NULL; |
---|
828 | } |
---|
829 | |
---|
830 | free(ret); ret = NULL; |
---|
831 | return NULL; |
---|
832 | } |
---|
833 | |
---|
834 | char* getrecfreesize(struct skin* node) |
---|
835 | { |
---|
836 | int ret = 0; |
---|
837 | |
---|
838 | long long full = getfullspace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
839 | long long free = getfreespace(getconfig("rec_path", NULL)) / (1024 * 1024); |
---|
840 | |
---|
841 | if(full > 0 && full > free) ret = ((full - free) * 100) / full; |
---|
842 | |
---|
843 | if(ret < 0) ret = 0; |
---|
844 | if(ret > 100) ret = 100; |
---|
845 | |
---|
846 | return oitoa(ret); |
---|
847 | } |
---|
848 | |
---|
849 | #endif |
---|