Skip to content

Conversation

@James-Cherished
Copy link

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

@github-actions github-actions bot added the size/large PRs with less than 750 changed lines label Dec 14, 2025
@TobiGr TobiGr added feature request Issue is related to a feature in the app playlist Anything to do with playlists in the app labels Dec 14, 2025
@TobiGr
Copy link
Contributor

TobiGr commented Dec 15, 2025

Thank you for the PR.
Please provide screenshots or a recording of the changes.
The build is failing due to checkstyle errors.
Please ensure to generate a database schema for the new db version (it should usually be generated automatically during the build process).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Issue is related to a feature in the app playlist Anything to do with playlists in the app size/large PRs with less than 750 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants