Changeset 16624


Ignore:
Timestamp:
06/17/12 13:20:00 (12 years ago)
Author:
nit
Message:

[titan] update tmc, change playlist random/max to get data direkt from playlist and not from skin

Location:
titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/tmc/tmc.h

    r16622 r16624  
    1010//Mainmenu
    1111int menu0pos = 0;
    12 char* menu0[] = {"skin/tmcsettings.png", "skin/tmcpicture.png", "skin/tmcvideo.png", "skin/tmcaudio.png", "skin/tmcexit.png"};
    13 char* menu0txt[] = {"Settings", "Picture", "Video", "Audio", "Exit"};
     12char* menu0[] = {"skin/tmcsettings.png", "skin/tmcpicture.png", "skin/tmcvideo.png", "skin/tmcaudio.png", "skin/tmcplaylist.png", "skin/tmcexit.png"};
     13char* menu0txt[] = {"Settings", "Picture", "Video", "Audio", "Playlist", "Exit"};
    1414
    1515//Settings
    1616int menu1pos = 0;
    17 char* menu1[] = {"skin/tmcscan.png", "skin/tmcscandir.png", "skin/tmcsettings.png", "skin/tmcdb.png", "skin/tmcback.png"};
    18 char* menu1txt[] = {"Scan All", "Scan Dir", "Main", "Database Info", "Back"};
     17char* menu1[] = {"skin/tmcscan.png", "skin/tmcscandir.png", "skin/tmcsettings.png", "skin/tmcdb.png", "skin/tmceditplaylist.png", "skin/tmcback.png"};
     18char* menu1txt[] = {"Scan All", "Scan Dir", "Main", "Database Info", "Playlist Edit", "Back"};
    1919
    2020//Picture
     
    545545}
    546546
     547//flag 0: editmode
     548//flag 1: showmode
     549struct mainplaylist* screentmcplaylist(int flag)
     550{
     551//TODO:
     552        struct mainplaylist* mplaylist = NULL;
     553        struct skin* playlist = getscreen("playlist");
     554        char* bg = NULL;
     555
     556        drawscreen(playlist, 2, 0);
     557        bg = savescreen(playlist);
     558
     559        mplaylist = screenmainplaylist(flag);
     560
     561        restorescreen(bg, playlist);
     562        blitfb(0);
     563
     564        return mplaylist;
     565}
     566
    547567void screentmcedit(char* file, int menuid)
    548568{
     
    955975{
    956976        int rcret = 0, menuid = 0, active = 1;
    957         int audioplaytype = 0, picplaytype = 0;
     977        int audioplaytype = 0, picplaytype = 0, playlistplaytype = 0;
    958978        struct skin* tmcbg = getscreen("tmcbg");
    959979        struct skin* load = getscreen("loading");
     
    11511171                                        screentmcdb();
    11521172                                }
     1173                                else if(menuid == 1 && ostrcmp("Playlist Edit", tmcmenutxt->ret) == 0)
     1174                                {
     1175                                        screentmcplaylist(0);
     1176                                }
    11531177                                else if(menuid == 1 && ostrcmp("Main", tmcmenutxt->ret) == 0)
    11541178                                {
     
    13821406                                        tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu3p2, tmcmenu4, tmcmenu5, 0);
    13831407                                }
     1408                                else if(ostrcmp("Playlist", tmcmenutxt->ret) == 0) //playlist
     1409                                {
     1410                                        int playlistret = 0;
     1411                                        struct mainplaylist* mplaylist = NULL;
     1412
     1413                                        mplaylist = screentmcplaylist(1);
     1414                                        if(mplaylist != NULL)
     1415                                        {
     1416                                                struct playlist* plist = mplaylist->playlist;
     1417                                                drawscreen(skin, 0, 0);
     1418                                                if(servicestop(status.aktservice, 1, 1) == 0)
     1419                                                {
     1420                                                        while(plist != NULL)
     1421                                                        {
     1422                                                                //TODO: play playlist
     1423                                                                playlistret = screenplay(plist->file, 0, 0);
     1424                                                                if(playlistret == 1 || playlistret == 2) break;
     1425
     1426                                                                if(playlistplaytype == 2) //random
     1427                                                                        plist = getplaylistrandom(mplaylist->playlist, getplaylistmax(mplaylist->playlist));
     1428                                                                else //next
     1429                                                                        plist = plist->next;
     1430                                                        }
     1431
     1432                                                        playstartservice();
     1433                                                }
     1434
     1435                                                drawscreen(tmcbg, 0, 1);
     1436                                                tmcpicscroll(menuid, tmcpictitle, tmcpicstar, tmcstatus, tmcpic1, tmcpic2, tmcpic3, tmcpic4, tmcpic5, tmcpictitlebg, tmcpicstarbg, tmcstatusbg, 0);
     1437                                                tmcmenuscroll(menuid, active, tmcmenutxt, tmcmenu1, tmcmenu2, tmcmenu3, tmcmenu3p2, tmcmenu4, tmcmenu5, 0);
     1438                                        }
     1439                                }
    13841440
    13851441                                continue;
     
    14061462                                        mfilter = mediadbfilterpos;
    14071463
    1408                                         if(servicestop(status.aktservice, 1, 1) == 1)
     1464                                        if(servicestop(status.aktservice, 1, 1) == 0)
    14091465                                        if(rcret == 0)
    14101466                                        {
  • titan/titan/playlist.h

    r16511 r16624  
    492492}
    493493
    494 void getplaylistmax(struct skin* playlist, int* maxdirs, int* maxfiles)
    495 {
    496         struct skin* node = playlist;
    497 
    498         while(node != NULL)
    499         {
    500                 if(node->del == 2)
    501                 {
    502                         if(node->input != NULL)
    503                                 (*maxdirs)++;
    504                         else
    505                                 (*maxfiles)++;
    506                 }
    507                 node = node->next;
    508         }
    509 }
    510 
    511 struct skin* getplaylistrandom(struct skin* playlist, int maxdirs, int maxfiles)
     494int getplaylistmax(struct playlist* plist)
    512495{
    513496        int count = 0;
    514         struct skin* node = playlist;
     497        struct skin* node = plist;
     498
     499        while(node != NULL)
     500        {
     501                count++;
     502                node = node->next;
     503        }
     504
     505        return count;
     506}
     507
     508struct playlist* getplaylistrandom(struct playlist* plist, int max)
     509{
     510        int count = 0;
     511        struct skin* node = plist;
    515512       
    516         if(maxfiles < 1) return NULL;
     513        if(max < 1) return NULL;
    517514
    518515        srand(time(NULL));
    519         int r = rand() % maxfiles;
     516        int r = rand() % max;
    520517        r++;
    521518
    522519        while(node != NULL)
    523520        {
    524                 if(node->del == 2 && node->input == NULL)
    525                 {
    526                         count++;
    527                         if(count == r) break;
    528                 }
     521                count++;
     522                if(count == r) break;
    529523
    530524                node = node->next;
Note: See TracChangeset for help on using the changeset viewer.