Hide folder containers without songs from playlist view#291
Hide folder containers without songs from playlist view#291theovilardo merged 2 commits intomasterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private fun flattenFolders(folders: List<MusicFolder>): List<MusicFolder> { | ||
| return folders.flatMap { folder -> | ||
| listOf(folder) + flattenFolders(folder.subFolders) | ||
| val current = if (folder.songs.isNotEmpty()) listOf(folder) else emptyList() | ||
| current + flattenFolders(folder.subFolders) | ||
| } |
There was a problem hiding this comment.
Do not hide folders that only contain songs in subdirectories
The new playlist view builds its list of folder playlists by flattening the folder tree and only keeping entries where folder.songs.isNotEmpty(). This means a parent directory that stores its music exclusively in nested subfolders (a very common structure like Artist/Album/Track.mp3) will never be shown, even though FolderPlaylistItem and PlaylistViewModel.collectAllSongs() can aggregate songs recursively. Users therefore cannot create a playlist for those folders at all. Consider filtering on folder.totalSongCount > 0 (or a similar recursive check) so folders that contain music anywhere in their subtree remain selectable while still hiding truly empty containers.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68fa3921f150832f8971dc4cc00c765a