source: titan/plugins/mc/mc_audioplayer.h @ 41843

Last change on this file since 41843 was 41843, checked in by gost, 6 years ago

[plugins] lcdsamsung.. test mc-cover for sh4

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