Playlist Catalogue: fix: "Save Current Playlist" may fail silently

- After rebooting, unless the current playlist
had been manually resumed already, the "Save
Current Playlist" option in the root menu's/
playlist catalogue's context menu failed to work.

- Eliminate error message attempting to view current
playlist when no control file present.

Change-Id: I58f1d3dc6f256fcee106ff5a17f69fa46d67b2e4
This commit is contained in:
Christian Soffke 2025-01-08 12:35:59 +01:00
parent 897a96996b
commit e5c9846cb4
3 changed files with 17 additions and 1 deletions

View file

@ -48,6 +48,21 @@ int save_playlist_screen(struct playlist_info* playlist)
char temp[MAX_PATH+1], *p;
int len;
bool audio_stopped = !(audio_status() & AUDIO_STATUS_PLAY);
/* After a reboot, we may need to resume the playlist
first, or it will not contain any indices when
user selects "Save Current Playlist" from playlist
catalogue's context menu in root menu */
if (!playlist && audio_stopped && !playlist_get_current()->started)
{
if (!file_exists(PLAYLIST_CONTROL_FILE) || playlist_resume() == -1)
{
splash(HZ, ID2P(LANG_CATALOG_NO_PLAYLISTS));
return 0;
}
}
catalog_get_directory(directoryonly, sizeof(directoryonly));
playlist_get_name(playlist, temp, sizeof(temp)-1);