Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void makeList(){
- if(sd.exists("TEMP_NFO.DAT")){
- sd.remove("TEMP_NFO.DAT");
- }
- f.open("TEMP_NFO.DAT", O_CREAT);
- f.close();
- char lfn[256];
- char sfn[13];
- char title[30];
- char artist[30];
- char album[30];
- bool haveLfn;
- int duration(0);
- uint32_t pos(0);
- uint16_t fileIndex;
- while(f.openNext(sd.vwd(), O_READ)){
- checkForClient(5);
- String TSTR("LOADING");
- for(int d(0); d < dots; ++d){
- TSTR += ".";
- }
- scroll.fix(true);
- scroll.setText(TSTR.c_str(), true);
- scroll.setPos(55);
- scroll.tick();
- ++dots;
- if(dots > 3){dots = 0;};
- f.getName(lfn, 256);
- Serial.println(lfn);
- f.getSFN(sfn);
- Serial.println(sfn);
- uint32_t trackSize(f.fileSize());
- fileIndex = f.dirIndex();
- f.close();
- if(strstr(lfn, ".mp3")){
- ++musicNbr;
- Serial.println(trackSize);
- MP3player.playMP3(sfn);
- MP3player.trackArtist(artist);
- MP3player.trackTitle(title);
- MP3player.trackAlbum(album);
- Serial.println(MP3player.getBitrate()*8);
- if(MP3player.getBitrate() != 0){
- duration = (trackSize/1000)/(MP3player.getBitrate());
- }
- MP3player.stopTrack();
- tempFile.open("TEMP_NFO.DAT", O_CREAT | O_WRITE);
- tempFile.seekSet(pos);
- writeInfos(lfn, 256);
- writeInfos(title, 30);
- writeInfos(artist, 30);
- writeInfos(album, 30);
- tempFile.write(&duration, 2);
- tempFile.write('\n');
- pos = tempFile.curPosition();
- }
- tempFile.close();
- f.open(sd.vwd(), fileIndex, O_READ);
- f.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement