1
0
Fork 0
forked from len0rd/rockbox

playlist: Rewrite playlist_save(), optimization & fixes

playlist_save() was a poorly thought out mess. This fixes the
glaring issues and hopefully ensures that saving the playlist
never loses state (such as queued tracks or modified status)
after save+resume.

Indices are now updated on the fly, which is faster and needs
no extra memory. But if an error occurs, the playlist will be
corrupted. There is currently no attempt to handle this since
errors should be unlikely, but some error handling needs to be
added in the future.

Change-Id: If8a5dbd6a596460be08ee0b7bab9f24337886ea4
This commit is contained in:
Aidan MacDonald 2023-03-30 12:24:02 +01:00
parent 1ee152b5a4
commit 90e35716e3
3 changed files with 291 additions and 265 deletions

View file

@ -83,7 +83,7 @@ int save_playlist_screen(struct playlist_info* playlist)
playlist ? playlist->filename :
playlist_get_current()->filename))
{
playlist_save(playlist, temp, NULL, 0);
playlist_save(playlist, temp);
/* reload in case playlist was saved to cwd */
reload_directory();