plugins: random folder advance: misc improvements

fixes:
- traverse_dir was called recursively using two
  MAX_PATH local buffers => possible stack overflow
- The import function inserted additional, incorrect,
  entries when the whole line buffer was filled
- "Dirs not found" message overlapped number
  of folders when generating folder list
- Final number of scanned folders wasn't displayed
- Wouldn't stop inserting when maximum number
  of files in playlist was already reached
- Prevent buffer overflow when importing
- Don't write to fd after opening failed
- Use whole buffer with read_line, instead
  of subtracting 1. Remove hard coded sizes
- CRs don't need to be removed in import function
  (already handled by read_line)

features:
- Use insert context for *much* faster insertion
  of large # of folders, and nicer progress display
- Use UI viewport
- Add progress indicator when saving or loading
- Display number of folders in edit list title
- Go back to plugin's main menu from edit list
- Only ask to save changes if list is dirty
- Warn before erasing modified playlist
- Flag successfully created playlist as modified
- Make folder scan wait for dircache
- Shorten menu item names
- Put "Play Shuffled" menu item first
- Remember selection when returning from submenus
- Go to WPS after ACTION_TREE_WPS
- Exit menu when pressing Back
- Perform an initial scan, if no data file exists
  yet, when "Play Shuffled" or "Edit" is selected

Change-Id: I7df76f8fb8387888ce491d8b74b01b481e9997d3
This commit is contained in:
Christian Soffke 2026-01-01 19:26:06 +01:00
parent fcb2289274
commit f0d99391de
9 changed files with 582 additions and 428 deletions

View file

@ -5,7 +5,8 @@ when the Auto-Change Directory feature is set to \setting{Random}.
\subsubsection{Menu}
\begin{description}
\item[Generate Folder List] Generates a list of all folders found
\item[Play Shuffled] Starts playback with the selected directories in random order. Tracks within a directory will be played in normal order. The plugin will exit after starting playback.
\item[Scan Folders] Generates a list of all folders found
on the player. You can filter the directories which are scanned by
creating a file called \\*
\fname{/.rockbox/folder\_advance\_dir.txt}.
@ -16,12 +17,11 @@ Only the directories in this file and any contained directories
directory to be ignored.). If you just want \fname{/CDs}
to be ignored but want to include the folders within
it you need to have both \fname{-/CDs} and \fname{CDs} as entries.
\item[Edit Folder List] Enter the folder list editor
\item[Export List To Textfile] Exports the list to
\item[Edit] Enter the folder list editor
\item[Export to Text File] Exports the list to
\fname{/.rockbox/folder\_advance\_list.txt}
\item[Import List From Textfile] Imports the list from
\item[Import from Text File] Imports the list from
\fname{/.rockbox/folder\_advance\_list.txt}
\item[Play Shuffled] Starts playback with the selected directories in random order. Tracks within a directory will be played in normal order. The plugin will exit after starting playback.
\item[Quit]
\end{description}