From 3b9a803a5b4f1e94339e7bb9724400a096900306 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Tue, 9 Mar 2021 03:57:23 +0100 Subject: Show 'Play Next' option when playback is stopped 1) The Insert functionality was changed in abebc6b to not delete unfinished dynamic playlists anymore. "Play Next" has now been added as an option when playback is stopped. The behavior of "Play Next" as such has not changed and it is now the consistent way to replace a current playlist in all playback modes. 2) The 'Insert' and 'Insert Shuffle' options will now only be displayed if there is a resumable dynamic playlist Change-Id: Ib5c5469b9e2c583ab06e0f47a922c24e5adf6b5f --- apps/onplay.c | 29 +++++++++++++++++++++++------ manual/working_with_playlists/main.tex | 28 ++++++++++++---------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/apps/onplay.c b/apps/onplay.c index e7f7e589db..6f29df57cb 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -477,7 +477,18 @@ MAKE_ONPLAYMENU( wps_playlist_menu, ID2P(LANG_PLAYLIST), /* CONTEXT_[TREE|ID3DB] playlist options */ static bool add_to_playlist(int position, bool queue) { - bool new_playlist = !(audio_status() & AUDIO_STATUS_PLAY) && (global_status.resume_index == -1 || playlist_resume() == -1); + bool new_playlist = false; + if (!(audio_status() & AUDIO_STATUS_PLAY)) + { + if (position == PLAYLIST_REPLACE) + { + new_playlist = true; + position = PLAYLIST_INSERT; + } + else if (global_status.resume_index == -1 || playlist_resume() == -1) + new_playlist = true; + } + const char *lines[] = { ID2P(LANG_RECURSE_DIRECTORY_QUESTION), selected_file @@ -594,7 +605,7 @@ static int treeplaylist_callback(int action, /* insert items */ MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, - NULL, Icon_Playlist); + treeplaylist_callback, Icon_Playlist); MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, treeplaylist_wplayback_callback, Icon_Playlist); @@ -630,7 +641,7 @@ MENUITEM_FUNCTION(q_last_shuf_pl_item, MENU_FUNC_USEPARAM, /* replace playlist */ MENUITEM_FUNCTION(replace_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_REPLACE), playlist_insert_func, (intptr_t*)PLAYLIST_REPLACE, - treeplaylist_wplayback_callback, Icon_Playlist); + NULL, Icon_Playlist); /* others */ MENUITEM_FUNCTION(view_playlist_item, 0, ID2P(LANG_VIEW), @@ -680,11 +691,17 @@ static int treeplaylist_callback(int action, return action; } } + else if (this_item == &i_pl_item) + { + if (global_status.resume_index != -1) + return action; + } else if (this_item == &i_shuf_pl_item) { - if ((audio_status() & AUDIO_STATUS_PLAY) || - (selected_file_attr & ATTR_DIRECTORY) || - ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U)) + if ((global_status.resume_index != -1) && + ((audio_status() & AUDIO_STATUS_PLAY) || + (selected_file_attr & ATTR_DIRECTORY) || + ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U))) { return action; } diff --git a/manual/working_with_playlists/main.tex b/manual/working_with_playlists/main.tex index 96fb259414..dbbeefc7d6 100644 --- a/manual/working_with_playlists/main.tex +++ b/manual/working_with_playlists/main.tex @@ -48,10 +48,10 @@ song. rather than erasing the current playlist, see the section below on how to add music to a playlist.} -\subsubsection{By using Insert and Queue functions} -If a dynamic playlist has finished playing, the \setting{Insert} and -\setting{Queue} functions as described in \ref{ref:playlist_submenu} will -\emph{replace} the playlist with the selected tracks instead of adding to it. +\subsubsection{By using the Play Next function} +The \setting{Play Next} function as described in \ref{ref:playlist_submenu} will +\emph{replace} the dynamic playlist with the selected tracks. If a track is +currently playing, it is only removed once it’s finished playing. \subsubsection{\label{ref:playlist_catalogue}By using the Playlist catalogue} The \setting{Playlist catalogue} makes it possible to modify and create @@ -74,15 +74,12 @@ in the \setting{Main Menu}. The created playlist will be named \fname{root.m3u8} and saved in the root of your \daps{} disk. \subsection{Adding music to playlists} - + \subsubsection{\label{ref:playlist_submenu}Adding music to a dynamic playlist} \screenshot{rockbox_interface/images/ss-playlist-menu}{The Playlist Submenu}{} The \setting{Playlist Submenu} is a submenu in the \setting{Context Menu} (see \reference{ref:Contextmenu}), it allows you to put tracks into a -``dynamic playlist''. If the current playlist has finished playing, Rockbox will -create a new dynamic playlist and put the selected track(s) into it. -If there is music currently playing, Rockbox will put the -selected track(s) into the current playlist. The place in which the newly +``dynamic playlist''. The place in which the newly selected tracks are added to the playlist is determined by the following options: @@ -90,8 +87,7 @@ options: \item [Insert.] Add track(s) immediately after any tracks added via the most recent \setting{Insert} operation. If no tracks have yet been added via an \setting{Insert}, new tracks will be added immediately after the current - playing track. If a dynamic playlist has finished playing, - it will be \emph{replaced} by the selected track(s). + playing track. \item [Insert Next.] Add track(s) immediately after current playing track, no matter what else has been inserted. @@ -106,17 +102,17 @@ options: deleted immediately from the playlist after they have been played. Also, queued tracks are not saved to the playlist file (see \reference{ref:playlistoptions}). - + \item [Queue Next.] Queue track(s) immediately after current playing track. - + \item [Queue Last.] Queue track(s) at end of playlist. \item [Queue Shuffled.] Queue track(s) in a random order. \item [Queue Last Shuffled.] Queue tracks in a random order at the end of the playlist. -\item [Play Next.] Replaces all but the current playing track with track(s). - Current playing track is queued. +\item [Play Next.] Replaces all tracks in the dynamic playlist. +If a track is currently playing, it is only removed once it’s finished playing. \end{description} The \setting{Playlist Submenu} can be used to add either single tracks or @@ -126,7 +122,7 @@ On the other hand, if the \setting{Playlist Submenu} is invoked on a directory, Rockbox adds all of the tracks in that directory to the playlist. -\note{You can control whether or not Rockbox includes the contents of +\note{You can control whether or not Rockbox includes the contents of subdirectories when adding an entire directory to a playlist. Set the \setting{Settings $\rightarrow$ General Settings $\rightarrow$ Playlist $\rightarrow$ Recursively Insert Directories} setting to \setting{Yes} if -- cgit v1.2.3