1 | #include "../../titan/struct.h" |
---|
2 | #include "../../titan/debug.h" |
---|
3 | #include "../../titan/header.h" |
---|
4 | |
---|
5 | #include "lcd_weather.h" |
---|
6 | |
---|
7 | char pluginname[] = "LCD Samsung SPF.."; |
---|
8 | char plugindesc[] = "Extensions"; |
---|
9 | char pluginpic[] = "%pluginpath%/lcdsamsung/lcdsamsung.png"; |
---|
10 | |
---|
11 | int pluginaktiv = 0; |
---|
12 | //int pluginversion = PLUGINVERSION; |
---|
13 | int pluginversion = 999999; |
---|
14 | |
---|
15 | struct stimerthread* LCD_Samsung1thread = NULL; |
---|
16 | |
---|
17 | int firststart = 0; |
---|
18 | |
---|
19 | void weather_getline(FILE* fd, char* fileline) |
---|
20 | { |
---|
21 | fgets(fileline, 256, fd); |
---|
22 | if(fileline[0] == '#' || fileline[0] == '\n') |
---|
23 | return; |
---|
24 | if(fileline[strlen(fileline) - 1] == '\n') |
---|
25 | fileline[strlen(fileline) - 1] = '\0'; |
---|
26 | if(fileline[strlen(fileline) - 1] == '\r') |
---|
27 | fileline[strlen(fileline) - 1] = '\0'; |
---|
28 | } |
---|
29 | |
---|
30 | void LCD_start_lcd4linux() |
---|
31 | { |
---|
32 | int count = 0; |
---|
33 | char* startlcd = NULL; |
---|
34 | |
---|
35 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
36 | { |
---|
37 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
38 | startlcd = ostrcat(startlcd, " 1", 1, 0); |
---|
39 | } |
---|
40 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
41 | { |
---|
42 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
43 | startlcd = ostrcat(startlcd, " 6", 1, 0); |
---|
44 | } |
---|
45 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
46 | { |
---|
47 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
48 | startlcd = ostrcat(startlcd, " 3", 1, 0); |
---|
49 | } |
---|
50 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
51 | { |
---|
52 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
53 | startlcd = ostrcat(startlcd, " 2", 1, 0); |
---|
54 | } |
---|
55 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
56 | { |
---|
57 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
58 | startlcd = ostrcat(startlcd, " 5", 1, 0); |
---|
59 | } |
---|
60 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
61 | { |
---|
62 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
63 | startlcd = ostrcat(startlcd, " 4", 1, 0); |
---|
64 | } |
---|
65 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
66 | { |
---|
67 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
68 | startlcd = ostrcat(startlcd, " 7", 1, 0); |
---|
69 | } |
---|
70 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
71 | { |
---|
72 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
73 | startlcd = ostrcat(startlcd, " 8", 1, 0); |
---|
74 | } |
---|
75 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
76 | { |
---|
77 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
78 | startlcd = ostrcat(startlcd, " 9", 1, 0); |
---|
79 | } |
---|
80 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "none") == 0) |
---|
81 | { |
---|
82 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
83 | startlcd = ostrcat(startlcd, " 99", 1, 0); |
---|
84 | } |
---|
85 | else |
---|
86 | { |
---|
87 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
88 | startlcd = ostrcat(startlcd, " 2", 1, 0); |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | if(LCD_Samsung1thread == NULL) |
---|
93 | return; |
---|
94 | while (LCD_Samsung1thread->aktion != STOP && system("ps | grep -v grep | grep fbread") != 0) { |
---|
95 | system(startlcd); |
---|
96 | sleep(6); |
---|
97 | count ++; |
---|
98 | if(LCD_Samsung1thread == NULL) |
---|
99 | break; |
---|
100 | if(count == 101) { |
---|
101 | textbox(_("Message"), _("ERROR cant start LCD driver"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 5, 0); |
---|
102 | LCD_Samsung1thread->aktion = STOP; |
---|
103 | } |
---|
104 | } |
---|
105 | free(startlcd);startlcd=NULL; |
---|
106 | } |
---|
107 | |
---|
108 | void LCD_Samsung1_thread() |
---|
109 | { |
---|
110 | |
---|
111 | struct skin* LCD_Samsung1 = NULL; |
---|
112 | struct skin* LCD_Standby = NULL; |
---|
113 | struct skin* LCD_Play = NULL; |
---|
114 | |
---|
115 | |
---|
116 | struct skin* city = NULL; |
---|
117 | struct skin* wind = NULL; |
---|
118 | struct skin* luft = NULL; |
---|
119 | struct skin* day0_t = NULL; |
---|
120 | struct skin* day0_tm = NULL; |
---|
121 | struct skin* day0_i = NULL; |
---|
122 | struct skin* day0_d = NULL; |
---|
123 | struct skin* day0_dl = NULL; |
---|
124 | struct skin* day1_t = NULL; |
---|
125 | struct skin* day1_tm = NULL; |
---|
126 | struct skin* day1_i = NULL; |
---|
127 | struct skin* day1_d = NULL; |
---|
128 | struct skin* day1_dl = NULL; |
---|
129 | struct skin* day2_t = NULL; |
---|
130 | struct skin* day2_tm = NULL; |
---|
131 | struct skin* day2_i = NULL; |
---|
132 | struct skin* day2_d = NULL; |
---|
133 | struct skin* day2_dl = NULL; |
---|
134 | struct skin* day3_t = NULL; |
---|
135 | struct skin* day3_tm = NULL; |
---|
136 | struct skin* day3_i = NULL; |
---|
137 | struct skin* day3_d = NULL; |
---|
138 | struct skin* day3_dl = NULL; |
---|
139 | struct skin* akttime = NULL; |
---|
140 | struct skin* akttime_Standby = NULL; |
---|
141 | |
---|
142 | struct skin* n_stunde = NULL; |
---|
143 | struct skin* n_minute = NULL; |
---|
144 | struct skin* n_stunde_standby = NULL; |
---|
145 | struct skin* n_minute_standby = NULL; |
---|
146 | |
---|
147 | struct skin* n_stunde2 = NULL; |
---|
148 | struct skin* n_minute2 = NULL; |
---|
149 | struct skin* n_stunde2_standby = NULL; |
---|
150 | struct skin* n_minute2_standby = NULL; |
---|
151 | |
---|
152 | struct skin* scity = NULL; |
---|
153 | struct skin* swind = NULL; |
---|
154 | struct skin* sluft = NULL; |
---|
155 | struct skin* sday0_t = NULL; |
---|
156 | struct skin* sday0_tm = NULL; |
---|
157 | struct skin* sday0_i = NULL; |
---|
158 | struct skin* sday0_d = NULL; |
---|
159 | struct skin* sday0_dl = NULL; |
---|
160 | struct skin* sday1_t = NULL; |
---|
161 | struct skin* sday1_tm = NULL; |
---|
162 | struct skin* sday1_i = NULL; |
---|
163 | struct skin* sday1_d = NULL; |
---|
164 | struct skin* sday1_dl = NULL; |
---|
165 | struct skin* sday2_t = NULL; |
---|
166 | struct skin* sday2_tm = NULL; |
---|
167 | struct skin* sday2_i = NULL; |
---|
168 | struct skin* sday2_d = NULL; |
---|
169 | struct skin* sday2_dl = NULL; |
---|
170 | struct skin* sday3_t = NULL; |
---|
171 | struct skin* sday3_tm = NULL; |
---|
172 | struct skin* sday3_i = NULL; |
---|
173 | struct skin* sday3_d = NULL; |
---|
174 | struct skin* sday3_dl = NULL; |
---|
175 | |
---|
176 | |
---|
177 | char* tmpstr = NULL, *tmpstr2 = NULL, *tmpstr3 = NULL, *timemerk = NULL, *sendermerk = NULL, *recmerk = NULL; |
---|
178 | char* pichr = NULL, *picmin = NULL, *pichr_standby = NULL, *picmin_standby = NULL; |
---|
179 | char* pichr2 = NULL, *picmin2 = NULL, *pichr2_standby = NULL, *picmin2_standby = NULL; |
---|
180 | int digitaluhr = 0, digitaluhr_standby = 0; |
---|
181 | FILE *fd = NULL; |
---|
182 | char *fileline = NULL; |
---|
183 | int weatherwrite = 999; |
---|
184 | int weatherref = 0; |
---|
185 | char* startlcd = NULL; |
---|
186 | |
---|
187 | printf("lcd_samsung thread started\n"); |
---|
188 | |
---|
189 | if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0) |
---|
190 | { |
---|
191 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
192 | LCD_Samsung1 = getscreen("LCD_spf75_Wetter"); |
---|
193 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
194 | LCD_Samsung1 = getscreen("LCD_spf87_Wetter"); |
---|
195 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
196 | LCD_Samsung1 = getscreen("LCD_spf83_Wetter"); |
---|
197 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
198 | LCD_Samsung1 = getscreen("LCD_spf87_Wetter"); |
---|
199 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
200 | LCD_Samsung1 = getscreen("LCD_spf105_Wetter"); |
---|
201 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
202 | LCD_Samsung1 = getscreen("LCD_spf107_Wetter"); |
---|
203 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
204 | LCD_Samsung1 = getscreen("LCD_spf72_Wetter"); |
---|
205 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
206 | LCD_Samsung1 = getscreen("LCD_spf85_Wetter"); |
---|
207 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
208 | LCD_Samsung1 = getscreen("LCD_spf85_Wetter"); |
---|
209 | else |
---|
210 | LCD_Samsung1 = getscreen("LCD_spf87_Wetter"); |
---|
211 | city = getscreennode(LCD_Samsung1, "city"); |
---|
212 | wind = getscreennode(LCD_Samsung1, "wind"); |
---|
213 | luft = getscreennode(LCD_Samsung1, "luft"); |
---|
214 | day0_t = getscreennode(LCD_Samsung1, "day0_t"); |
---|
215 | day0_tm = getscreennode(LCD_Samsung1, "day0_tm"); |
---|
216 | day0_i = getscreennode(LCD_Samsung1, "day0_i"); |
---|
217 | day0_d = getscreennode(LCD_Samsung1, "day0_d"); |
---|
218 | day0_dl = getscreennode(LCD_Samsung1, "day0_dl"); |
---|
219 | day1_t = getscreennode(LCD_Samsung1, "day1_t"); |
---|
220 | day1_tm = getscreennode(LCD_Samsung1, "day1_tm"); |
---|
221 | day1_i = getscreennode(LCD_Samsung1, "day1_i"); |
---|
222 | day1_d = getscreennode(LCD_Samsung1, "day1_d"); |
---|
223 | day1_dl = getscreennode(LCD_Samsung1, "day1_dl"); |
---|
224 | day2_t = getscreennode(LCD_Samsung1, "day2_t"); |
---|
225 | day2_tm = getscreennode(LCD_Samsung1, "day2_tm"); |
---|
226 | day2_i = getscreennode(LCD_Samsung1, "day2_i"); |
---|
227 | day2_d = getscreennode(LCD_Samsung1, "day2_d"); |
---|
228 | day2_dl = getscreennode(LCD_Samsung1, "day2_dl"); |
---|
229 | day3_t = getscreennode(LCD_Samsung1, "day3_t"); |
---|
230 | day3_tm = getscreennode(LCD_Samsung1, "day3_tm"); |
---|
231 | day3_i = getscreennode(LCD_Samsung1, "day3_i"); |
---|
232 | day3_d = getscreennode(LCD_Samsung1, "day3_d"); |
---|
233 | day3_dl = getscreennode(LCD_Samsung1, "day3_dl"); |
---|
234 | akttime = getscreennode(LCD_Samsung1, "akttime"); |
---|
235 | akttime = getscreennode(LCD_Samsung1, "akttime"); |
---|
236 | n_stunde = getscreennode(LCD_Samsung1, "stunde"); |
---|
237 | if(n_stunde != NULL) |
---|
238 | { |
---|
239 | pichr = ostrcat(n_stunde->pic, "", 0, 0); |
---|
240 | if(ostrstr(pichr, "Digital") != NULL) |
---|
241 | digitaluhr = 1; |
---|
242 | } |
---|
243 | n_minute = getscreennode(LCD_Samsung1, "minute"); |
---|
244 | if(n_minute != NULL) |
---|
245 | picmin = ostrcat(n_minute->pic, "", 0, 0); |
---|
246 | if(digitaluhr == 1) |
---|
247 | { |
---|
248 | n_stunde2 = getscreennode(LCD_Samsung1, "stunde2"); |
---|
249 | n_minute2 = getscreennode(LCD_Samsung1, "minute2"); |
---|
250 | picmin2 = ostrcat(n_minute2->pic, "", 0, 0); |
---|
251 | pichr2 = ostrcat(n_stunde2->pic, "", 0, 0); |
---|
252 | } |
---|
253 | if(file_exist("/tmp/lcdweather")) |
---|
254 | system("rm /tmp/lcdweather"); |
---|
255 | weatherwrite = 0; |
---|
256 | } |
---|
257 | else { |
---|
258 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
259 | LCD_Samsung1 = getscreen("LCD_spf75"); |
---|
260 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
261 | LCD_Samsung1 = getscreen("LCD_spf83"); |
---|
262 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
263 | LCD_Samsung1 = getscreen("LCD_spf87"); |
---|
264 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
265 | LCD_Samsung1 = getscreen("LCD_spf87"); |
---|
266 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
267 | LCD_Samsung1 = getscreen("LCD_spf105"); |
---|
268 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
269 | LCD_Samsung1 = getscreen("LCD_spf107"); |
---|
270 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
271 | LCD_Samsung1 = getscreen("LCD_spf72"); |
---|
272 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
273 | LCD_Samsung1 = getscreen("LCD_spf85"); |
---|
274 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
275 | LCD_Samsung1 = getscreen("LCD_spf85"); |
---|
276 | else |
---|
277 | LCD_Samsung1 = getscreen("LCD_spf87"); |
---|
278 | akttime = getscreennode(LCD_Samsung1, "akttime"); |
---|
279 | n_stunde = getscreennode(LCD_Samsung1, "stunde"); |
---|
280 | if(n_stunde != NULL) |
---|
281 | { |
---|
282 | pichr = ostrcat(n_stunde->pic, "", 0, 0); |
---|
283 | if(ostrstr(pichr, "Digital") != NULL) |
---|
284 | digitaluhr = 1; |
---|
285 | } |
---|
286 | n_minute = getscreennode(LCD_Samsung1, "minute"); |
---|
287 | if(n_minute != NULL) |
---|
288 | picmin = ostrcat(n_minute->pic, "", 0, 0); |
---|
289 | if(digitaluhr == 1) |
---|
290 | { |
---|
291 | n_stunde2 = getscreennode(LCD_Samsung1, "stunde2"); |
---|
292 | n_minute2 = getscreennode(LCD_Samsung1, "minute2"); |
---|
293 | picmin2 = ostrcat(n_minute2->pic, "", 0, 0); |
---|
294 | pichr2 = ostrcat(n_stunde2->pic, "", 0, 0); |
---|
295 | } |
---|
296 | } |
---|
297 | |
---|
298 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
299 | LCD_Play = getscreen("LCD_spf75_Play"); |
---|
300 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
301 | LCD_Play = getscreen("LCD_spf83_Play"); |
---|
302 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
303 | LCD_Play = getscreen("LCD_spf87_Play"); |
---|
304 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
305 | LCD_Play = getscreen("LCD_spf87_Play"); |
---|
306 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
307 | LCD_Play = getscreen("LCD_spf105_Play"); |
---|
308 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
309 | LCD_Play = getscreen("LCD_spf107_Play"); |
---|
310 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
311 | LCD_Play = getscreen("LCD_spf72_Play"); |
---|
312 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
313 | LCD_Play = getscreen("LCD_spf85_Play"); |
---|
314 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
315 | LCD_Play = getscreen("LCD_spf85_Play"); |
---|
316 | else |
---|
317 | LCD_Play = getscreen("LCD_spf87_Play"); |
---|
318 | struct skin* akttimeplay = getscreennode(LCD_Play, "akttime"); |
---|
319 | struct skin* sprogress = getscreennode(LCD_Play, "progress"); |
---|
320 | struct skin* stitle = getscreennode(LCD_Play, "title1"); |
---|
321 | struct skin* spos = getscreennode(LCD_Play, "pos"); |
---|
322 | struct skin* slen = getscreennode(LCD_Play, "len"); |
---|
323 | struct skin* sreverse = getscreennode(LCD_Play, "reverse"); |
---|
324 | |
---|
325 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
326 | { |
---|
327 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
328 | startlcd = ostrcat(startlcd, " 1", 1, 0); |
---|
329 | } |
---|
330 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
331 | { |
---|
332 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
333 | startlcd = ostrcat(startlcd, " 6", 1, 0); |
---|
334 | } |
---|
335 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
336 | { |
---|
337 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
338 | startlcd = ostrcat(startlcd, " 3", 1, 0); |
---|
339 | } |
---|
340 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
341 | { |
---|
342 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
343 | startlcd = ostrcat(startlcd, " 2", 1, 0); |
---|
344 | } |
---|
345 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
346 | { |
---|
347 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
348 | startlcd = ostrcat(startlcd, " 5", 1, 0); |
---|
349 | } |
---|
350 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
351 | { |
---|
352 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
353 | startlcd = ostrcat(startlcd, " 4", 1, 0); |
---|
354 | } |
---|
355 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
356 | { |
---|
357 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
358 | startlcd = ostrcat(startlcd, " 7", 1, 0); |
---|
359 | } |
---|
360 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
361 | { |
---|
362 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
363 | startlcd = ostrcat(startlcd, " 8", 1, 0); |
---|
364 | } |
---|
365 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
366 | { |
---|
367 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
368 | startlcd = ostrcat(startlcd, " 9", 1, 0); |
---|
369 | } |
---|
370 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "none") == 0) |
---|
371 | { |
---|
372 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
373 | startlcd = ostrcat(startlcd, " 99", 1, 0); |
---|
374 | } |
---|
375 | else |
---|
376 | { |
---|
377 | startlcd = createpluginpath("/lcdsamsung/start.sh", 0); |
---|
378 | startlcd = ostrcat(startlcd, " 2", 1, 0); |
---|
379 | } |
---|
380 | |
---|
381 | |
---|
382 | if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0) |
---|
383 | { |
---|
384 | if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf75h") == 0) |
---|
385 | LCD_Standby = getscreen("LCD_spf75_Standby"); |
---|
386 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf83h") == 0) |
---|
387 | LCD_Standby = getscreen("LCD_spf83_Standby"); |
---|
388 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87h") == 0) |
---|
389 | LCD_Standby = getscreen("LCD_spf87_Standby"); |
---|
390 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf87hold") == 0) |
---|
391 | LCD_Standby = getscreen("LCD_spf87_Standby"); |
---|
392 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf105p") == 0) |
---|
393 | LCD_Standby = getscreen("LCD_spf105_Standby"); |
---|
394 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf107h") == 0) |
---|
395 | LCD_Standby = getscreen("LCD_spf107_Standby"); |
---|
396 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf72h") == 0) |
---|
397 | LCD_Standby = getscreen("LCD_spf72_Standby"); |
---|
398 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85h") == 0) |
---|
399 | LCD_Standby = getscreen("LCD_spf85_Standby"); |
---|
400 | else if(ostrcmp(getconfig("lcd_samsung_plugin_type", NULL), "spf85p") == 0) |
---|
401 | LCD_Standby = getscreen("LCD_spf85_Standby"); |
---|
402 | else |
---|
403 | LCD_Standby = getscreen("LCD_spf87_Standby"); |
---|
404 | akttime_Standby = getscreennode(LCD_Standby, "akttime"); |
---|
405 | scity = getscreennode(LCD_Standby, "city"); |
---|
406 | swind = getscreennode(LCD_Standby, "wind"); |
---|
407 | sluft = getscreennode(LCD_Standby, "luft"); |
---|
408 | sday0_t = getscreennode(LCD_Standby, "day0_t"); |
---|
409 | sday0_tm = getscreennode(LCD_Standby, "day0_tm"); |
---|
410 | sday0_i = getscreennode(LCD_Standby, "day0_i"); |
---|
411 | sday0_d = getscreennode(LCD_Standby, "day0_d"); |
---|
412 | sday0_dl = getscreennode(LCD_Standby, "day0_dl"); |
---|
413 | sday1_t = getscreennode(LCD_Standby, "day1_t"); |
---|
414 | sday1_tm = getscreennode(LCD_Standby, "day1_tm"); |
---|
415 | sday1_i = getscreennode(LCD_Standby, "day1_i"); |
---|
416 | sday1_d = getscreennode(LCD_Standby, "day1_d"); |
---|
417 | sday1_dl = getscreennode(LCD_Standby, "day1_dl"); |
---|
418 | sday2_t = getscreennode(LCD_Standby, "day2_t"); |
---|
419 | sday2_tm = getscreennode(LCD_Standby, "day2_tm"); |
---|
420 | sday2_i = getscreennode(LCD_Standby, "day2_i"); |
---|
421 | sday2_d = getscreennode(LCD_Standby, "day2_d"); |
---|
422 | sday2_dl = getscreennode(LCD_Standby, "day2_dl"); |
---|
423 | sday3_t = getscreennode(LCD_Standby, "day3_t"); |
---|
424 | sday3_tm = getscreennode(LCD_Standby, "day3_tm"); |
---|
425 | sday3_i = getscreennode(LCD_Standby, "day3_i"); |
---|
426 | sday3_d = getscreennode(LCD_Standby, "day3_d"); |
---|
427 | sday3_dl = getscreennode(LCD_Standby, "day3_dl"); |
---|
428 | |
---|
429 | n_stunde_standby = getscreennode(LCD_Standby, "stunde"); |
---|
430 | if(n_stunde_standby != NULL) |
---|
431 | { |
---|
432 | pichr_standby = ostrcat(n_stunde_standby->pic, "", 0, 0); |
---|
433 | if(ostrstr(pichr_standby, "Digital") != NULL) |
---|
434 | digitaluhr_standby = 1; |
---|
435 | } |
---|
436 | n_minute_standby = getscreennode(LCD_Standby, "minute"); |
---|
437 | if(n_minute_standby != NULL) |
---|
438 | picmin_standby = ostrcat(n_minute_standby->pic, "", 0, 0); |
---|
439 | if(digitaluhr_standby == 1) |
---|
440 | { |
---|
441 | n_stunde2_standby = getscreennode(LCD_Standby, "stunde2"); |
---|
442 | n_minute2_standby = getscreennode(LCD_Standby, "minute2"); |
---|
443 | picmin2_standby = ostrcat(n_minute2_standby->pic, "", 0, 0); |
---|
444 | pichr2_standby = ostrcat(n_stunde2_standby->pic, "", 0, 0); |
---|
445 | } |
---|
446 | } |
---|
447 | |
---|
448 | |
---|
449 | int put = 0, typemerk = 0, type = 0; |
---|
450 | int standby = 0; |
---|
451 | |
---|
452 | unsigned long long int pos = 0, len = 0, reverse = 0; |
---|
453 | int playertype = 0; |
---|
454 | int loopcount = 0; |
---|
455 | |
---|
456 | int hr = 0, min = 0; |
---|
457 | |
---|
458 | if(firststart == 1) |
---|
459 | sleep(8); |
---|
460 | firststart = 0; |
---|
461 | status.write_png = 0; |
---|
462 | //if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0) |
---|
463 | // status.write_png = 1; |
---|
464 | |
---|
465 | while (LCD_Samsung1thread->aktion != STOP) { |
---|
466 | |
---|
467 | tmpstr = gettime(NULL, "%H:%M"); |
---|
468 | hr = atoi(gettime(NULL, "%H")); |
---|
469 | min = atoi(gettime(NULL, "%M")); |
---|
470 | |
---|
471 | // TV Programm läuft |
---|
472 | if(status.infobaraktiv == 1) |
---|
473 | { |
---|
474 | if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0) { |
---|
475 | //status.write_png = 1; |
---|
476 | if(type == 999) |
---|
477 | system("killall -3 fbread"); |
---|
478 | } |
---|
479 | tmpstr2 = getaktchannelname(NULL); |
---|
480 | tmpstr3 = getrec(NULL, NULL); |
---|
481 | type = 1; |
---|
482 | } |
---|
483 | // Aufzeichnung wird abgespielt |
---|
484 | else if(status.playspeed != 0 || status.play != 0 || status.pause != 0) |
---|
485 | { |
---|
486 | if(type == 999) |
---|
487 | system("killall -3 fbread"); |
---|
488 | //status.write_png = 0; |
---|
489 | loopcount++ ; |
---|
490 | type = 2; |
---|
491 | } |
---|
492 | // Sonstige Anzeigen |
---|
493 | else if(type != 999) |
---|
494 | { |
---|
495 | if(ostrcmp(getconfig("write_fb_to_jpg", NULL), "yes") == 0) { |
---|
496 | //status.write_png = 1; |
---|
497 | system("killall -1 fbread"); |
---|
498 | } |
---|
499 | type = 999; |
---|
500 | } |
---|
501 | else |
---|
502 | type = 999; |
---|
503 | |
---|
504 | if(typemerk != type) |
---|
505 | { |
---|
506 | put = 1; |
---|
507 | typemerk = type; |
---|
508 | free(sendermerk);sendermerk=NULL; |
---|
509 | free(recmerk);recmerk=NULL; |
---|
510 | loopcount = 0; |
---|
511 | } |
---|
512 | else |
---|
513 | put = 0; |
---|
514 | |
---|
515 | if(status.standby > 0 && standby == 0) |
---|
516 | { |
---|
517 | if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0) |
---|
518 | standby = 2; |
---|
519 | else |
---|
520 | { |
---|
521 | tmpstr = createpluginpath("/lcdsamsung/standby.jpg", 0); |
---|
522 | tmpstr = ostrcat("cp ", tmpstr, 0, 1); |
---|
523 | tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0); |
---|
524 | system(tmpstr); |
---|
525 | free(tmpstr); tmpstr=NULL; |
---|
526 | sleep(3); |
---|
527 | |
---|
528 | tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0); |
---|
529 | tmpstr = ostrcat("cp ", tmpstr, 0, 1); |
---|
530 | tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0); |
---|
531 | system(tmpstr); |
---|
532 | sleep(2); |
---|
533 | system("killall fbread"); |
---|
534 | standby = 1; |
---|
535 | } |
---|
536 | } |
---|
537 | if(status.standby == 0 && standby > 0) |
---|
538 | { |
---|
539 | if(standby == 1) |
---|
540 | system(startlcd); |
---|
541 | standby = 0; |
---|
542 | put = 1; |
---|
543 | } |
---|
544 | |
---|
545 | if(weatherthread == NULL && weatherwrite == 0) |
---|
546 | { |
---|
547 | if(file_exist("/tmp/lcdweather")) |
---|
548 | put = 1; |
---|
549 | } |
---|
550 | if(ostrcmp(tmpstr, timemerk) != 0) |
---|
551 | { |
---|
552 | free(timemerk);timemerk=NULL; |
---|
553 | timemerk = ostrcat(tmpstr, "", 0, 0); |
---|
554 | put = 1; |
---|
555 | } |
---|
556 | |
---|
557 | if(standby == 0 || standby == 2 ) |
---|
558 | { |
---|
559 | if(type == 1 && standby == 0) |
---|
560 | { |
---|
561 | if(ostrcmp(tmpstr2, sendermerk) != 0) |
---|
562 | { |
---|
563 | free(sendermerk);sendermerk=NULL; |
---|
564 | sendermerk = ostrcat(tmpstr2, "", 0, 0); |
---|
565 | put = 1; |
---|
566 | } |
---|
567 | if(tmpstr3 == NULL && recmerk != NULL) |
---|
568 | { |
---|
569 | put = 1; |
---|
570 | free(recmerk);recmerk=NULL; |
---|
571 | } |
---|
572 | else if(tmpstr3 != NULL && recmerk == NULL) |
---|
573 | { |
---|
574 | free(recmerk);recmerk=NULL; |
---|
575 | recmerk = ostrcat(tmpstr3, "", 0, 0); |
---|
576 | put = 1; |
---|
577 | } |
---|
578 | } |
---|
579 | else if(type == 2) |
---|
580 | { |
---|
581 | if(loopcount >= 15) |
---|
582 | { |
---|
583 | put = 1; |
---|
584 | loopcount = 0; |
---|
585 | } |
---|
586 | } |
---|
587 | |
---|
588 | if(put == 1) |
---|
589 | { |
---|
590 | if(type == 1) |
---|
591 | { |
---|
592 | // Wettervorhersage |
---|
593 | printf("lcd_samsung wetter = %s\n", getconfig("lcd_samsung_plugin_wetter", NULL)); |
---|
594 | if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0) |
---|
595 | { |
---|
596 | if(weatherwrite == 0) |
---|
597 | { |
---|
598 | printf("lcd_samsung weatherwrite=0\n"); |
---|
599 | if(weatherthread == NULL) |
---|
600 | { |
---|
601 | printf("lcd_samsung weatherthread=NULL\n"); |
---|
602 | if(!file_exist("/tmp/lcdweather")) |
---|
603 | weatherthread = addtimer(&lcd_writeweather, START, 10000, 1, NULL, NULL, NULL); |
---|
604 | else |
---|
605 | { |
---|
606 | fileline = malloc(256); |
---|
607 | if(fileline != NULL) |
---|
608 | { |
---|
609 | fd = fopen("/tmp/lcdweather", "r"); |
---|
610 | if(fd != NULL) |
---|
611 | { |
---|
612 | if(ostrcmp(getconfig("lcd_samsung_plugin_standby", NULL), "yes") == 0) |
---|
613 | { |
---|
614 | weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
615 | changetext(day0_d, fileline); |
---|
616 | changetext(sday0_d, fileline); |
---|
617 | weather_getline(fd, fileline); |
---|
618 | changetext(day0_tm, fileline); |
---|
619 | changetext(sday0_tm, fileline); |
---|
620 | weather_getline(fd, fileline); |
---|
621 | changetext(day0_t, fileline); |
---|
622 | changetext(sday0_t, fileline); |
---|
623 | weather_getline(fd, fileline); |
---|
624 | weather_getline(fd, fileline); |
---|
625 | changepic(day0_i, fileline); |
---|
626 | changepic(sday0_i, fileline); |
---|
627 | |
---|
628 | weather_getline(fd, fileline); |
---|
629 | changetext(day1_d, fileline); |
---|
630 | changetext(sday1_d, fileline); |
---|
631 | weather_getline(fd, fileline); |
---|
632 | changetext(day1_tm, fileline); |
---|
633 | changetext(sday1_tm, fileline); |
---|
634 | weather_getline(fd, fileline); |
---|
635 | changetext(day1_t, fileline); |
---|
636 | changetext(sday1_t, fileline); |
---|
637 | weather_getline(fd, fileline); |
---|
638 | weather_getline(fd, fileline); |
---|
639 | changepic(day1_i, fileline); |
---|
640 | changepic(sday1_i, fileline); |
---|
641 | |
---|
642 | weather_getline(fd, fileline); |
---|
643 | changetext(day2_d, fileline); |
---|
644 | changetext(sday2_d, fileline); |
---|
645 | weather_getline(fd, fileline); |
---|
646 | changetext(day2_tm, fileline); |
---|
647 | changetext(sday2_tm, fileline); |
---|
648 | weather_getline(fd, fileline); |
---|
649 | changetext(day2_t, fileline); |
---|
650 | changetext(sday2_t, fileline); |
---|
651 | weather_getline(fd, fileline); |
---|
652 | weather_getline(fd, fileline); |
---|
653 | changepic(day2_i, fileline); |
---|
654 | changepic(sday2_i, fileline); |
---|
655 | |
---|
656 | weather_getline(fd, fileline); |
---|
657 | changetext(day3_d, fileline); |
---|
658 | changetext(sday3_d, fileline); |
---|
659 | weather_getline(fd, fileline); |
---|
660 | changetext(day3_tm, fileline); |
---|
661 | changetext(sday3_tm, fileline); |
---|
662 | weather_getline(fd, fileline); |
---|
663 | changetext(day3_t, fileline); |
---|
664 | changetext(sday3_t, fileline); |
---|
665 | weather_getline(fd, fileline); |
---|
666 | weather_getline(fd, fileline); |
---|
667 | changepic(day3_i, fileline); |
---|
668 | changepic(sday3_i, fileline); |
---|
669 | |
---|
670 | weather_getline(fd, fileline); |
---|
671 | changepic(city, fileline); |
---|
672 | changepic(scity, fileline); |
---|
673 | weather_getline(fd, fileline); |
---|
674 | changetext(wind, fileline); |
---|
675 | changetext(swind, fileline); |
---|
676 | weather_getline(fd, fileline); |
---|
677 | changetext(luft, fileline); |
---|
678 | changetext(sluft, fileline); |
---|
679 | weather_getline(fd, fileline); |
---|
680 | changetext(day0_dl, fileline); |
---|
681 | changetext(sday0_dl, fileline); |
---|
682 | weather_getline(fd, fileline); |
---|
683 | changetext(day1_dl, fileline); |
---|
684 | changetext(sday1_dl, fileline); |
---|
685 | weather_getline(fd, fileline); |
---|
686 | changetext(day2_dl, fileline); |
---|
687 | changetext(sday2_dl, fileline); |
---|
688 | weather_getline(fd, fileline); |
---|
689 | changetext(day3_dl, fileline); |
---|
690 | changetext(sday3_dl, fileline); |
---|
691 | |
---|
692 | } |
---|
693 | else |
---|
694 | { |
---|
695 | weather_getline(fd, fileline);weather_getline(fd, fileline); |
---|
696 | changetext(day0_d, fileline); |
---|
697 | weather_getline(fd, fileline); |
---|
698 | changetext(day0_tm, fileline); |
---|
699 | weather_getline(fd, fileline); |
---|
700 | changetext(day0_t, fileline); |
---|
701 | weather_getline(fd, fileline); |
---|
702 | weather_getline(fd, fileline); |
---|
703 | changepic(day0_i, fileline); |
---|
704 | |
---|
705 | weather_getline(fd, fileline); |
---|
706 | changetext(day1_d, fileline); |
---|
707 | weather_getline(fd, fileline); |
---|
708 | changetext(day1_tm, fileline); |
---|
709 | weather_getline(fd, fileline); |
---|
710 | changetext(day1_t, fileline); |
---|
711 | weather_getline(fd, fileline); |
---|
712 | weather_getline(fd, fileline); |
---|
713 | changepic(day1_i, fileline); |
---|
714 | |
---|
715 | weather_getline(fd, fileline); |
---|
716 | changetext(day2_d, fileline); |
---|
717 | weather_getline(fd, fileline); |
---|
718 | changetext(day2_tm, fileline); |
---|
719 | weather_getline(fd, fileline); |
---|
720 | changetext(day2_t, fileline); |
---|
721 | weather_getline(fd, fileline); |
---|
722 | weather_getline(fd, fileline); |
---|
723 | changepic(day2_i, fileline); |
---|
724 | |
---|
725 | weather_getline(fd, fileline); |
---|
726 | changetext(day3_d, fileline); |
---|
727 | weather_getline(fd, fileline); |
---|
728 | changetext(day3_tm, fileline); |
---|
729 | weather_getline(fd, fileline); |
---|
730 | changetext(day3_t, fileline); |
---|
731 | weather_getline(fd, fileline); |
---|
732 | weather_getline(fd, fileline); |
---|
733 | changepic(day3_i, fileline); |
---|
734 | |
---|
735 | weather_getline(fd, fileline); |
---|
736 | changepic(city, fileline); |
---|
737 | weather_getline(fd, fileline); |
---|
738 | changetext(wind, fileline); |
---|
739 | weather_getline(fd, fileline); |
---|
740 | changetext(luft, fileline); |
---|
741 | weather_getline(fd, fileline); |
---|
742 | changetext(day0_dl, fileline); |
---|
743 | weather_getline(fd, fileline); |
---|
744 | changetext(day1_dl, fileline); |
---|
745 | weather_getline(fd, fileline); |
---|
746 | changetext(day2_dl, fileline); |
---|
747 | weather_getline(fd, fileline); |
---|
748 | changetext(day3_dl, fileline); |
---|
749 | } |
---|
750 | fclose(fd); |
---|
751 | } |
---|
752 | free(fileline); fileline=NULL; |
---|
753 | } |
---|
754 | weatherwrite = 1; |
---|
755 | } |
---|
756 | } |
---|
757 | } |
---|
758 | } |
---|
759 | if(standby == 0) |
---|
760 | { |
---|
761 | if(akttime != NULL) |
---|
762 | changetext(akttime, tmpstr); |
---|
763 | if(n_minute != NULL && digitaluhr == 0) |
---|
764 | { |
---|
765 | free(tmpstr);tmpstr=NULL; |
---|
766 | tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0); |
---|
767 | free(n_minute->pic); |
---|
768 | n_minute->pic = string_replace("min_mm", tmpstr, picmin, 0); |
---|
769 | free(tmpstr);tmpstr=NULL; |
---|
770 | } |
---|
771 | if(n_stunde != NULL && digitaluhr == 0) |
---|
772 | { |
---|
773 | free(tmpstr);tmpstr=NULL; |
---|
774 | if(hr >= 12) |
---|
775 | hr = hr - 12; |
---|
776 | if(hr < 10) |
---|
777 | tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1); |
---|
778 | else |
---|
779 | tmpstr = ostrcat("hr_",oitoa(hr), 0, 1); |
---|
780 | if(min < 12) |
---|
781 | tmpstr = ostrcat(tmpstr,"00", 0, 0); |
---|
782 | else if(min < 24) |
---|
783 | tmpstr = ostrcat(tmpstr,"12", 0, 0); |
---|
784 | else if(min < 36) |
---|
785 | tmpstr = ostrcat(tmpstr,"24", 0, 0); |
---|
786 | else if(min < 48) |
---|
787 | tmpstr = ostrcat(tmpstr,"36", 0, 0); |
---|
788 | else if(min < 60) |
---|
789 | tmpstr = ostrcat(tmpstr,"48", 0, 0); |
---|
790 | free(n_stunde->pic); |
---|
791 | n_stunde->pic = string_replace("hr_hhmm", tmpstr, pichr, 0); |
---|
792 | free(tmpstr);tmpstr=NULL; |
---|
793 | } |
---|
794 | if(digitaluhr == 1) |
---|
795 | { |
---|
796 | free(tmpstr);tmpstr=NULL; |
---|
797 | tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1); |
---|
798 | n_stunde->pic = string_replace("wert_w", tmpstr, pichr, 0); |
---|
799 | free(tmpstr);tmpstr=NULL; |
---|
800 | tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1); |
---|
801 | n_stunde2->pic = string_replace("wert_w", tmpstr, pichr2, 0); |
---|
802 | free(tmpstr);tmpstr=NULL; |
---|
803 | tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1); |
---|
804 | n_minute->pic = string_replace("wert_w", tmpstr, picmin, 0); |
---|
805 | free(tmpstr);tmpstr=NULL; |
---|
806 | tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1); |
---|
807 | n_minute2->pic = string_replace("wert_w", tmpstr, picmin2, 0); |
---|
808 | free(tmpstr);tmpstr=NULL; |
---|
809 | } |
---|
810 | |
---|
811 | m_lock(&status.drawingmutex, 0); |
---|
812 | if(drawscreen(LCD_Samsung1, 0, 2) == -2) |
---|
813 | printf("nicht genug Speicher fuer drawscreen\n"); |
---|
814 | m_unlock(&status.drawingmutex, 0); |
---|
815 | } |
---|
816 | else if(standby == 2) |
---|
817 | { |
---|
818 | if(akttime_Standby != NULL) |
---|
819 | changetext(akttime_Standby, tmpstr); |
---|
820 | if(n_minute_standby != NULL && digitaluhr_standby == 0) |
---|
821 | { |
---|
822 | free(tmpstr);tmpstr=NULL; |
---|
823 | tmpstr = ostrcat("min_",gettime(NULL, "%M"), 0, 0); |
---|
824 | free(n_minute_standby->pic); |
---|
825 | n_minute_standby->pic = string_replace("min_mm", tmpstr, picmin_standby, 0); |
---|
826 | free(tmpstr);tmpstr=NULL; |
---|
827 | } |
---|
828 | if(n_stunde_standby != NULL && digitaluhr_standby == 0) |
---|
829 | { |
---|
830 | free(tmpstr);tmpstr=NULL; |
---|
831 | if(hr >= 12) |
---|
832 | hr = hr - 12; |
---|
833 | if(hr < 10) |
---|
834 | tmpstr = ostrcat("hr_0",oitoa(hr), 0, 1); |
---|
835 | else |
---|
836 | tmpstr = ostrcat("hr_",oitoa(hr), 0, 1); |
---|
837 | if(min < 12) |
---|
838 | tmpstr = ostrcat(tmpstr,"00", 0, 0); |
---|
839 | else if(min < 24) |
---|
840 | tmpstr = ostrcat(tmpstr,"12", 0, 0); |
---|
841 | else if(min < 36) |
---|
842 | tmpstr = ostrcat(tmpstr,"24", 0, 0); |
---|
843 | else if(min < 48) |
---|
844 | tmpstr = ostrcat(tmpstr,"36", 0, 0); |
---|
845 | else if(min < 60) |
---|
846 | tmpstr = ostrcat(tmpstr,"48", 0, 0); |
---|
847 | free(n_stunde_standby->pic); |
---|
848 | n_stunde_standby->pic = string_replace("hr_hhmm", tmpstr, pichr_standby, 0); |
---|
849 | free(tmpstr);tmpstr=NULL; |
---|
850 | } |
---|
851 | if(digitaluhr_standby == 1) |
---|
852 | { |
---|
853 | free(tmpstr);tmpstr=NULL; |
---|
854 | tmpstr = ostrcat("wert_",oitoa(hr/10), 0, 1); |
---|
855 | n_stunde_standby->pic = string_replace("wert_w", tmpstr, pichr_standby, 0); |
---|
856 | free(tmpstr);tmpstr=NULL; |
---|
857 | tmpstr = ostrcat("wert_",oitoa(hr%10), 0, 1); |
---|
858 | n_stunde2_standby->pic = string_replace("wert_w", tmpstr, pichr2_standby, 0); |
---|
859 | free(tmpstr);tmpstr=NULL; |
---|
860 | tmpstr = ostrcat("wert_",oitoa(min/10), 0, 1); |
---|
861 | n_minute_standby->pic = string_replace("wert_w", tmpstr, picmin_standby, 0); |
---|
862 | free(tmpstr);tmpstr=NULL; |
---|
863 | tmpstr = ostrcat("wert_",oitoa(min%10), 0, 1); |
---|
864 | n_minute2_standby->pic = string_replace("wert_w", tmpstr, picmin2_standby, 0); |
---|
865 | free(tmpstr);tmpstr=NULL; |
---|
866 | } |
---|
867 | m_lock(&status.drawingmutex, 0); |
---|
868 | drawscreen(LCD_Standby, 0, 2); |
---|
869 | m_unlock(&status.drawingmutex, 0); |
---|
870 | put = 0; |
---|
871 | } |
---|
872 | } |
---|
873 | else if(type == 2) |
---|
874 | { |
---|
875 | playertype = getconfigint("lastplayertype", NULL); |
---|
876 | //if(status.mcaktiv == 1) |
---|
877 | //playertype = 0; |
---|
878 | //else |
---|
879 | ////playertype = getconfigint("playertype", NULL); |
---|
880 | //playertype = 1; |
---|
881 | |
---|
882 | if(playertype == 1) |
---|
883 | { |
---|
884 | unsigned long long int startpos = 0; |
---|
885 | playergetinfots(&len, &startpos, NULL, &pos, NULL, 0); |
---|
886 | len = len / 90000; |
---|
887 | pos = (pos - startpos) / 90000; |
---|
888 | } |
---|
889 | else |
---|
890 | { |
---|
891 | pos = playergetpts() / 90000; |
---|
892 | len = playergetlength(); |
---|
893 | } |
---|
894 | if(pos < 0) pos = 0; |
---|
895 | reverse = len - pos; |
---|
896 | if(len == 0) |
---|
897 | sprogress->progresssize = 0; |
---|
898 | else |
---|
899 | sprogress->progresssize = pos * 100 / len; |
---|
900 | |
---|
901 | tmpstr2 = convert_timesec(pos); |
---|
902 | changetext(spos, tmpstr2); |
---|
903 | free(tmpstr2); tmpstr2 = NULL; |
---|
904 | |
---|
905 | tmpstr2 = convert_timesec(len); |
---|
906 | changetext(slen, tmpstr2); |
---|
907 | free(tmpstr2); tmpstr2 = NULL; |
---|
908 | |
---|
909 | tmpstr2 = convert_timesec(reverse); |
---|
910 | changetext(sreverse, tmpstr2); |
---|
911 | free(tmpstr2); tmpstr2 = NULL; |
---|
912 | |
---|
913 | changetext(akttimeplay, tmpstr); |
---|
914 | changetext(stitle, basename(status.playfile)); |
---|
915 | m_lock(&status.drawingmutex, 0); |
---|
916 | if(drawscreen(LCD_Play, 0, 2) == -2) |
---|
917 | printf("nicht genug Speicher fuer drawscreen\n"); |
---|
918 | m_unlock(&status.drawingmutex, 0); |
---|
919 | } |
---|
920 | } |
---|
921 | } |
---|
922 | else |
---|
923 | { |
---|
924 | if(standby == 2) |
---|
925 | { |
---|
926 | if(put == 1) |
---|
927 | { |
---|
928 | changetext(akttime_Standby, tmpstr); |
---|
929 | m_lock(&status.drawingmutex, 0); |
---|
930 | drawscreen(LCD_Standby, 0, 2); |
---|
931 | m_unlock(&status.drawingmutex, 0); |
---|
932 | put = 0; |
---|
933 | } |
---|
934 | } |
---|
935 | } |
---|
936 | |
---|
937 | free(tmpstr); tmpstr = NULL; |
---|
938 | free(tmpstr2); tmpstr2 = NULL; |
---|
939 | free(tmpstr3); tmpstr3 = NULL; |
---|
940 | //sleep(1); |
---|
941 | usleep(500000); |
---|
942 | |
---|
943 | if(ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "yes") == 0) |
---|
944 | { |
---|
945 | weatherref = weatherref + 1; |
---|
946 | if(weatherref == 7200) |
---|
947 | { |
---|
948 | weatherwrite = 0; |
---|
949 | system("rm /tmp/lcdweather"); |
---|
950 | weatherref = 0; |
---|
951 | } |
---|
952 | } |
---|
953 | } |
---|
954 | free(timemerk);timemerk=NULL; |
---|
955 | free(sendermerk);sendermerk=NULL; |
---|
956 | free(recmerk);recmerk=NULL; |
---|
957 | free(startlcd);startlcd=NULL; |
---|
958 | free(pichr);pichr=NULL; |
---|
959 | free(picmin);picmin=NULL; |
---|
960 | free(pichr_standby);pichr=NULL; |
---|
961 | free(picmin_standby);picmin=NULL; |
---|
962 | free(pichr2);pichr2=NULL; |
---|
963 | free(picmin2);picmin2=NULL; |
---|
964 | free(pichr2_standby);pichr2_standby=NULL; |
---|
965 | free(picmin2_standby);picmin2_standby=NULL; |
---|
966 | addconfig("lcd_samsung_plugin_running", "no"); |
---|
967 | LCD_Samsung1thread = NULL; |
---|
968 | m_lock(&status.drawingmutex, 0); |
---|
969 | if(drawscreen(LCD_Samsung1, 0, 2) == -2) |
---|
970 | printf("nicht genug Speicher fuer drawscreen\n"); |
---|
971 | m_unlock(&status.drawingmutex, 0); |
---|
972 | //status.write_png = 0; |
---|
973 | return; |
---|
974 | } |
---|
975 | |
---|
976 | void LCD_Samsung1_main() |
---|
977 | { |
---|
978 | if(LCD_Samsung1thread == NULL) |
---|
979 | { |
---|
980 | char* tmpstr = NULL; |
---|
981 | |
---|
982 | tmpstr = createpluginpath("/lcdsamsung/start.png", 0); |
---|
983 | tmpstr = ostrcat("cp ", tmpstr, 0, 1); |
---|
984 | tmpstr = ostrcat(tmpstr, " /tmp/titanlcd.png", 1, 0); |
---|
985 | system(tmpstr); |
---|
986 | free(tmpstr); tmpstr=NULL; |
---|
987 | addconfig("lcd_samsung_plugin_running", "yes"); |
---|
988 | LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
989 | addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL); |
---|
990 | sleep(1); |
---|
991 | } |
---|
992 | else |
---|
993 | { |
---|
994 | LCD_Samsung1thread->aktion = STOP; |
---|
995 | system("echo ende > /tmp/titanlcd.jpg"); |
---|
996 | sleep(1); |
---|
997 | system("killall fbread"); |
---|
998 | } |
---|
999 | } |
---|
1000 | |
---|
1001 | //wird beim laden ausgefuehrt |
---|
1002 | void init(void) |
---|
1003 | { |
---|
1004 | char* tmpstr = NULL; |
---|
1005 | pluginaktiv = 1; |
---|
1006 | firststart = 1; |
---|
1007 | |
---|
1008 | tmpstr = ostrcat("/var/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0); |
---|
1009 | if(!file_exist(tmpstr)) |
---|
1010 | { |
---|
1011 | free(tmpstr); tmpstr = NULL; |
---|
1012 | tmpstr = ostrcat("/var/swap/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0); |
---|
1013 | } |
---|
1014 | if(!file_exist(tmpstr)) |
---|
1015 | { |
---|
1016 | free(tmpstr); tmpstr = NULL; |
---|
1017 | tmpstr = ostrcat("/mnt/swapextensions/usr/local/share/titan/plugins/lcdsamsung/skin2.xml", NULL, 0, 0); |
---|
1018 | } |
---|
1019 | if(!file_exist(tmpstr)) |
---|
1020 | { |
---|
1021 | free(tmpstr); tmpstr = NULL; |
---|
1022 | tmpstr = createpluginpath("/lcdsamsung/skin.xml", 0); |
---|
1023 | } |
---|
1024 | |
---|
1025 | printf("use skin: %s\n", tmpstr); |
---|
1026 | |
---|
1027 | readscreen(tmpstr, 119, 1); |
---|
1028 | free(tmpstr); tmpstr = NULL; |
---|
1029 | |
---|
1030 | tmpstr = createpluginpath("/lcdsamsung/black.jpg", 0); |
---|
1031 | tmpstr = ostrcat("cp ", tmpstr, 0, 1); |
---|
1032 | tmpstr = ostrcat(tmpstr, " /tmp/fbreadstop.jpg", 1, 0); |
---|
1033 | |
---|
1034 | system(tmpstr); |
---|
1035 | free(tmpstr); tmpstr = NULL; |
---|
1036 | system("killall fbread"); |
---|
1037 | debug(10, "LCD Samsung SPF.. loadet !!!"); |
---|
1038 | tmpstr = getconfig("lcd_samsung_plugin_running", NULL); |
---|
1039 | if(ostrcmp(tmpstr, "yes") == 0) |
---|
1040 | LCD_Samsung1_main(); |
---|
1041 | tmpstr = NULL; |
---|
1042 | } |
---|
1043 | |
---|
1044 | //wird beim entladen ausgefuehrt |
---|
1045 | void deinit(void) |
---|
1046 | { |
---|
1047 | delmarkedscreen(119); |
---|
1048 | pluginaktiv = 0; |
---|
1049 | system("echo ende > /tmp/titanlcd.png"); |
---|
1050 | sleep(1); |
---|
1051 | system("killall fbread"); |
---|
1052 | debug(10, "LCD Samsung unloadet !!!"); |
---|
1053 | } |
---|
1054 | |
---|
1055 | |
---|
1056 | //wird in der Pluginverwaltung bzw Menue ausfeguehrt |
---|
1057 | void start(void) |
---|
1058 | { |
---|
1059 | struct skin* samsung1_main = getscreen("samsung1_main"); |
---|
1060 | struct skin* listbox = getscreennode(samsung1_main, "listbox"); |
---|
1061 | struct skin* lcdtype = getscreennode(samsung1_main, "lcdtype"); |
---|
1062 | struct skin* allmenu = getscreennode(samsung1_main, "allmenu"); |
---|
1063 | struct skin* aktstandby = getscreennode(samsung1_main, "aktstandby"); |
---|
1064 | struct skin* wettervor = getscreennode(samsung1_main, "wettervor"); |
---|
1065 | struct skin* wettervorort = getscreennode(samsung1_main, "wettervorort"); |
---|
1066 | //struct skin* wettervorplz = getscreennode(samsung1_main, "wettervorplz"); |
---|
1067 | //struct skin* wettervorland = getscreennode(samsung1_main, "wettervorland"); |
---|
1068 | struct skin* b3 = getscreennode(samsung1_main, "b3"); |
---|
1069 | struct skin* tmp = NULL; |
---|
1070 | |
---|
1071 | int rcret = 0; |
---|
1072 | int startstop = 0; |
---|
1073 | int restart = 0; |
---|
1074 | |
---|
1075 | if(getconfig("lcd_samsung_plugin_wetter", NULL) == NULL || ostrcmp(getconfig("lcd_samsung_plugin_wetter", NULL), "no") == 0) |
---|
1076 | { |
---|
1077 | //wettervorplz->hidden = YES; |
---|
1078 | //wettervorland->hidden = YES; |
---|
1079 | wettervorort->hidden = YES; |
---|
1080 | } |
---|
1081 | |
---|
1082 | addchoicebox(lcdtype, "spf72h", _("SPF-72H")); |
---|
1083 | addchoicebox(lcdtype, "spf75h", _("SPF-75H")); |
---|
1084 | addchoicebox(lcdtype, "spf83h", _("SPF-83H")); |
---|
1085 | addchoicebox(lcdtype, "spf85h", _("SPF-85H")); |
---|
1086 | addchoicebox(lcdtype, "spf85p", _("SPF-85P")); |
---|
1087 | addchoicebox(lcdtype, "spf87h", _("SPF-87H")); |
---|
1088 | addchoicebox(lcdtype, "spf87hold", _("SPF-87H-old")); |
---|
1089 | addchoicebox(lcdtype, "spf105p", _("SPF-105P")); |
---|
1090 | addchoicebox(lcdtype, "spf107h", _("SPF-107H")); |
---|
1091 | addchoicebox(lcdtype, "none", _("tiMote")); |
---|
1092 | setchoiceboxselection(lcdtype, getconfig("lcd_samsung_plugin_type", NULL)); |
---|
1093 | |
---|
1094 | addchoicebox(allmenu, "no", _("nein")); |
---|
1095 | addchoicebox(allmenu, "yes", _("ja")); |
---|
1096 | setchoiceboxselection(allmenu, getconfig("write_fb_to_jpg", NULL)); |
---|
1097 | |
---|
1098 | addchoicebox(aktstandby, "no", _("nein")); |
---|
1099 | addchoicebox(aktstandby, "yes", _("ja")); |
---|
1100 | setchoiceboxselection(aktstandby, getconfig("lcd_samsung_plugin_standby", NULL)); |
---|
1101 | |
---|
1102 | addchoicebox(wettervor, "no", _("nein")); |
---|
1103 | addchoicebox(wettervor, "yes", _("ja")); |
---|
1104 | setchoiceboxselection(wettervor, getconfig("lcd_samsung_plugin_wetter", NULL)); |
---|
1105 | |
---|
1106 | //changemask(wettervorplz, "0000"); |
---|
1107 | //if(getconfig("lcd_samsung_plugin_wetterplz", NULL) == NULL) |
---|
1108 | // changeinput(wettervorplz, "10407"); |
---|
1109 | //else |
---|
1110 | // changeinput(wettervorplz, getconfig("lcd_samsung_plugin_wetterplz", NULL)); |
---|
1111 | |
---|
1112 | //changemask(wettervorland, "abcdefghijklmnopqrstuvwxyz"); |
---|
1113 | //if(getconfig("lcd_samsung_plugin_wetterland", NULL) == NULL) |
---|
1114 | // changeinput(wettervorland, "Germany"); |
---|
1115 | //else |
---|
1116 | // changeinput(wettervorland, getconfig("lcd_samsung_plugin_wetterland", NULL)); |
---|
1117 | |
---|
1118 | changemask(wettervorort, "abcdefghijklmnopqrstuvwxyz"); |
---|
1119 | if(getconfig("lcd_samsung_plugin_wetterort", NULL) == NULL) |
---|
1120 | changeinput(wettervorort, "Berlin "); |
---|
1121 | else |
---|
1122 | changeinput(wettervorort, getconfig("lcd_samsung_plugin_wetterort", NULL)); |
---|
1123 | |
---|
1124 | if(LCD_Samsung1thread != NULL) |
---|
1125 | changetext(b3, "STOP"); |
---|
1126 | else |
---|
1127 | changetext(b3, "START"); |
---|
1128 | |
---|
1129 | drawscreen(samsung1_main, 0, 0); |
---|
1130 | addscreenrc(samsung1_main, listbox); |
---|
1131 | tmp = listbox->select; |
---|
1132 | |
---|
1133 | while(1) |
---|
1134 | { |
---|
1135 | addscreenrc(samsung1_main, tmp); |
---|
1136 | rcret = waitrc(samsung1_main, 0, 0); |
---|
1137 | tmp = listbox->select; |
---|
1138 | |
---|
1139 | if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "wettervor") == 0) |
---|
1140 | { |
---|
1141 | if(ostrcmp(wettervor->ret, "yes") == 0) |
---|
1142 | { |
---|
1143 | //wettervorplz->hidden = NO; |
---|
1144 | //wettervorland->hidden = NO; |
---|
1145 | wettervorort->hidden = NO; |
---|
1146 | } else { |
---|
1147 | //wettervorplz->hidden = YES; |
---|
1148 | //wettervorland->hidden = YES; |
---|
1149 | wettervorort->hidden = YES; |
---|
1150 | } |
---|
1151 | |
---|
1152 | drawscreen(samsung1_main, 0, 0); |
---|
1153 | } |
---|
1154 | |
---|
1155 | if(rcret == getrcconfigint("rcexit", NULL)) |
---|
1156 | break; |
---|
1157 | if(rcret == getrcconfigint("rcgreen", NULL)) |
---|
1158 | { |
---|
1159 | addconfig("lcd_samsung_plugin_type", lcdtype->ret); |
---|
1160 | addconfig("write_fb_to_jpg", allmenu->ret); |
---|
1161 | addconfig("lcd_samsung_plugin_standby", aktstandby->ret); |
---|
1162 | addconfig("lcd_samsung_plugin_wetter", wettervor->ret); |
---|
1163 | addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret); |
---|
1164 | //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret); |
---|
1165 | //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret); |
---|
1166 | restart = 1; |
---|
1167 | break; |
---|
1168 | } |
---|
1169 | |
---|
1170 | if(rcret == getrcconfigint("rcblue", NULL)) |
---|
1171 | { |
---|
1172 | addconfig("lcd_samsung_plugin_type", lcdtype->ret); |
---|
1173 | addconfig("write_fb_to_jpg", allmenu->ret); |
---|
1174 | addconfig("lcd_samsung_plugin_standby", aktstandby->ret); |
---|
1175 | addconfig("lcd_samsung_plugin_wetter", wettervor->ret); |
---|
1176 | addconfig("lcd_samsung_plugin_wetterort", wettervorort->ret); |
---|
1177 | //addconfig("lcd_samsung_plugin_wetterplz", wettervorplz->ret); |
---|
1178 | //addconfig("lcd_samsung_plugin_wetterland", wettervorland->ret); |
---|
1179 | startstop = 1; |
---|
1180 | break; |
---|
1181 | } |
---|
1182 | } |
---|
1183 | delownerrc(samsung1_main); |
---|
1184 | clearscreen(samsung1_main); |
---|
1185 | |
---|
1186 | if(LCD_Samsung1thread != NULL && restart == 1) |
---|
1187 | { |
---|
1188 | LCD_Samsung1thread->aktion = STOP; |
---|
1189 | system("killall fbread"); |
---|
1190 | sleep(2); |
---|
1191 | addtimer(&LCD_start_lcd4linux, START, 10000, 1, NULL, NULL, NULL); |
---|
1192 | LCD_Samsung1thread = addtimer(&LCD_Samsung1_thread, START, 10000, 1, NULL, NULL, NULL); |
---|
1193 | sleep(1); |
---|
1194 | return; |
---|
1195 | } |
---|
1196 | if(startstop == 1) |
---|
1197 | { |
---|
1198 | if(LCD_Samsung1thread != NULL) |
---|
1199 | { |
---|
1200 | addconfig("lcd_samsung_plugin_running", "no"); |
---|
1201 | LCD_Samsung1thread->aktion = STOP; |
---|
1202 | sleep(1); |
---|
1203 | system("killall fbread"); |
---|
1204 | debug(10, "LCD Samsung unloadet !!!"); |
---|
1205 | sleep(1); |
---|
1206 | } |
---|
1207 | else { |
---|
1208 | addconfig("lcd_samsung_plugin_running", "yes"); |
---|
1209 | firststart = 1; |
---|
1210 | LCD_Samsung1_main(); |
---|
1211 | } |
---|
1212 | } |
---|
1213 | } |
---|