feat: Playlist folders - Add local playlist folders (folder bar, DB entity, migration) #12908
+479
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature (user facing)⚠️
**Your PR must target the [
refactor]TL;DR
Add a lightweight folder feature for local playlists: new PlaylistFolder Room entity + DAO, nullable folder_id on playlists, DB migration v9→v10, UI folder bar (bookmarks), folder CRUD and assign-to-folder flows. Only local playlists are affected; remote playlists unchanged.
What it does
Adds persistent playlist folders and a horizontal folder bar on the Bookmarks screen.
Lets users create/rename/delete folders and assign local playlists to a folder.
Stores folder_id on playlists (nullable — NULL = ungrouped).
Bumps DB version to 10 and adds MIGRATION_9_10 to create playlist_folders and add folder_id to playlists.
Preserves existing display_index and playlist ordering.
UX
Folder bar at top of Bookmarks: horizontal list of folder chips (small text items). Includes virtual “All” and “Ungrouped” entries.
FAB to create new folder. Long-press a folder to rename/delete.
Assign a local playlist to a folder from its context menu (“Assign to folder”).
Only local playlists persist folder assignments. Remote playlists remain unchanged.
Folder ordering is supported via a sort_order column (future improvement: UI reordering).
Fixes the following issue(s)
Relies on the following changes
DB & migration: AppDatabase.kt — register new entity & DAO, bumped DB version
Migrations.kt — add DB_VER_10 and MIGRATION_9_10
NewPipeDatabase.kt — register new migration in builder
Entities / DAO: PlaylistFolderEntity.kt (new)
PlaylistFolderDAO.kt (new)
PlaylistEntity.kt — added folderId field + constant
PlaylistMetadataEntry.kt — map folderId
PlaylistStreamDAO.kt — include folder_id in metadata query (column order adjusted)
Managers & UI glue: PlaylistFolderManager.java (new)
LocalPlaylistManager.java — getPlaylistsForFolder() and setPlaylistFolder()
PlaylistFoldersAdapter.java (new)
BookmarkFragment.java — folder bar wiring, create/rename/delete dialogs, assign flow
Layouts: list_folder_item.xml (new), fragment_bookmarks.xml (updated — folder bar + FAB)
Tests: DatabaseMigrationTest.kt — added migrateDatabaseFrom9to10 migration test
DB migration (brief)
New DB version: Migrations.DB_VER_10.
MIGRATION_9_10 actions:
CREATE TABLE playlist_folders (uid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT NOT NULL, sort_order INTEGER NOT NULL DEFAULT 0)
ALTER TABLE playlists ADD COLUMN folder_id INTEGER (nullable)
Existing playlists keep NULL for folder_id (treated as ungrouped). No destructive changes
Backward compatibility & data safety
Migration is additive and non-destructive. Users’ existing playlists are preserved and default to ungrouped (NULL).
Recommend backup before shipping in case users want to roll back: export DB
Due diligence