playlist: eliminate error message disconnecting USB

With no control file present, the message
"Error accessing playlist control file"
was displayed, due to playlist_resume being
called from gui_usb_screen_run.

You were likely to only run into this after a clean
install, if you hadn't listened to any music yet.

It probably makes sense to move the check for the
existence of the control file into playlist_resume,
and not even have it show a separate access error
message when the file doesn't exist.

Change-Id: Ib3a643c43d3d4d499fa5a13c01955779d69cd357
This commit is contained in:
Christian Soffke 2025-01-09 23:33:46 +01:00
parent 2c4c1b9199
commit b83504635c
3 changed files with 5 additions and 2 deletions

View file

@ -56,7 +56,7 @@ int save_playlist_screen(struct playlist_info* playlist)
catalogue's context menu in root menu */ catalogue's context menu in root menu */
if (!playlist && audio_stopped && !playlist_get_current()->started) if (!playlist && audio_stopped && !playlist_get_current()->started)
{ {
if (!file_exists(PLAYLIST_CONTROL_FILE) || playlist_resume() == -1) if (playlist_resume() == -1)
{ {
splash(HZ, ID2P(LANG_CATALOG_NO_PLAYLISTS)); splash(HZ, ID2P(LANG_CATALOG_NO_PLAYLISTS));
return 0; return 0;

View file

@ -3176,6 +3176,9 @@ int playlist_resume(void)
empty_playlist_unlocked(playlist, true); empty_playlist_unlocked(playlist, true);
if (!file_exists(playlist->control_filename))
goto out;
playlist->control_fd = open(playlist->control_filename, O_RDWR); playlist->control_fd = open(playlist->control_filename, O_RDWR);
if (playlist->control_fd < 0) if (playlist->control_fd < 0)
{ {

View file

@ -387,7 +387,7 @@ static bool playlist_viewer_init(struct playlist_viewer * viewer,
if (!filename && !is_playing) if (!filename && !is_playing)
{ {
/* Try to restore the list from control file */ /* Try to restore the list from control file */
if (!file_exists(PLAYLIST_CONTROL_FILE) || playlist_resume() == -1) if (playlist_resume() == -1)
{ {
/* Nothing to view, exit */ /* Nothing to view, exit */
splash(HZ, ID2P(LANG_CATALOG_NO_PLAYLISTS)); splash(HZ, ID2P(LANG_CATALOG_NO_PLAYLISTS));