CWMPPlaylist &MediaDatabase::getPlaylist() { // static if(playlist == NULL) { CWMPPlayer4 &player = MediaDatabase::getPlayer(); CWMPPlaylistCollection plCollection = player.GetPlaylistCollection(); CWMPPlaylistArray plArray = plCollection.getByName(queueName); if(plArray.GetCount() > 0) { playlist = plArray.Item(0); playlist.clear(); } else { playlist = plCollection.newPlaylist(queueName); } player.SetCurrentPlaylist(playlist); } return playlist; }
CWMPPlaylist MediaDatabase::createPlayList(const String &name) { // static if(name.equalsIgnoreCase(queueName)) { throwException(_T("Cannot use name of queue (=%s) as name for playlist"), queueName); } CWMPPlayer4 &player = MediaDatabase::getPlayer(); CWMPPlaylistCollection plCollection = player.GetPlaylistCollection(); CWMPPlaylistArray plArray = plCollection.getByName(name.cstr()); CWMPPlaylist result; if(plArray.GetCount() > 0) { result = plArray.Item(0); result.clear(); } else { result = plCollection.newPlaylist(name.cstr()); } return result; }