playlist: delay loading splash when adding indices

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sun, 24 May 2026 22:21:46 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 04e557898f3fe20e8f15e1ed1b26169ee1f8da68
Author: Christian Soffke <[email protected]>
Date:   Thu May 21 14:42:08 2026 +0200

    playlist: delay loading splash when adding indices
    
    For playlists whose indices can be quickly added,
    we should not be showing a splash.
    
    Change-Id: Ib58fe8e28201f519e410fa99b2cb19e7e9a70fc9

diff --git a/apps/playlist.c b/apps/playlist.c
index 198e2baa01..5d0c776184 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -705,6 +705,7 @@ static void display_playlist_count(int count, const unsigned char *fmt,
 static int add_indices_to_playlist(struct playlist_info* playlist,
                                    char* buffer, size_t buflen)
 {
+    unsigned long loading_tick = current_tick + HZ/6;
     ssize_t nread;
     unsigned int i, count = 0;
     bool store_index;
@@ -727,7 +728,6 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
 
     i = lseek(playlist->fd, 0, SEEK_CUR);
 
-    splash(0, ID2P(LANG_WAIT));
     store_index = true;
 
     while(1)
@@ -762,6 +762,12 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
                     playlist->indices[ playlist->amount ] = i+count;
                     dc_init_filerefs(playlist, playlist->amount, 1);
                     playlist->amount++;
+
+                    if (TIME_AFTER(current_tick, loading_tick))
+                    {
+                        loading_tick += HZ*10;
+                        splash(0, ID2P(LANG_WAIT));
+                    }
                 }
             }
         }
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs