Index: apps/playlist.c
===================================================================
--- apps/playlist.c (revision 16976)
+++ apps/playlist.c (working copy)
@@ -2726,6 +2726,85 @@
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;
+
+ /* do nothing if repeat mode is 'One' or 'A-B' */
+ if ( (global_settings.repeat_mode == REPEAT_ONE)
+#ifdef AB_REPEAT_ENABLE
+ || (global_settings.repeat_mode == REPEAT_AB)
+#endif
+ )
+ return 0;
+
+ /* 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; 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. do nothing if repeat mode is not 'All' */
+ if (global_settings.repeat_mode == REPEAT_ALL)
+ 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;
+
+ /* do nothing if repeat mode is 'One' or 'A-B' */
+ if ( (global_settings.repeat_mode == REPEAT_ONE)
+#ifdef AB_REPEAT_ENABLE
+ || (global_settings.repeat_mode == REPEAT_AB)
+#endif
+ )
+ return 0;
+
+ /* 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 16976)
+++ apps/playlist.h (working copy)
@@ -128,6 +128,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/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 16976)
+++ apps/lang/english.lang (working copy)
@@ -2110,6 +2110,48 @@
+ id: LANG_DIR_SKIP
+ desc: in playback settings menu.
+ user:
+
+ *: "Directory Skip"
+
+
+ *: "Directory Skip"
+
+
+ *: "Directory Skip"
+
+
+
+ id: LANG_WITHIN_PLAYLIST
+ desc: in directory skip in playback settings menu.
+ user:
+
+ *: "Within Playlist"
+
+
+ *: "Within Playlist"
+
+
+ *: "Within Playlist"
+
+
+
+ id: LANG_NEXT_DIR
+ desc: in directory skip in playback settings menu.
+ user:
+
+ *: "Next Directory"
+
+
+ *: "Next Directory"
+
+
+ *: "Next Directory"
+
+
+
id: LANG_AUDIOSCROBBLER
desc: "Last.fm Log" in the playback menu
user:
Index: apps/gui/gwps.c
===================================================================
--- apps/gui/gwps.c (revision 16976)
+++ apps/gui/gwps.c (working copy)
@@ -333,30 +333,30 @@
}
}
break;
- /* fast forward
- OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
+
+ /* fast forward */
case ACTION_WPS_SEEKFWD:
if (global_settings.party_mode)
break;
- if (current_tick -last_right < HZ)
- {
- if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
- {
- audio_next();
- }
- else
- {
- audio_next_dir();
- }
- }
- else ffwd_rew(ACTION_WPS_SEEKFWD);
- last_right = 0;
+ ffwd_rew(ACTION_WPS_SEEKFWD);
+ last_right = current_tick;
break;
- /* fast rewind
- OR prev dir if this is straight after ACTION_WPS_SKIPPREV */
+
+ /* fast rewind */
case ACTION_WPS_SEEKBACK:
if (global_settings.party_mode)
break;
+ ffwd_rew(ACTION_WPS_SEEKBACK);
+ last_left = current_tick;
+ break;
+
+ /* prev / restart
+ OR prev dir if this is straight after ACTION_WPS_SEEKBACK */
+ case ACTION_WPS_SKIPPREV:
+ if (global_settings.party_mode)
+ break;
+ update_track = true;
+
if (current_tick -last_left < HZ)
{
if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
@@ -371,20 +371,17 @@
}
else
{
- audio_prev_dir();
+ /* if Directory Skip is set to 'Within Playlist',
+ move to first song of the current-playing-track's album */
+ if (global_settings.directory_skip == 0)
+ playlist_prev_album();
+ else if (global_settings.directory_skip == 1)
+ audio_prev_dir();
}
+ last_left = 0;
+ break;
}
- else ffwd_rew(ACTION_WPS_SEEKBACK);
- last_left = 0;
- break;
- /* prev / restart */
- case ACTION_WPS_SKIPPREV:
- if (global_settings.party_mode)
- break;
- last_left = current_tick;
- update_track = true;
-
#ifdef AB_REPEAT_ENABLE
/* if we're in A/B repeat mode and the current position
is past the A marker, jump back to the A marker... */
@@ -430,13 +427,32 @@
}
break;
- /* next */
+ /* next
+ OR next dir if this is straight after ACTION_WPS_SEEKFWD */
case ACTION_WPS_SKIPNEXT:
if (global_settings.party_mode)
break;
- last_right = current_tick;
update_track = true;
+ if (current_tick -last_right < HZ)
+ {
+ if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
+ {
+ audio_next();
+ }
+ else
+ {
+ /* if Directory Skip is set to 'Within Playlist',
+ skip to next album in the current playlist. */
+ if (global_settings.directory_skip == 0)
+ playlist_next_album();
+ else if (global_settings.directory_skip == 1)
+ audio_next_dir();
+ }
+ last_right = 0;
+ break;
+ }
+
#ifdef AB_REPEAT_ENABLE
/* if we're in A/B repeat mode and the current position is
before the A marker, jump to the A marker... */
@@ -468,6 +484,7 @@
audio_next();
break;
+
/* next / prev directories */
/* and set A-B markers if in a-b mode */
case ACTION_WPS_ABSETB_NEXTDIR:
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 16976)
+++ apps/settings.h (working copy)
@@ -550,6 +550,7 @@
#endif /* HAVE_REMOTE_LCD */
int next_folder; /* move to next folder */
+ int directory_skip; /* 0=skip within playlist 1=skip to next folder 2=off */
bool runtimedb; /* runtime database active? */
#if CONFIG_CODEC == SWCODEC
Index: apps/menus/playback_menu.c
===================================================================
--- apps/menus/playback_menu.c (revision 16976)
+++ apps/menus/playback_menu.c (working copy)
@@ -134,6 +134,7 @@
MENUITEM_SETTING(spdif_enable, &global_settings.spdif_enable, NULL);
#endif
MENUITEM_SETTING(next_folder, &global_settings.next_folder, NULL);
+MENUITEM_SETTING(directory_skip, &global_settings.directory_skip, NULL);
int audioscrobbler_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
@@ -190,7 +191,7 @@
#ifdef HAVE_SPDIF_POWER
&spdif_enable,
#endif
- &next_folder, &audioscrobbler, &cuesheet
+ &next_folder, &directory_skip, &audioscrobbler, &cuesheet
#ifdef HAVE_HEADPHONE_DETECTION
,&unplug_menu
#endif
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 16976)
+++ apps/settings_list.c (working copy)
@@ -894,6 +894,9 @@
CHOICE_SETTING(0, next_folder, LANG_NEXT_FOLDER, FOLDER_ADVANCE_OFF,
"folder navigation", "off,on,random",NULL ,3,
ID2P(LANG_SET_BOOL_NO), ID2P(LANG_SET_BOOL_YES), ID2P(LANG_RANDOM)),
+ CHOICE_SETTING(0, directory_skip, LANG_DIR_SKIP, 0,
+ "dirskip mode", "within pl,next dir,off",NULL ,3,
+ ID2P(LANG_WITHIN_PLAYLIST), ID2P(LANG_NEXT_DIR), ID2P(LANG_OFF)),
OFFON_SETTING(0,runtimedb,LANG_RUNTIMEDB_ACTIVE,false,"gather runtime data",NULL),
#if CONFIG_CODEC == SWCODEC