Index: apps/playlist.c =================================================================== --- apps/playlist.c (revision 15994) +++ apps/playlist.c (working copy) @@ -2719,6 +2719,77 @@ return playlist_amount_ex(NULL); } +/* move to first track of next directory within a playlist */ +int playlist_next_album(void) +{ + struct playlist_info* playlist = ¤t_playlist; + const char* currfullpath; + int dirlen = 0; + int i; + struct playlist_track_info info; + + /* get current track's path. + since we've already pressed NEXT button, retrieve previous track's. */ + if ( (global_settings.repeat_mode != REPEAT_ONE) +#ifdef AB_REPEAT_ENABLE + || (global_settings.repeat_mode != REPEAT_AB) +#endif + ) + currfullpath = playlist_peek(-1); + else + currfullpath = playlist_peek(0); + dirlen = strrchr(currfullpath, '/') - currfullpath + 1; + + /* find the dir, and compare with current dir */ + for (i=playlist->index; i < playlist->amount; i++) + { + if (playlist_get_track_info(playlist, i, &info) == -1) + return -1; + + if (strncmp(currfullpath, info.filename, dirlen) != 0) + { /* we found the next dir */ + playlist_start(i, 0); + return 0; + } + } + + /* fell off the bottom of playlist. */ + if ( (global_settings.repeat_mode != REPEAT_OFF) + playlist_start(0, 0); + return 0; +} + +/* move to first track of current directory */ +int playlist_prev_album(void) +{ + struct playlist_info* playlist = ¤t_playlist; + const char* currfullpath; + int dirlen = 0; + int i; + struct playlist_track_info info; + + /* get current track's path */ + currfullpath = audio_current_track()->path; + dirlen = strrchr(currfullpath, '/') - currfullpath + 1; + + /* find the dir, and compare with current dir */ + for (i=playlist->index-1; i >= 0; i--) + { + if (playlist_get_track_info(playlist, i, &info) == -1) + return -1; + + if (strncmp(currfullpath, info.filename, dirlen) != 0) + { /* we found the prev dir */ + playlist_start(i+1, 0); + return 0; + } + } + + /* fell off the top of the playlist, plays first track */ + playlist_start(0, 0); + return 0; +} + /* * Create a new playlist If playlist is not NULL then we're loading a * playlist off disk for viewing/editing. The index_buffer is used to store Index: apps/playlist.h =================================================================== --- apps/playlist.h (revision 15994) +++ apps/playlist.h (working copy) @@ -127,6 +127,8 @@ int playlist_update_resume_info(const struct mp3entry* id3); int playlist_get_display_index(void); int playlist_amount(void); +int playlist_next_album(void); +int playlist_prev_album(void); /* Exported functions for all playlists. Pass NULL for playlist_info structure to work with current playlist. */ Index: apps/gui/gwps-common.c =================================================================== --- apps/gui/gwps-common.c (revision 15994) +++ apps/gui/gwps-common.c (working copy) @@ -166,6 +166,13 @@ case ACTION_WPS_SEEKFWD: direction = 1; case ACTION_WPS_SEEKBACK: + /* when skipping directory, we don't want to ffwd or rewind the new track*/ + if (wps_state.dirskip) + { + FOR_NB_SCREENS(i) + gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL); + break; + } if (wps_state.ff_rewind) { if (direction == 1) @@ -251,7 +258,10 @@ case ACTION_WPS_STOPSEEK: wps_state.id3->elapsed = wps_state.id3->elapsed+ff_rewind_count; - audio_ff_rewind(wps_state.id3->elapsed); + if (wps_state.dirskip) + wps_state.dirskip = false; + else + audio_ff_rewind(wps_state.id3->elapsed); ff_rewind_count = 0; wps_state.ff_rewind = false; status_set_ffmode(0); Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 15994) +++ apps/gui/gwps.c (working copy) @@ -345,7 +345,13 @@ } else { - audio_next_dir(); + /* if Auto-Change Directory is set to 'Yes' or 'Random', skip to next dir. + otherwise, skip to next album in the current playlist. */ + wps_state.dirskip=true; + if (global_settings.next_folder) + audio_next_dir(); + else + playlist_next_album(); } } else ffwd_rew(ACTION_WPS_SEEKFWD); @@ -370,7 +376,13 @@ } else { - audio_prev_dir(); + /* if Auto-Change Directory is set to 'Yes' or 'Random', skip to prev dir. + otherwise, move to first song of the current-playing-track's album */ + wps_state.dirskip=true; + if (global_settings.next_folder) + audio_prev_dir(); + else + playlist_prev_album(); } } else ffwd_rew(ACTION_WPS_SEEKBACK); @@ -708,6 +720,7 @@ { wps_state.ff_rewind = false; wps_state.paused = false; + wps_state.dirskip = false; wps_state.id3 = NULL; wps_state.nid3 = NULL; wps_state.current_track_path[0] = '\0'; Index: apps/gui/gwps.h =================================================================== --- apps/gui/gwps.h (revision 15994) +++ apps/gui/gwps.h (working copy) @@ -419,6 +419,7 @@ { bool ff_rewind; bool paused; + bool dirskip; int ff_rewind_count; bool wps_time_countup; struct mp3entry* id3;