1 | #ifndef MC_AUDIOPLAYER_H |
---|
2 | #define MC_AUDIOPLAYER_H |
---|
3 | |
---|
4 | extern struct skin* skin; |
---|
5 | extern struct screensaver* screensaver; |
---|
6 | |
---|
7 | void screenmc_audioplayer() |
---|
8 | { |
---|
9 | // workaround for grey background mvi |
---|
10 | struct skin* loadmediadb = getscreen("loading"); |
---|
11 | struct skin* blackscreen = getscreen("blackscreen"); |
---|
12 | drawscreen(blackscreen, 0, 0); |
---|
13 | drawscreen(loadmediadb, 0, 0); |
---|
14 | |
---|
15 | readmediadb(getconfig("mediadbfile", NULL), 0, 0); |
---|
16 | |
---|
17 | char* filename = NULL, *currentdirectory = NULL, *selectedfile = NULL, *lastid = NULL, *tmpstr = NULL; |
---|
18 | int rcret = 0, rcwait = 1000, playerret = 0, flag = 2, skip = 0, eof = 0, playinfobarcount = 0, playinfobarstatus = 1, count = 0, tmpview = 0, playlist = 0, playertype = 0; |
---|
19 | |
---|
20 | tmpstr = ostrcat(getconfig("mc_ap_dirsort", NULL), NULL, 0, 0); |
---|
21 | addconfigtmp("dirsort", tmpstr); |
---|
22 | free(tmpstr), tmpstr = NULL; |
---|
23 | |
---|
24 | // main screen |
---|
25 | struct skin* apskin = getscreen("mc_audioplayer"); |
---|
26 | struct skin* filelistpath = getscreennode(apskin, "filelistpath"); |
---|
27 | struct skin* filelist = getscreennode(apskin, "filelist"); |
---|
28 | struct skin* listbox = getscreennode(apskin, "listbox"); |
---|
29 | struct skin* b2 = getscreennode(apskin, "b2"); |
---|
30 | struct skin* b3 = getscreennode(apskin, "b3"); |
---|
31 | struct skin* b4 = getscreennode(apskin, "b4"); |
---|
32 | |
---|
33 | struct skin* title = getscreennode(apskin, "title"); |
---|
34 | struct skin* thumb = getscreennode(apskin, "thumb"); |
---|
35 | struct skin* actorstext = getscreennode(apskin, "actorstext"); |
---|
36 | struct skin* actors = getscreennode(apskin, "actors"); |
---|
37 | struct skin* genretext = getscreennode(apskin, "genretext"); |
---|
38 | struct skin* genre = getscreennode(apskin, "genre"); |
---|
39 | struct skin* yeartext = getscreennode(apskin, "yeartext"); |
---|
40 | struct skin* year = getscreennode(apskin, "year"); |
---|
41 | struct skin* realnametext = getscreennode(apskin, "realnametext"); |
---|
42 | struct skin* realname = getscreennode(apskin, "realname"); |
---|
43 | struct skin* albumtext = getscreennode(apskin, "albumtext"); |
---|
44 | struct skin* album = getscreennode(apskin, "album"); |
---|
45 | |
---|
46 | // infobar screen |
---|
47 | struct skin* infobar = getscreen("mc_audioplayer_infobar"); |
---|
48 | struct skin* spos = getscreennode(infobar, "pos"); |
---|
49 | struct skin* slen = getscreennode(infobar, "len"); |
---|
50 | struct skin* sreverse = getscreennode(infobar, "reverse"); |
---|
51 | struct skin* sprogress = getscreennode(infobar, "progress"); |
---|
52 | struct skin* b12 = getscreennode(infobar, "b12"); |
---|
53 | struct skin* b13 = getscreennode(infobar, "b13"); |
---|
54 | |
---|
55 | if(getconfigint("mc_ap_uselastdir", NULL) == 1) |
---|
56 | { |
---|
57 | currentdirectory = ostrcat(currentdirectory, getconfig("mc_ap_path", NULL), 1, 0); |
---|
58 | selectedfile = ostrcat(selectedfile, getconfig("mc_ap_selectedfile", NULL), 1, 0); |
---|
59 | } |
---|
60 | else |
---|
61 | { |
---|
62 | currentdirectory = ostrcat(currentdirectory, getconfig("mc_ap_defaultdir", NULL), 1, 0); |
---|
63 | } |
---|
64 | |
---|
65 | // enable listbox and set hidden |
---|
66 | listbox->aktpage = -1; |
---|
67 | listbox->aktline = 0; |
---|
68 | listbox->hidden = YES; |
---|
69 | |
---|
70 | // read configs |
---|
71 | int view = getconfigint("mc_ap_view", NULL); |
---|
72 | int screensaver_delay = getconfigint("screensaver_delay", NULL); |
---|
73 | |
---|
74 | // set allowed filemask |
---|
75 | char* filemask = NULL; |
---|
76 | if((status.expertmodus > 0) || (file_exist("/var/swap/etc/.codecpack"))) |
---|
77 | filemask = ostrcat("*.m3u *.pls *.mp3 *.flac *.ogg *.wma *.ra *.wav", NULL, 0, 0); |
---|
78 | else |
---|
79 | filemask = ostrcat("*.m3u *.pls *.mp3 *.flac *.ogg", NULL, 0, 0); |
---|
80 | |
---|
81 | // disable global transparent/hangtime |
---|
82 | setfbtransparent(255); |
---|
83 | status.hangtime = 99999; |
---|
84 | status.playspeed = 0, status.play = 0, status.pause = 0, status.random = 0; |
---|
85 | |
---|
86 | debug(50, "start screenmc_audioplayer view=%d", view); |
---|
87 | |
---|
88 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
89 | |
---|
90 | if(getconfigint("screensaver", NULL) == 1) |
---|
91 | initscreensaver(); |
---|
92 | |
---|
93 | tmpview = view; |
---|
94 | mc_changeview(view, filelist, apskin, flag); |
---|
95 | thumb->hidden = YES; |
---|
96 | album->hidden = YES; |
---|
97 | title->hidden = YES; |
---|
98 | actors->hidden = YES; |
---|
99 | year->hidden = YES; |
---|
100 | realname->hidden = YES; |
---|
101 | genre->hidden = YES; |
---|
102 | albumtext->hidden = YES; |
---|
103 | actorstext->hidden = YES; |
---|
104 | yeartext->hidden = YES; |
---|
105 | realnametext->hidden = YES; |
---|
106 | genretext->hidden = YES; |
---|
107 | |
---|
108 | getfilelist(apskin, filelistpath, filelist, currentdirectory, filemask, tmpview, selectedfile); |
---|
109 | addscreenrc(apskin, filelist); |
---|
110 | |
---|
111 | while(1) |
---|
112 | { |
---|
113 | if(status.play == 1 && count <= screensaver_delay) |
---|
114 | mc_audioplayer_infobar(apskin, infobar, spos, slen, sreverse, sprogress, b12, b13, NULL); |
---|
115 | |
---|
116 | rcret = waitrcext(apskin, rcwait, 0, tmpview); |
---|
117 | debug(50, "while status play=%d", status.play); |
---|
118 | |
---|
119 | if(rcret != RCTIMEOUT && rcret != getrcconfigint("rcvolup", NULL) && rcret != getrcconfigint("rcvoldown", NULL) && rcret != getrcconfigint("rcmute", NULL)) |
---|
120 | { |
---|
121 | if(count > screensaver_delay && screensaver != NULL) |
---|
122 | { |
---|
123 | if((rcret == getrcconfigint("rcpause", NULL)) || (rcret == getrcconfigint("rc1", NULL)) || (rcret == getrcconfigint("rc3", NULL)) || (rcret == getrcconfigint("rc4", NULL)) || (rcret == getrcconfigint("rc6", NULL)) || (rcret == getrcconfigint("rc7", NULL)) || (rcret == getrcconfigint("rc9", NULL))) |
---|
124 | drawscreen(infobar, 0, 0); |
---|
125 | else |
---|
126 | { |
---|
127 | if(screensaver != NULL && screensaver->type == 3) |
---|
128 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
129 | drawscreen(apskin, 0, 0); |
---|
130 | } |
---|
131 | } |
---|
132 | count = 0; |
---|
133 | rcwait = 1000; |
---|
134 | } |
---|
135 | else if(status.play == 1 && screensaver != NULL) |
---|
136 | count++; |
---|
137 | |
---|
138 | if(status.play == 1 && count > screensaver_delay && screensaver != NULL) |
---|
139 | { |
---|
140 | showscreensaver(); |
---|
141 | rcwait = screensaver->speed; |
---|
142 | } |
---|
143 | |
---|
144 | if(tmpview == 3 && filelist->select != NULL && count < screensaver_delay) |
---|
145 | { |
---|
146 | char* pic = NULL; |
---|
147 | int len1 = 0; |
---|
148 | |
---|
149 | if(ostrcmp(lastid, filelist->select->name) != 0) |
---|
150 | { |
---|
151 | free(lastid), lastid = NULL; |
---|
152 | lastid = ostrcat(lastid, filelist->select->name, 1, 0); |
---|
153 | if(filelist->select != NULL && filelist->select->input == NULL) |
---|
154 | { |
---|
155 | struct mediadb* mnode = getmediadb(filelistpath->text, filelist->select->name, 0); |
---|
156 | if(mnode != NULL) |
---|
157 | { |
---|
158 | if(mnode->id != NULL) |
---|
159 | { |
---|
160 | tmpstr = ostrcat(tmpstr, getconfig("mediadbpath", NULL), 1, 0); |
---|
161 | tmpstr = ostrcat(tmpstr, "/", 1, 0); |
---|
162 | tmpstr = ostrcat(tmpstr, mnode->id, 1, 0); |
---|
163 | |
---|
164 | pic = ostrcat(tmpstr, "_cover.jpg", 0, 0); |
---|
165 | free(tmpstr), tmpstr = NULL; |
---|
166 | } |
---|
167 | |
---|
168 | len1 = strlen(mnode->plot); |
---|
169 | if(mnode->plot != NULL && len1 != 0) |
---|
170 | { |
---|
171 | changetext(album, mnode->plot); |
---|
172 | album->hidden = NO; |
---|
173 | albumtext->hidden = NO; |
---|
174 | } |
---|
175 | else |
---|
176 | { |
---|
177 | album->hidden = YES; |
---|
178 | albumtext->hidden = YES; |
---|
179 | } |
---|
180 | |
---|
181 | len1 = strlen(mnode->plot); |
---|
182 | if(mnode->title != NULL && len1 != 0) |
---|
183 | { |
---|
184 | len1 = strlen(mnode->actors); |
---|
185 | if(mnode->actors != NULL && len1 != 0) |
---|
186 | { |
---|
187 | tmpstr = ostrcat(tmpstr, mnode->actors, 1, 0); |
---|
188 | tmpstr = ostrcat(tmpstr, " - ", 1, 0); |
---|
189 | actors->hidden = NO; |
---|
190 | actorstext->hidden = NO; |
---|
191 | } |
---|
192 | else |
---|
193 | { |
---|
194 | actors->hidden = YES; |
---|
195 | actorstext->hidden = YES; |
---|
196 | } |
---|
197 | tmpstr = ostrcat(tmpstr, mnode->title, 1, 0); |
---|
198 | |
---|
199 | if(mnode->year != 0) |
---|
200 | { |
---|
201 | tmpstr = ostrcat(tmpstr, " (", 1, 0); |
---|
202 | tmpstr = ostrcat(tmpstr, oitoa(mnode->year), 1, 0); |
---|
203 | tmpstr = ostrcat(tmpstr, ")", 1, 0); |
---|
204 | year->hidden = NO; |
---|
205 | yeartext->hidden = NO; |
---|
206 | } |
---|
207 | else |
---|
208 | { |
---|
209 | year->hidden = YES; |
---|
210 | yeartext->hidden = YES; |
---|
211 | } |
---|
212 | if(tmpstr != NULL) |
---|
213 | { |
---|
214 | changetext(title, tmpstr); |
---|
215 | title->hidden = NO; |
---|
216 | } |
---|
217 | else |
---|
218 | { |
---|
219 | changetext(title, filelist->select->name); |
---|
220 | title->hidden = NO; |
---|
221 | } |
---|
222 | free(tmpstr), tmpstr = NULL; |
---|
223 | |
---|
224 | changetext(realname, filelist->select->name); |
---|
225 | realname->hidden = NO; |
---|
226 | realnametext->hidden = NO; |
---|
227 | } |
---|
228 | else |
---|
229 | { |
---|
230 | realname->hidden = YES; |
---|
231 | realnametext->hidden = YES; |
---|
232 | changetext(title, filelist->select->name); |
---|
233 | title->hidden = NO; |
---|
234 | } |
---|
235 | |
---|
236 | len1 = strlen(mnode->actors); |
---|
237 | if(mnode->actors != NULL && len1 != 0) |
---|
238 | { |
---|
239 | changetext(actors, mnode->actors); |
---|
240 | actors->hidden = NO; |
---|
241 | actorstext->hidden = NO; |
---|
242 | } |
---|
243 | else |
---|
244 | { |
---|
245 | actors->hidden = YES; |
---|
246 | actorstext->hidden = YES; |
---|
247 | } |
---|
248 | |
---|
249 | len1 = strlen(mnode->genre); |
---|
250 | if(mnode->genre != NULL && len1 != 0) |
---|
251 | { |
---|
252 | changetext(genre, mnode->genre); |
---|
253 | genre->hidden = NO; |
---|
254 | genretext->hidden = NO; |
---|
255 | } |
---|
256 | else |
---|
257 | { |
---|
258 | genre->hidden = YES; |
---|
259 | genretext->hidden = YES; |
---|
260 | } |
---|
261 | |
---|
262 | if(mnode->year != 0) |
---|
263 | { |
---|
264 | changetext(year, oitoa(mnode->year)); |
---|
265 | year->hidden = NO; |
---|
266 | yeartext->hidden = NO; |
---|
267 | } |
---|
268 | else |
---|
269 | { |
---|
270 | year->hidden = YES; |
---|
271 | yeartext->hidden = YES; |
---|
272 | } |
---|
273 | } |
---|
274 | else |
---|
275 | { |
---|
276 | thumb->hidden = YES; |
---|
277 | album->hidden = YES; |
---|
278 | title->hidden = YES; |
---|
279 | actors->hidden = YES; |
---|
280 | year->hidden = YES; |
---|
281 | realname->hidden = YES; |
---|
282 | genre->hidden = YES; |
---|
283 | albumtext->hidden = YES; |
---|
284 | actorstext->hidden = YES; |
---|
285 | yeartext->hidden = YES; |
---|
286 | realnametext->hidden = YES; |
---|
287 | genretext->hidden = YES; |
---|
288 | free(pic), pic = NULL; |
---|
289 | } |
---|
290 | |
---|
291 | if(file_exist(pic)) |
---|
292 | { |
---|
293 | changepic(thumb, pic); |
---|
294 | thumb->hidden = NO; |
---|
295 | } |
---|
296 | else |
---|
297 | thumb->hidden = YES; |
---|
298 | |
---|
299 | free(pic), pic = NULL; |
---|
300 | drawscreen(apskin, 0, 0); |
---|
301 | } |
---|
302 | else |
---|
303 | { |
---|
304 | thumb->hidden = YES; |
---|
305 | album->hidden = YES; |
---|
306 | title->hidden = YES; |
---|
307 | actors->hidden = YES; |
---|
308 | year->hidden = YES; |
---|
309 | realname->hidden = YES; |
---|
310 | genre->hidden = YES; |
---|
311 | albumtext->hidden = YES; |
---|
312 | actorstext->hidden = YES; |
---|
313 | yeartext->hidden = YES; |
---|
314 | realnametext->hidden = YES; |
---|
315 | genretext->hidden = YES; |
---|
316 | free(pic), pic = NULL; |
---|
317 | drawscreen(apskin, 0, 0); |
---|
318 | |
---|
319 | } |
---|
320 | if(status.play == 1) |
---|
321 | drawscreen(infobar, 0, 0); |
---|
322 | } |
---|
323 | } |
---|
324 | |
---|
325 | if(rcret == getrcconfigint("rc1", NULL)) |
---|
326 | { |
---|
327 | if((status.play == 1) || (status.playspeed != 0)) |
---|
328 | playrcjumpr(filename, 10, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
329 | } |
---|
330 | else if(rcret == getrcconfigint("rc4", NULL)) |
---|
331 | { |
---|
332 | if((status.play == 1) || (status.playspeed != 0)) |
---|
333 | playrcjumpr(filename, 30, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
334 | } |
---|
335 | else if(rcret == getrcconfigint("rc7", NULL)) |
---|
336 | { |
---|
337 | if((status.play == 1) || (status.playspeed != 0)) |
---|
338 | playrcjumpr(filename, 60, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
339 | } |
---|
340 | else if(rcret == getrcconfigint("rc3", NULL)) |
---|
341 | { |
---|
342 | if((status.play == 1) || (status.playspeed != 0)) |
---|
343 | playrcjumpf(filename, 10, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
344 | } |
---|
345 | else if(rcret == getrcconfigint("rc6", NULL)) |
---|
346 | { |
---|
347 | if((status.play == 1) || (status.playspeed != 0)) |
---|
348 | playrcjumpf(filename, 30, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
349 | } |
---|
350 | else if(rcret == getrcconfigint("rc9", NULL)) |
---|
351 | { |
---|
352 | if((status.play == 1) || (status.playspeed != 0)) |
---|
353 | playrcjumpf(filename, 60, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
354 | } |
---|
355 | else if(rcret == getrcconfigint("rcff", NULL)) |
---|
356 | { |
---|
357 | if((status.play == 1) || (status.playspeed != 0)) |
---|
358 | playrcff(filename, &playinfobarstatus, &playinfobarcount, playertype, 2); |
---|
359 | } |
---|
360 | else if(rcret == getrcconfigint("rcfr", NULL)) |
---|
361 | { |
---|
362 | if((status.play == 1) || (status.playspeed != 0)) |
---|
363 | playrcfr(filename, &playinfobarstatus, &playinfobarcount, playertype, 2); |
---|
364 | } |
---|
365 | else if(rcret == getrcconfigint("rcplay", NULL)) |
---|
366 | { |
---|
367 | if((status.play == 1) || (status.playspeed != 0)) |
---|
368 | playrcplay(filename, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
369 | //showplaylist(1); |
---|
370 | } |
---|
371 | else if(rcret == getrcconfigint("rcpause", NULL)) |
---|
372 | { |
---|
373 | if(status.pause == 1) |
---|
374 | { |
---|
375 | if(screensaver != NULL && screensaver->type == 3) |
---|
376 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
377 | drawscreen(apskin, 0, 0); |
---|
378 | } |
---|
379 | if((status.play == 1) || (status.pause == 1)) |
---|
380 | playrcpause(filename, &playinfobarstatus, &playinfobarcount, playertype, flag); |
---|
381 | } |
---|
382 | else if((rcret == getrcconfigint("rcchdown", NULL)) || (rcret == getrcconfigint("rcnext", NULL))) |
---|
383 | { |
---|
384 | if(status.play == 1) |
---|
385 | eof = 1; |
---|
386 | } |
---|
387 | else if((rcret == getrcconfigint("rcchup", NULL)) || (rcret == getrcconfigint("rcprev", NULL))) |
---|
388 | { |
---|
389 | if(status.play == 1) |
---|
390 | eof = 2; |
---|
391 | } |
---|
392 | else if(rcret == getrcconfigint("rcblue", NULL)) |
---|
393 | { |
---|
394 | debug(50, "rcblue: repeat"); |
---|
395 | |
---|
396 | if(status.repeat == 0) |
---|
397 | { |
---|
398 | changetext(b4, _("Repeat-On")); |
---|
399 | drawscreen(apskin, 0, 0); |
---|
400 | status.repeat = 1; |
---|
401 | } |
---|
402 | else |
---|
403 | { |
---|
404 | status.repeat = 0; |
---|
405 | changetext(b4, _("Repeat")); |
---|
406 | drawscreen(apskin, 0, 0); |
---|
407 | } |
---|
408 | } |
---|
409 | else if(rcret == getrcconfigint("rcyellow", NULL)) |
---|
410 | { |
---|
411 | playerrandom(apskin, filelist, listbox, b3, playlist, flag); |
---|
412 | } |
---|
413 | else if(rcret == getrcconfigint("rcred", NULL)) |
---|
414 | { |
---|
415 | if(playlist == 0) |
---|
416 | { |
---|
417 | int sort = screendirsort(); |
---|
418 | debug(50, "rcred: tmpsort=%d", sort); |
---|
419 | |
---|
420 | addconfiginttmp("dirsort", sort); |
---|
421 | mc_changeview(tmpview, filelist, apskin, flag); |
---|
422 | |
---|
423 | delownerrc(apskin); |
---|
424 | getfilelist(apskin, filelistpath, filelist, filelistpath->text, filemask, tmpview, filelist->select->name); |
---|
425 | addscreenrc(apskin, filelist); |
---|
426 | drawscreen(apskin, 0, 0); |
---|
427 | } |
---|
428 | } |
---|
429 | else if(rcret == getrcconfigint("rcgreen", NULL)) |
---|
430 | { |
---|
431 | showplaylist(apskin, filelistpath, filelist, listbox, b2, 0, &playlist, &eof, &filename, ¤tdirectory, &playertype, flag); |
---|
432 | drawscreen(apskin, 0, 0); |
---|
433 | } |
---|
434 | else if(rcret == getrcconfigint("rcmenu", NULL)) |
---|
435 | { |
---|
436 | if(status.play == 0 && status.pause == 0) |
---|
437 | { |
---|
438 | debug(50, "rcmenu: settings"); |
---|
439 | |
---|
440 | view = getconfigint("mc_ap_view", NULL); |
---|
441 | printf("view in: %d\n", view); |
---|
442 | printf("tmpview in: %d\n", tmpview); |
---|
443 | |
---|
444 | screenmc_audioplayer_settings(); |
---|
445 | drawscreen(blackscreen, 0, 0); |
---|
446 | drawscreen(loadmediadb, 0, 0); |
---|
447 | |
---|
448 | if(view != getconfigint("mc_ap_view", NULL)) |
---|
449 | { |
---|
450 | printf("view changed > change tmpview\n"); |
---|
451 | tmpview = getconfigint("mc_ap_view", NULL); |
---|
452 | } |
---|
453 | |
---|
454 | if(getconfig("mc_ap_dirsort", NULL) != getconfig("dirsort", NULL)) |
---|
455 | { |
---|
456 | char* tmpstr = NULL; |
---|
457 | tmpstr = ostrcat(getconfig("mc_ap_dirsort", NULL), NULL, 0, 0); |
---|
458 | addconfigtmp("dirsort", tmpstr); |
---|
459 | free(tmpstr), tmpstr = NULL; |
---|
460 | } |
---|
461 | |
---|
462 | printf("1view in: %d\n", view); |
---|
463 | printf("1tmpview in: %d\n", tmpview); |
---|
464 | |
---|
465 | mc_changeview(tmpview, filelist, apskin, flag); |
---|
466 | drawscreen(blackscreen, 0, 0); |
---|
467 | drawscreen(loadmediadb, 0, 0); |
---|
468 | |
---|
469 | printf("2view in: %d\n", view); |
---|
470 | printf("2tmpview in: %d\n", tmpview); |
---|
471 | |
---|
472 | delownerrc(apskin); |
---|
473 | getfilelist(apskin, filelistpath, filelist, filelistpath->text, filemask, tmpview, filelist->select->name); |
---|
474 | addscreenrc(apskin, filelist); |
---|
475 | |
---|
476 | screensaver_delay = getconfigint("screensaver_delay", NULL); |
---|
477 | deinitscreensaver(); |
---|
478 | if(getconfigint("screensaver", NULL) == 1) |
---|
479 | initscreensaver(); |
---|
480 | |
---|
481 | drawscreen(apskin, 0, 0); |
---|
482 | } |
---|
483 | } |
---|
484 | else if(rcret == getrcconfigint("rcinfo", NULL)) |
---|
485 | { |
---|
486 | printf("Title: %s\n", playergetinfo("Title")); |
---|
487 | printf("Artist: %s\n", playergetinfo("Artist")); |
---|
488 | printf("Album: %s\n", playergetinfo("Album")); |
---|
489 | printf("Year: %s\n", playergetinfo("Year")); |
---|
490 | printf("Genre: %s\n", playergetinfo("Genre")); |
---|
491 | printf("Comment: %s\n", playergetinfo("Comment")); |
---|
492 | printf("Track: %s\n", playergetinfo("Track")); |
---|
493 | printf("Copyright: %s\n", playergetinfo("Copyright")); |
---|
494 | printf("TestLibEplayer: %s\n", playergetinfo("TestLibEplayer")); |
---|
495 | } |
---|
496 | else if(rcret == getrcconfigint("rcstop", NULL) || (rcret == getrcconfigint("rcexit", NULL) && status.play == 1)) |
---|
497 | { |
---|
498 | |
---|
499 | // if((status.play == 1) || (status.pause == 1)) |
---|
500 | // { |
---|
501 | debug(50, "rcstop: stopplayback"); |
---|
502 | drawscreen(blackscreen, 0, 0); |
---|
503 | drawscreen(loadmediadb, 0, 0); |
---|
504 | playerstop(); |
---|
505 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
506 | |
---|
507 | filelist->hidden = NO; |
---|
508 | listbox->hidden = YES; |
---|
509 | changetext(filelistpath, _(getconfig("mc_ap_path", NULL))); |
---|
510 | changetext(b2, _("Filelist-Mode")); |
---|
511 | |
---|
512 | // switch filelist |
---|
513 | delownerrc(apskin); |
---|
514 | addscreenrc(apskin, filelist); |
---|
515 | |
---|
516 | drawscreen(apskin, 0, 0); |
---|
517 | clearscreen(loadmediadb); |
---|
518 | clearscreen(blackscreen); |
---|
519 | |
---|
520 | sleep(1); |
---|
521 | status.playspeed = 0; |
---|
522 | status.pause = 0; |
---|
523 | status.play = 0; |
---|
524 | playlist = 0; |
---|
525 | |
---|
526 | writevfd("AudioPlayer Filelist-Mode"); |
---|
527 | // } |
---|
528 | } |
---|
529 | else if(rcret == getrcconfigint("rcexit", NULL)) |
---|
530 | { |
---|
531 | debug(50, "exit - save mc_ap_path: %s", filelistpath->text); |
---|
532 | debug(50, "exit - save mc_ap_selectedfile: %s", filelistpath->text); |
---|
533 | drawscreen(blackscreen, 0, 0); |
---|
534 | drawscreen(loadmediadb, 0, 0); |
---|
535 | |
---|
536 | if(playlist == 0) |
---|
537 | { |
---|
538 | if(filelistpath->text != NULL && ostrcmp(getconfig("mc_ap_path", NULL), filelistpath->text) != 0) |
---|
539 | addconfig("mc_ap_path", filelistpath->text); |
---|
540 | if(filelist->select != NULL && filelist->select->name != NULL && ostrcmp(getconfig("mc_ap_selectedfile", NULL), filelist->select->name) != 0) |
---|
541 | addconfig("mc_ap_selectedfile", filelist->select->name); |
---|
542 | |
---|
543 | } |
---|
544 | |
---|
545 | servicestop(status.aktservice, 1, 1); |
---|
546 | playerstop(); |
---|
547 | drawscreen(blackscreen, 0, 0); |
---|
548 | drawscreen(loadmediadb, 0, 0); |
---|
549 | |
---|
550 | sleep(1); |
---|
551 | filelist->hidden = NO; |
---|
552 | listbox->hidden = YES; |
---|
553 | changetext(b2, _("Filelist-Mode")); |
---|
554 | changetext(b3, _("Random")); |
---|
555 | changetext(b4, _("Repeat")); |
---|
556 | status.playspeed = 0; |
---|
557 | status.pause = 0; |
---|
558 | status.play = 0; |
---|
559 | status.random = 0; |
---|
560 | status.repeat = 0; |
---|
561 | playlist = 0; |
---|
562 | writevfd("Mediacenter"); |
---|
563 | |
---|
564 | printf("exit: view=%d tmpview=%d\n", view, tmpview); |
---|
565 | unlink("/tmp/.autoscan"); |
---|
566 | break; |
---|
567 | } |
---|
568 | else if(rcret == getrcconfigint("rcok", NULL)) |
---|
569 | { |
---|
570 | if(playlist == 1 && listbox->select != NULL) |
---|
571 | { |
---|
572 | debug(50, "listbox->select->name: %s", listbox->select->name); |
---|
573 | filename = ostrcat("", listbox->select->name, 0, 0); |
---|
574 | |
---|
575 | changetext(b2, _("Playlist-Mode")); |
---|
576 | |
---|
577 | debug(50, "screensaver title: %s", listbox->select->text); |
---|
578 | if(screensaver != NULL && screensaver->type == 0) |
---|
579 | screensaver->value = listbox->select->text; |
---|
580 | |
---|
581 | debug(50, "playerstop"); |
---|
582 | playerstop(); |
---|
583 | sleep(1); |
---|
584 | drawscreen(infobar, 0, 0); |
---|
585 | debug(50, "playerstart: %s", filename); |
---|
586 | eof = 0; |
---|
587 | |
---|
588 | playerret = playerstart(filename); |
---|
589 | playwritevfd(filename); |
---|
590 | |
---|
591 | #ifndef SIMULATE |
---|
592 | if(playerret != 0) |
---|
593 | { |
---|
594 | textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
595 | /* |
---|
596 | writevfd("AudioPlayer Filelist-Mode"); |
---|
597 | status.play = 0; |
---|
598 | playlist = 0; |
---|
599 | status.playspeed = 0; |
---|
600 | |
---|
601 | changetext(filelistpath, _(getconfig("mc_ap_path", NULL))); |
---|
602 | filelist->hidden = NO; |
---|
603 | listbox->hidden = YES; |
---|
604 | |
---|
605 | delownerrc(apskin); |
---|
606 | addscreenrc(apskin, filelist); |
---|
607 | drawscreen(apskin, 0, 0); |
---|
608 | */ |
---|
609 | // test |
---|
610 | status.play = 1; |
---|
611 | eof = 1; |
---|
612 | // test |
---|
613 | continue; |
---|
614 | } |
---|
615 | #endif |
---|
616 | |
---|
617 | status.play = 1; |
---|
618 | } |
---|
619 | else if(filelist->select != NULL && filelist->select->input != NULL) |
---|
620 | { |
---|
621 | // workaround dont open folder on rcchup |
---|
622 | if(skip == 1) |
---|
623 | { |
---|
624 | drawscreen(apskin, 0, 0); |
---|
625 | writerc(getrcconfigint("rcok", NULL)); |
---|
626 | skip = 0; |
---|
627 | } |
---|
628 | else |
---|
629 | { |
---|
630 | debug(50, "mc_mounter_chk start"); |
---|
631 | mc_mounter_chk(filelistpath); |
---|
632 | debug(50, "mc_mounter_chk done"); |
---|
633 | |
---|
634 | char* checkautoscan = NULL; |
---|
635 | checkautoscan = readfiletomem("/tmp/.autoscan", 0); |
---|
636 | |
---|
637 | if(filelistpath->text != NULL && ostrcmp(checkautoscan, filelistpath->text) != 0) |
---|
638 | unlink("/tmp/.autoscan"); |
---|
639 | |
---|
640 | free(checkautoscan), checkautoscan = NULL; |
---|
641 | } |
---|
642 | } |
---|
643 | else if(filelist->select != NULL && filelist->select->input == NULL) |
---|
644 | { |
---|
645 | if(filelistpath->text != NULL && ostrcmp(getconfig("mc_ap_path", NULL), filelistpath->text) != 0) |
---|
646 | addconfig("mc_ap_path", filelistpath->text); |
---|
647 | |
---|
648 | debug(50, "filelist->select->text: %s", filelist->select->text); |
---|
649 | filename = createpath(filelistpath->text, filelist->select->name); |
---|
650 | printf("name: %s\n",filelist->select->name); |
---|
651 | printf("text: %s\n",filelist->select->text); |
---|
652 | |
---|
653 | if(cmpfilenameext(filename, ".rar") == 0 || cmpfilenameext(filename, ".iso") == 0 || cmpfilenameext(filename, ".img") == 0) |
---|
654 | { |
---|
655 | debug(50, "mc_mounter_main filename: %s", filename); |
---|
656 | //addconfig("mc_ap_path", filelistpath->text); |
---|
657 | currentdirectory = ostrcat("", getconfig("mc_ap_path", NULL), 0, 0); |
---|
658 | selectedfile = ostrcat(selectedfile, getconfig("mc_ap_selectedfile", NULL), 0, 0); |
---|
659 | |
---|
660 | mc_mounter_main(0,filename,filelistpath,filelist,apskin,filemask,tmpview,currentdirectory); |
---|
661 | debug(50, "mc_mounter_main done"); |
---|
662 | |
---|
663 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
664 | continue; |
---|
665 | } |
---|
666 | else if(cmpfilenameext(filename, ".m3u") == 0 || cmpfilenameext(filename, ".pls") == 0) |
---|
667 | { |
---|
668 | showplaylist(apskin, filelistpath, filelist, listbox, b2, 1, &playlist, &eof, &filename, ¤tdirectory, &playertype, flag); |
---|
669 | drawscreen(apskin, 0, 0); |
---|
670 | continue; |
---|
671 | } |
---|
672 | |
---|
673 | changetext(b2, _("Filelist-Mode")); |
---|
674 | |
---|
675 | if(screensaver != NULL && screensaver->type == 0) |
---|
676 | screensaver->value = (void*)filelist->select->text; |
---|
677 | |
---|
678 | debug(50, "playerstop"); |
---|
679 | playerstop(); |
---|
680 | sleep(1); |
---|
681 | |
---|
682 | drawscreen(infobar, 0, 0); |
---|
683 | debug(50, "playerstart: %s", filename); |
---|
684 | eof = 0; |
---|
685 | playerret = playerstart(filename); |
---|
686 | playwritevfd(filename); |
---|
687 | |
---|
688 | #ifndef SIMULATE |
---|
689 | if(playerret != 0) |
---|
690 | { |
---|
691 | writevfd("AudioPlayer Filelist-Mode"); |
---|
692 | status.play = 0; |
---|
693 | status.playspeed = 0; |
---|
694 | textbox(_("Message"), _("Can't start playback !"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0); |
---|
695 | continue; |
---|
696 | } |
---|
697 | #endif |
---|
698 | |
---|
699 | status.play = 1; |
---|
700 | |
---|
701 | singlepicstart("/var/usr/local/share/titan/plugins/mc/skin/default.mvi", 0); |
---|
702 | |
---|
703 | if(status.mediadbfiles == 0 && getconfigint("mc_ap_autoscan", NULL) == 1 && !file_exist("/tmp/.autoscan")) |
---|
704 | { |
---|
705 | if(filelistpath->text != NULL) |
---|
706 | { |
---|
707 | mediadbscan(filelistpath->text, 1001, 1); |
---|
708 | writesys("/tmp/.autoscan", filelistpath->text, 0); |
---|
709 | status.mediadbfiles = findfiles(currentdirectory, 1, 1, 1, 1); //count only |
---|
710 | } |
---|
711 | else |
---|
712 | { |
---|
713 | mediadbscan(currentdirectory, 1001, 1); |
---|
714 | writesys("/tmp/.autoscan", currentdirectory, 0); |
---|
715 | status.mediadbfiles = findfiles(currentdirectory, 1, 1, 1, 1); //count only |
---|
716 | } |
---|
717 | printf("status.mediadbfiles: %d\n",status.mediadbfiles); |
---|
718 | } |
---|
719 | } |
---|
720 | } |
---|
721 | if(eof >=1 || playerisplaying() == 0) |
---|
722 | { |
---|
723 | if(status.play == 1) |
---|
724 | playereof(apskin, filelist, listbox, filelistpath, b2, NULL, NULL, NULL, &skip, &eof, &playlist, playertype, flag); |
---|
725 | } |
---|
726 | } |
---|
727 | |
---|
728 | deinitscreensaver(); |
---|
729 | |
---|
730 | status.hangtime = getconfigint("hangtime", NULL); |
---|
731 | delconfigtmp("dirsort"); |
---|
732 | |
---|
733 | delmarkedscreennodes(apskin, FILELISTDELMARK); |
---|
734 | delownerrc(apskin); |
---|
735 | clearscreen(apskin); |
---|
736 | |
---|
737 | free(lastid), lastid = NULL; |
---|
738 | free(filename), filename = NULL; |
---|
739 | free(currentdirectory), currentdirectory = NULL; |
---|
740 | free(selectedfile), selectedfile = NULL; |
---|
741 | |
---|
742 | if(status.mediadbthread == NULL) |
---|
743 | { |
---|
744 | if(status.writemediadb == 1) |
---|
745 | writemediadb(getconfig("mediadbfile", NULL), NULL); |
---|
746 | freemediadb(0); |
---|
747 | } |
---|
748 | |
---|
749 | clearscreen(blackscreen); |
---|
750 | clearscreen(loadmediadb); |
---|
751 | |
---|
752 | writevfd("Mediacenter"); |
---|
753 | debug(50, "closed"); |
---|
754 | } |
---|
755 | |
---|
756 | #endif |
---|
757 | |
---|