summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2021-02-15 15:05:56 +0100
committerSolomon Peachy <pizza@shaftnet.org>2021-02-17 11:34:59 +0000
commit436e64e09eee2b83daa0c91835305fec2eec1a3f (patch)
treec4a250f4324cccee60dc7c35201bcd2fc93d9bec /apps/playlist.c
parentabebc6b9acdbed87edd3bb40a9f76626a5180bc4 (diff)
downloadrockbox-436e64e09eee2b83daa0c91835305fec2eec1a3f.tar.gz
rockbox-436e64e09eee2b83daa0c91835305fec2eec1a3f.tar.bz2
rockbox-436e64e09eee2b83daa0c91835305fec2eec1a3f.zip
Fix playback queue bug when "Insert Next" is used with multiple songs at once
After using “Insert Next” to insert multiple songs at once (e.g. an album from the database browser or folder from the file browser), subsequent Insert operations will incorrectly insert items after the first song of all items that were previously inserted, instead of after the last song of the previously inserted items. A bug fix was originally written by Costas Calamvokis for the file browser only. I adopted the original fix and added code analogous to it so that it works from the database browser as well. See FS#7898, FS#7363 or this forum post for more info: https://forums.rockbox.org/index.php/topic,53741.0.html Change-Id: Ie2718e136df0b340000f7a171e9e806cf23a27b4
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index c64fc229b5..3eb0949cc2 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -855,14 +855,14 @@ static int directory_search_callback(char* filename, void* context)
if (insert_pos < 0)
return -1;
-
+
(c->count)++;
-
- /* Make sure tracks are inserted in correct order if user requests
- INSERT_FIRST */
- if (c->position == PLAYLIST_INSERT_FIRST || c->position >= 0)
- c->position = insert_pos + 1;
-
+
+ /* After first INSERT_FIRST switch to INSERT so that all the
+ rest of the tracks get inserted one after the other */
+ if (c->position == PLAYLIST_INSERT_FIRST)
+ c->position = PLAYLIST_INSERT;
+
if (((c->count)%PLAYLIST_DISPLAY_COUNT) == 0)
{
unsigned char* count_str;
@@ -3179,7 +3179,7 @@ int playlist_insert_playlist(struct playlist_info* playlist, const char *filenam
result = -1;
break;
}
-
+
insert_pos = add_track_to_playlist(playlist, trackname, position,
queue, -1);
@@ -3189,13 +3189,13 @@ int playlist_insert_playlist(struct playlist_info* playlist, const char *filenam
break;
}
- /* Make sure tracks are inserted in correct order if user
- requests INSERT_FIRST */
- if (position == PLAYLIST_INSERT_FIRST || position >= 0)
- position = insert_pos + 1;
+ /* After first INSERT_FIRST switch to INSERT so that all the
+ rest of the tracks get inserted one after the other */
+ if (position == PLAYLIST_INSERT_FIRST)
+ position = PLAYLIST_INSERT;
count++;
-
+
if ((count%PLAYLIST_DISPLAY_COUNT) == 0)
{
display_playlist_count(count, count_str, false);