Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
965 stars 227 forks source link

This change is to add a tracklist for mp3-files on SD-Cards #426

Closed EFWob closed 2 years ago

EFWob commented 3 years ago

This change avoids time consuming reads of the nodelist at startup if contents of the SD cards have not changed. I employ this change for a "jukebox" for the grandparents. They usally listen to a few radiostations or have the favorite songs of their youth on one SD card. That card is never changed, so it is not needed to read the contents ever again.

Basic idea is as follows:

So, if you fill or update an SD-Card, you need to create an empty "/mp3tracks.txt" to be filled at first start of the radio, or delete "/mp3track.txt" to make the radio behave as usual.

This can be also done from command line: "tracklist=delete" deletes tracklist (if existing) "tracklist=init" created an empty tracklist to be filled at next start (if not existing already, will prompt to delete first).

Issues will arise, if contents of the SD card a(mp3 files) are changed and the tracklist is not deleted/emptied!

EFWob commented 3 years ago

The diff is bigger than the actual change is: Currently, there is a #define TRACKLIST defined in the first line of SDcard.h

All other changes are guarded by that define:

Sorry for the confusion.

utw3v0 commented 3 years ago

is it possible to call the textfile as well when clicking on mp3player so instead of reading the whole sd card read the textfile ? or maybe copy the content into a buffer and refresh from there ? i also had a wired view in the tracklist so i had to change the lines @ 234 from p = file.name() + ldirname ; to SD_outbuf += tmpstr + // Form line for mp3play_html page utf8ascii ( file.name() + ldirname ) + // Filename String ( "\n" ) ; to get a full file list