Skip to content

Playlist impl - #212

Merged
MakD merged 2 commits into
masterfrom
playlist-impl
Aug 11, 2026
Merged

Playlist impl#212
MakD merged 2 commits into
masterfrom
playlist-impl

Conversation

@MakD

@MakD MakD commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Mixed Playlist Support Implementation

MakD added 2 commits August 11, 2026 14:44
This commit introduces comprehensive support for playlists containing both audio and video items. It updates the data models, repository layers, and UI components to handle mixed-media content, enabling users to browse, manage, and play video entries within the music playlist interface and the video player.

### Key Changes:

*   **Data Models & Extensions**:
    *   **`AfinityVideoPlaylist`**: Introduced a new model to represent video-based playlists.
    *   **`PlaylistEntry`**: Created a sealed interface to represent mixed content, with specific `Audio` and `Video` implementations.
    *   **Mapping**: Updated `JellyfinModelExtensions` to handle the `PLAYLIST` item kind and map it to either audio or video playlist models.

*   **Playlist UI & Components**:
    *   **`PlaylistVideoRow`**: Added a new component to display video items within playlist screens, including support for watched indicators and duration formatting.
    *   **Unified Playlist Screen**: Refactored the music playlist screen to render both `MusicTrackRow` and `PlaylistVideoRow`. Added a playback choice dialog for mixed-media playlists.
    *   **Visual Enhancements**: Updated `MediaItemCard` and `MediaItemGridCard` to use square aspect ratios for playlists and added item count badges.
    *   **Empty States**: Implemented descriptive empty states that account for hidden video items when viewing playlists in audio-only mode.

*   **Video Player Integration**:
    *   **`PlaylistManager`**: Implemented `initializeJellyfinPlaylistQueue` to support loading and navigating video playlists directly within the video player.
    *   **`PlayerLauncher`**: Updated to pass `playlistId` to the player activity, ensuring the playback queue is correctly initialized for playlist items.

*   **Repository & State Management**:
    *   **Repository Layers**: Updated `MediaRepository` and `MusicRepository` to fetch unified `PlaylistEntry` objects.
    *   **`MusicPlaylistViewModel`**: Refactored to manage mixed content, handle entry removal, and emit specialized video playback requests.
    *   **`ItemDetailViewModel`**: Added support for the `PLAYLIST` kind and optimized runtime fetching for associated items.

*   **Navigation & Infrastructure**:
    *   **Consolidated Navigation**: Introduced `navigateToItem` in `MainNavigation` to unify routing logic, specifically directing video playlists to the updated playlist screen.
    *   **`CollectionType`**: Added `Playlists` as a supported collection type for library browsing and paging.
This commit generalizes the playlist system to support both audio and video media types. It introduces a unified `PlaylistScreen` and `PlaylistViewModel`, replacing the previous music-specific implementations. Additionally, it implements server-side item reordering via drag-and-drop and enables adding video items to playlists from the item detail screen.

### Key Changes:

*   **Unified Playlist System**:
    *   **Generic Playlists**: Renamed `MusicPlaylistScreen` and `MusicPlaylistViewModel` to `PlaylistScreen` and `PlaylistViewModel`, moving them to a shared package.
    *   **Route Refactoring**: Updated `Destination` and `MainNavigation` to use a unified `PLAYLIST_ROUTE`, supporting both audio and video contexts via an `audioOnly` flag.
    *   **Media Support**: Updated `MusicRepository` and `AddToPlaylistDialog` to support different `MediaType` values, allowing the creation of video-based playlists.

*   **Playlist Reordering**:
    *   **Drag-and-Drop**: Integrated `sh.calvin.reorderable` to allow users to reorder items within a playlist using long-press gestures.
    *   **API Integration**: Implemented `movePlaylistItem` in `JellyfinMediaRepository` to sync the new item order with the Jellyfin server.
    *   **State Management**: Added `moveEntry` and `commitEntryMove` to `PlaylistViewModel` to handle optimistic UI updates and server synchronization.

*   **Item Detail Improvements**:
    *   **Add to Playlist**: Integrated `AddToPlaylistDialog` into `ItemDetailScreen` for movies, shows, seasons, and episodes.
    *   **Action Menu**: Updated `ActionButtonsRow` to include an "Add to Playlist" option in the overflow menu for supported video types.

*   **Library & Synchronization**:
    *   **Dynamic Refreshing**: Updated `LibraryContentViewModel` to invalidate the `PagingSource` when library content changes occur (e.g., playlist creation or deletion), ensuring the UI stays in sync with the server.
    *   **Change Notifications**: Added `mediaChangeManager` notifications to the repository layer for playlist modifications.
    *   **Download Support**: Updated `JellyfinDownloadRepository` to handle mixed-media playlist downloads, supporting both audio tracks and video items.

*   **Repository & Paging**:
    *   **Paging Hooks**: Modified `MediaRepository` and its implementation to provide an `onSourceCreated` callback, allowing ViewModels to track and invalidate active paging sources.
@MakD
MakD merged commit 377bedd into master Aug 11, 2026
@MakD
MakD deleted the playlist-impl branch August 11, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant