@@ -1362,9 +1362,12 @@ bool SD_listDir(const char* path){
13621362 _SD_content.push_back (strdup ((const char *)_chbuf));
13631363 }
13641364 else {
1365- sprintf (_chbuf, " %s" ANSI_ESC_YELLOW " %d" , file.name (), file.size ());
1366- log_i (" %s" ,_chbuf);
1367- _SD_content.push_back (strdup ((const char *) _chbuf));
1365+ if (endsWith (file.name (), " .mp3" ) || endsWith (file.name (), " .aac" ) || endsWith (file.name (), " .m4a" ) || endsWith (file.name (), " .wav" ) ||
1366+ endsWith (file.name (), " .flac" ) || endsWith (file.name (), " .m3u" ) || endsWith (file.name (), " .opus" ) || endsWith (file.name (), " .ogg" )) {
1367+ sprintf (_chbuf, " %s" ANSI_ESC_YELLOW " %d" , file.name (), file.size ());
1368+ log_i (" %s" ,_chbuf);
1369+ _SD_content.push_back (strdup ((const char *) _chbuf));
1370+ }
13681371 }
13691372 }
13701373 audioFile.close ();
@@ -3540,6 +3543,14 @@ void tp_released(uint16_t x, uint16_t y){
35403543 tft.setCursor (20 , _winFooter.h + (fileListPos) * lineHight);
35413544 if (fileListPos == 0 ) {
35423545 log_i (" is path" );
3546+ int idx = _curAudioFolder.lastIndexOf (" /" );
3547+ if (idx > 1 ){ // not the first '/'
3548+ _curAudioFolder = _curAudioFolder.substring (0 , idx);
3549+ _fileListNr = 0 ;
3550+ SD_listDir (_curAudioFolder.c_str ());
3551+ showAudioFilesList (_fileListNr);
3552+ break ;
3553+ }
35433554 }
35443555 else {
35453556 log_i (" fileNr %i" , fileNr -1 );
@@ -3548,14 +3559,24 @@ void tp_released(uint16_t x, uint16_t y){
35483559 tft.writeText ((uint8_t *)_SD_content[fileNr - 1 ], -1 , -1 , true );
35493560 sprintf (_chbuf, " %s/%s" , _curAudioFolder.c_str () ,_SD_content[fileNr - 1 ]);
35503561 int idx = indexOf (_chbuf, " \033 [" , 1 );
3551- if (idx > 0 ) _chbuf[idx] = ' \0 ' ; // remove color and filesize
3552- changeState (PLAYER );
3553- log_i (" playfile %s" , _chbuf);
3554- SD_playFile (_chbuf, 0 , true );
3562+ if (idx == -1 ){ // is folder
3563+ _curAudioFolder += " /" + (String)_SD_content[fileNr - 1 ];
3564+ _fileListNr = 0 ;
3565+ SD_listDir (_curAudioFolder.c_str ());
3566+ showAudioFilesList (_fileListNr);
3567+ break ;
3568+ }
3569+ else {
3570+ _chbuf[idx] = ' \0 ' ; // remove color and filesize
3571+ changeState (PLAYER );
3572+ log_i (" playfile %s" , _chbuf);
3573+ SD_playFile (_chbuf, 0 , true );
3574+ }
35553575 }
35563576 _timeCounter.timer = 0 ;
35573577 showFooterRSSI (true );
35583578 }
3579+ else log_i (" unknown gesture" );
35593580 } break ;
35603581 }
35613582 _releaseNr = -1 ;
0 commit comments