Skip to content

Commit b24a419

Browse files
committed
fix m3u with audiofiles in subfolder #136
1 parent ab859f5 commit b24a419

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MiniWebRadio -- Webradio receiver for ESP32
33
44
first release on 03/2017
5-
Version 2.4c, Dec 12/2022
5+
Version 2.4d, Mar 13/2022
66
77
2.8" color display (320x240px) with controller ILI9341 or HX8347D (SPI) or
88
3.5" color display (480x320px) wiht controller ILI9486 or ILI9488 (SPI)
@@ -901,11 +901,13 @@ const char* listAudioFile(){
901901
audioFile.close();
902902
return nullptr;
903903
}
904-
while(file){
904+
else{
905+
if(file.isDirectory()) return "dir";
905906
strcpy(_chbuf, file.name());
906907
if(endsWith(_chbuf, ".mp3") || endsWith(_chbuf, ".aac") || endsWith(_chbuf, ".m4a") ||
907908
endsWith(_chbuf, ".wav") || endsWith(_chbuf, ".flac")||
908-
endsWith(_chbuf, ".m3u")){
909+
endsWith(_chbuf, ".m3u") || endsWith(_chbuf, ".opus")){
910+
909911
return _chbuf;
910912
}
911913
else{
@@ -923,6 +925,7 @@ bool sendAudioList2Web(const char* audioDir){
923925
while(true){
924926
FileName = listAudioFile();
925927
if(!FileName) break;
928+
if(strcmp(FileName, "dir") == 0) continue;
926929
jObject[i]["name"] = (String)FileName;
927930
i++;
928931
}
@@ -2120,7 +2123,7 @@ void tp_pressed(uint16_t x, uint16_t y){
21202123
if(btnNr == 3){_releaseNr = 3; } // station--
21212124
if(btnNr == 4){_releaseNr = 4; } // station++
21222125
changeBtn_pressed(btnNr); break;
2123-
case RADIOmenue_1: if(btnNr == 0){_releaseNr = 10; audioStopSong(); listAudioFile();} // AudioPlayer
2126+
case RADIOmenue_1: if(btnNr == 0){_releaseNr = 10; audioStopSong();} // AudioPlayer
21242127
if(btnNr == 1){_releaseNr = 11;} // Clock
21252128
if(btnNr == 2){_releaseNr = 12;} // Radio
21262129
if(btnNr == 3){_releaseNr = 13;} // Sleep

0 commit comments

Comments
 (0)