Add API to reload playlist from SD Card file in Playlist component (AUD-6398)
Is your feature request related to a problem? Please describe.
Currently, the playlist component always rescans the entire SD card for audio files on startup, even if a previously saved playlist file already exists. This can significantly increase startup time, especially with large SD cards or many files.
Describe the solution you'd like
I would like the playlist component to provide an API to reload (restore) a previously saved playlist directly from the SD card, without rescanning the filesystem. This would allow applications to quickly restore the playlist state after a reboot or SD card remount, significantly improving startup time and user experience.
Suggested API:
esp_err_t sdcard_list_load(playlist_operator_handle_t handle, const char *playlist_path);
- This function should load the playlist from a specified file (e.g.,
/sdcard/__playlist/playlist.txt) and populate the playlist operator handle with the entries. - The API should return an error if the file does not exist or is corrupted, so the application can fall back to a full scan if needed.
Describe alternatives you've considered
- Manually parsing the playlist file in the application and repopulating the playlist operator, but this duplicates logic that should be handled by the playlist component.
- Always rescanning the SD card, which is slow and inefficient for large libraries.
Additional context
- This feature would be especially useful for embedded audio players where SD card content changes infrequently.
- It would also allow for persistent playlist management, enabling features like "resume last playlist" or "continue playback after reboot."
- If possible, the API could also provide a way to check if the playlist file is up-to-date or matches the current SD card contents (e.g., via a hash or timestamp).
Thank you for considering this feature!
Hi @Monkeystation Thank you for your suggestion. Indeed, we currently need to check whether the audio file has been updated. We will consider how to optimize this part of the logic.