It's working more or less...
This commit is contained in:
@@ -64,18 +64,18 @@ Playlist PlaylistManager::get_playlist(String rfid_id) {
|
||||
Serial.printf("No known playlist for id %s.\n", rfid_id);
|
||||
return current_playlist;
|
||||
} else {
|
||||
current_playlist = Playlist();
|
||||
String entry = map[rfid_id];
|
||||
if (entry.startsWith("/")) {
|
||||
File dir = SD.open(entry);
|
||||
current_playlist = Playlist(rfid_id);
|
||||
String path = map[rfid_id];
|
||||
if (path.startsWith("/")) {
|
||||
File dir = SD.open(path);
|
||||
while(File entry = dir.openNextFile()) {
|
||||
String filename = entry.name();
|
||||
String ext = filename.substring(filename.length()-4);
|
||||
if (!entry.isDirectory() &&
|
||||
!filename.startsWith(".") &&
|
||||
ext.equals(".mp3")) {
|
||||
Serial.printf("Adding %s to the list of files\n", filename);
|
||||
current_playlist.add_file(filename);
|
||||
Serial.printf("Adding %s to the list of files\n", (path + "/" + filename).c_str());
|
||||
current_playlist.add_file(path + "/" + filename);
|
||||
}
|
||||
entry.close();
|
||||
}
|
||||
@@ -90,4 +90,8 @@ Playlist PlaylistManager::get_playlist(String rfid_id) {
|
||||
|
||||
void PlaylistManager::set_audio_current_time(uint32_t time) {
|
||||
audio_current_time = time;
|
||||
}
|
||||
|
||||
bool PlaylistManager::has_playlist(String rfid_id) {
|
||||
return map.count(rfid_id) == 1;
|
||||
}
|
||||
Reference in New Issue
Block a user