Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Feature/BugFix] Dirplay never gets the file I selected

If you have say 1000 playlist entries and select the 1001 song in the directory
dirplay loads tracks 1-1000 shuffles them and track 1001 is never heard from again

Instead start at the file and loop through the directory mod dir len

Change-Id: Ieded5decdc1f7c44b1be8491dbd4f359ae21f79a
Hint: this is a good way to not wait on dirplay to load a ton of tracks

+12 -4
+12 -4
apps/filetree.c
··· 82 82 83 83 tree_lock_cache(c); 84 84 struct entry *entries = tree_get_entries(c); 85 - 85 + bool exceeds_pl = false; 86 + if (c->filesindir > playlist->max_playlist_size) 87 + { 88 + exceeds_pl = true; 89 + start_index = 0; 90 + } 86 91 struct playlist_insert_context pl_context; 87 92 88 93 res = playlist_insert_context_create(playlist, &pl_context, ··· 92 97 cpu_boost(true); 93 98 for(i = 0;i < c->filesindir;i++) 94 99 { 100 + int item = i; 101 + if (exceeds_pl) 102 + item = (i + start) % c->filesindir; 95 103 #if 0 /*only needed if displaying progress */ 96 104 /* user abort */ 97 105 if (action_userabort(TIMEOUT_NOBLOCK)) ··· 99 107 break; 100 108 } 101 109 #endif 102 - if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 110 + if((entries[item].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 103 111 { 104 - res = playlist_insert_context_add(&pl_context, entries[i].name); 112 + res = playlist_insert_context_add(&pl_context, entries[item].name); 105 113 if (res < 0) 106 114 break; 107 115 } 108 - else 116 + else if (!exceeds_pl) 109 117 { 110 118 /* Adjust the start index when se skip non-MP3 entries */ 111 119 if(i < start)