forked from len0rd/rockbox
[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
This commit is contained in:
parent
f55cb77f89
commit
f09693b0be
1 changed files with 12 additions and 4 deletions
|
@ -82,7 +82,12 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
||||||
|
|
||||||
tree_lock_cache(c);
|
tree_lock_cache(c);
|
||||||
struct entry *entries = tree_get_entries(c);
|
struct entry *entries = tree_get_entries(c);
|
||||||
|
bool exceeds_pl = false;
|
||||||
|
if (c->filesindir > playlist->max_playlist_size)
|
||||||
|
{
|
||||||
|
exceeds_pl = true;
|
||||||
|
start_index = 0;
|
||||||
|
}
|
||||||
struct playlist_insert_context pl_context;
|
struct playlist_insert_context pl_context;
|
||||||
|
|
||||||
res = playlist_insert_context_create(playlist, &pl_context,
|
res = playlist_insert_context_create(playlist, &pl_context,
|
||||||
|
@ -92,6 +97,9 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
||||||
cpu_boost(true);
|
cpu_boost(true);
|
||||||
for(i = 0;i < c->filesindir;i++)
|
for(i = 0;i < c->filesindir;i++)
|
||||||
{
|
{
|
||||||
|
int item = i;
|
||||||
|
if (exceeds_pl)
|
||||||
|
item = (i + start) % c->filesindir;
|
||||||
#if 0 /*only needed if displaying progress */
|
#if 0 /*only needed if displaying progress */
|
||||||
/* user abort */
|
/* user abort */
|
||||||
if (action_userabort(TIMEOUT_NOBLOCK))
|
if (action_userabort(TIMEOUT_NOBLOCK))
|
||||||
|
@ -99,13 +107,13 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO)
|
if((entries[item].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO)
|
||||||
{
|
{
|
||||||
res = playlist_insert_context_add(&pl_context, entries[i].name);
|
res = playlist_insert_context_add(&pl_context, entries[item].name);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else if (!exceeds_pl)
|
||||||
{
|
{
|
||||||
/* Adjust the start index when se skip non-MP3 entries */
|
/* Adjust the start index when se skip non-MP3 entries */
|
||||||
if(i < start)
|
if(i < start)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue