Index: apps/playback.c =================================================================== --- apps/playback.c (revision 20205) +++ apps/playback.c (working copy) @@ -248,6 +248,7 @@ /* Track change controls */ static bool automatic_skip = false; /* Who initiated in-progress skip? (C/A-) */ +static bool auto_dir_skip = false; /* Have we changed dirs automatically? */ static bool dir_skip = false; /* Is a directory skip pending? (A) */ static bool new_playlist = false; /* Are we starting a new playlist? (A) */ static int wps_offset = 0; /* Pending track change offset, to keep WPS responsive (A) */ @@ -1996,6 +1997,7 @@ int old_track_ridx = track_ridx; int i, idx; bool forward; + bool end_of_playlist; /* Temporary flag, not the same as playlist_end */ /* Now it's good time to send track finish events. */ send_event(PLAYBACK_EVENT_TRACK_FINISH, &curtrack_id3); @@ -2014,6 +2016,9 @@ if (new_playlist) ci.new_track = 0; + end_of_playlist = !playlist_peek(ci.new_track); + auto_dir_skip = end_of_playlist && global_settings.next_folder; + /* If the playlist isn't that big */ if (automatic_skip) { @@ -2031,10 +2036,15 @@ /* Update the playlist */ last_peek_offset -= ci.new_track; - if (playlist_next(ci.new_track) < 0) + if (auto_dir_skip || !automatic_skip) { - LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED"); - return Q_CODEC_REQUEST_FAILED; + /* If the track change was manual or the result of an auto dir skip, + we need to update the playlist now */ + if (playlist_next(ci.new_track) < 0) + { + LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED"); + return Q_CODEC_REQUEST_FAILED; + } } if (new_playlist) @@ -2322,6 +2332,9 @@ if (automatic_skip) { + if (!auto_dir_skip) + playlist_next(-wps_offset); + wps_offset = 0; automatic_skip = false; @@ -2342,6 +2355,8 @@ } } + auto_dir_skip = false; + send_event(PLAYBACK_EVENT_TRACK_CHANGE, &curtrack_id3); track_changed = true;