mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds playlist and favorite affordances to the player and lists
This commit is contained in:
1 parent
525ac1348d
commit
3e32068573
23 files changed
+411
-39
No files matched your search
@@ -37,7 +37,7 @@ Lumina is growing, and this is what works right now:
|
||||
- **Media libraries that scan themselves.** Point Lumina at a folder or a drive, tell it what kind of media lives there, and it gets to work discovering and indexing what it finds. Scans run in the background, report their progress as they go, and can be started, cancelled or resumed.
|
||||
- **Written content.** Add a written content library and Lumina scans it, cataloguing the books and e-books it contains and dressing them up with metadata for browsing in the client. Open one and it renders in the browser through a reader plugin; the EPUB and PDF readers are bundled and can be enabled per library.
|
||||
- **Music.** Add a music library and Lumina indexes the artists, albums and tracks it contains, reading metadata from the tags inside the audio files. If you want more, enable a metadata provider and Lumina fills in the gaps from online sources, and artwork can come from your folders or from remote sources. You can also build your own playlists, order them the way you want and play them in the browser.
|
||||
- **Favorites.** Mark the artists, albums, tracks and books you love as favorites and come back to them from one page, filtered by kind. Favorites are private to your account.
|
||||
- **Favorites.** Mark the artists, albums, tracks and books you love as favorites, from their lists or from the player, and come back to them from one page, filtered by kind. Favorites are private to your account.
|
||||
- **Metadata and artwork from plugins.** Plugins do the knowing. They supply the metadata and the artwork of a library, and you decide, library by library, which ones are switched on and which one wins when several of them recognize the same item.
|
||||
- **A file system browser.** Reach the drives, folders and files of the server machine from anywhere you can open the client, as if you were sitting right in front of it. Poke around, walk a path to its root or to its parent, and let Lumina generate thumbnails for what it finds.
|
||||
- **Accounts, roles, permissions and policies.** Create accounts, sign in with a password and optional two factor authentication, and hand out access through roles, fine grained permissions and policies that decide who may reach which library or content. Administrators manage all of it from the administration area.
|
||||
|
||||
@@ -69,11 +69,11 @@ Opening a music library shows a page with the library title, a search box, a sor
|
||||
- **The alpha picker** jumps to names starting with a chosen character. It offers All, then the number and symbol keys, then A to Z. You can also press a letter key to filter, and press Escape to clear the filter.
|
||||
- **Pagination** splits the list into pages when you have it enabled, with previous and next buttons and a page indicator. When it is off, the whole list is shown and the count is the total.
|
||||
|
||||
Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details**, **Play**, **Shuffle** and **Delete**.
|
||||
Each artist is a card; selecting it opens the artist's page, and the card's actions menu offers **View details**, **Play**, **Shuffle**, **Add to playlist** and **Delete**. The heart on the card marks the artist as a favorite.
|
||||
|
||||
The artist page is also where you edit the artist. It lists the artist's albums as cards, each leading to its own album page, followed by the artist's general information, contributors, ratings, genres, tags, aliases, areas and identifiers. The album page holds the album's information and its tracks, and the track page holds the track's details. The album page also shows the artwork Lumina stored for the album as a strip of thumbnails beside the main image, and selecting a thumbnail displays that image in place of the cover. Deleting an artist, album or track removes it from Lumina's catalogue; your files are not touched.
|
||||
|
||||
The music pages also play what they show. The artist page has a **Play all** control that plays the artist's releases in the order the page presents them, one release after another. The actions menu of a music library card on the home page, of an artist card, and of an album card offers **Play** and **Shuffle**. Play starts the library at its first artist and continues through the remaining artists in artist page order, starts the artist's discography in the order the artist page presents it, or starts the release in disc and track order. Shuffle starts the library, the artist's discography or the release with a list of up to 100 tracks sampled uniformly at random from every track of that scope, and continues in random order without repeating a track that is already queued. The album page has a **Play album** control that plays the release in disc and track order, and every track row has its own play control that plays just that track. The track page has a **Play track** control for the track it shows. Every track row on the album page also has an actions menu: **Add to playlist** opens the playlist picker for that track, **Add to play queue** appends it to the end of the player queue or starts it when the queue is empty, and **Play all from here** replaces the queue with that track and the rest of the album and starts playing. Starting playback opens the player bar at the bottom of the window. It keeps playing while you move between pages, and the bar shows the track name, with the album name underneath when the track belongs to a named album, the progress of the current track, a segmented VU meter that follows the level of the track, and the volume, together with previous, play or pause, stop, next and repeat controls. When you expand it, it also shows the cover art, the current track name, the release type, the release name and year, the artist name, and a carousel of the album's stored artwork, next to the queue, where every entry carries its album cover, including when only one track is queued. Selecting an artwork in the carousel shows it as the main cover. The expanded queue moves the current track to the top whenever playback advances, so it stays visible even in a long list. The double chevron at the right points up to expand the bar and down to collapse it. Stop is the square control next to play or pause; in the condensed bar it stops playback and slides the bar out of view.
|
||||
The music pages also play what they show. The artist page has a **Play all** control that plays the artist's releases in the order the page presents them, one release after another. The actions menu of a music library card on the home page, of an artist card, and of an album card offers **Play** and **Shuffle**. Play starts the library at its first artist and continues through the remaining artists in artist page order, starts the artist's discography in the order the artist page presents it, or starts the release in disc and track order. Shuffle starts the library, the artist's discography or the release with a list of up to 100 tracks sampled uniformly at random from every track of that scope, and continues in random order without repeating a track that is already queued. The album page has a **Play album** control that plays the release in disc and track order, and every track row has its own play control that plays just that track. The track page has a **Play track** control for the track it shows. Every track row on the album page also has an actions menu: **Add to playlist** opens the playlist picker for that track, **Add to play queue** appends it to the end of the player queue or starts it when the queue is empty, and **Play all from here** replaces the queue with that track and the rest of the album and starts playing. Starting playback opens the player bar at the bottom of the window. It keeps playing while you move between pages, and the bar shows the track name, with the album name underneath when the track belongs to a named album, the progress of the current track, a segmented VU meter that follows the level of the track, and the volume, together with previous, play or pause, stop, next and repeat controls. When you expand it, it also shows the cover art, the current track name, the release type, the release name and year, the artist name, and a carousel of the album's stored artwork, next to the queue, where every entry carries its album cover, including when only one track is queued. Selecting an artwork in the carousel shows it as the main cover. The expanded queue moves the current track to the top whenever playback advances, so it stays visible even in a long list. The current track's favorite is the heart on the bar between the repeat and mute controls, and every entry of the expanded queue carries its own heart. The queue's own playlist picker appends the whole queue, in order, to one of your playlists. The double chevron at the right points up to expand the bar and down to collapse it. Stop is the square control next to play or pause; in the condensed bar it stops playback and slides the bar out of view.
|
||||
|
||||
## Playlists
|
||||
|
||||
@@ -84,7 +84,7 @@ From the playlists page you can open a playlist or select **Create** to open the
|
||||
- **Add a track** by choosing a music library, then an artist, an album and a track, and selecting **Add**. A track can appear more than once in the same playlist.
|
||||
- **Reorder the tracks** by dragging a row by its handle, or with the up and down controls on each row. The order is saved immediately.
|
||||
- **Remove a track** from the playlist. The track itself, and the file behind it, are not touched.
|
||||
- **Play a single track** with its play control, or **Play playlist** to hand the whole ordered list to the player in one go. While something is playing, the expanded player's **Add to playlist** button appends its current queue to one of your playlists.
|
||||
- **Play a single track** with its play control, or **Play playlist** to hand the whole ordered list to the player in one go. Each row also has a heart that marks the track as a favorite and a plus control that adds it to another playlist. While something is playing, the expanded player's **Add to playlist** button appends its current queue to one of your playlists.
|
||||
- **Add a whole library, artist or album** from the card menu of its page: choose **Add to playlist**, pick a playlist, and the tracks of that scope are appended in catalogue order. The same dialog lets you create a playlist when you have none yet.
|
||||
- **Edit the name and description**, and **delete the playlist** when you no longer need it. Deleting a playlist never deletes any track.
|
||||
|
||||
@@ -94,7 +94,7 @@ The playlist reflects the catalogue at the moment you open it. If a track is del
|
||||
|
||||
A favorite is a mark you place on an artist, album, track or book so you can find it again quickly. Favorites belong to your account and are not shared with other users. Marking an item never changes the item or its files. Videos and photos are not available as favorites yet.
|
||||
|
||||
Select the heart on an item's card, or on its row on an album page, to add or remove the mark. A blue heart means the item is not a favorite; a red heart means it is.
|
||||
Select the heart on an item's card, on its row on an album page or in a playlist, on the player bar for the current track, or on any queue entry of the player, to add or remove the mark. A blue heart means the item is not a favorite; a red heart means it is.
|
||||
|
||||
The **Favorites** page in the library section lists everything you marked, most recent first, with a count that follows the filter.
|
||||
|
||||
|
||||
@@ -311,6 +311,7 @@ The markup inside the bar exposes the hook attributes the audio player script bi
|
||||
| `data-audio-player-now-playing-release` | The release name of the current track's album in the expanded player. It is left empty when the album has no displayable title. |
|
||||
| `data-audio-player-now-playing-year` | The release year of the current track's album in the expanded player. It is left empty when the year is not known. |
|
||||
| `data-audio-player-now-playing-artist` | The artist name of the current track's album in the expanded player. It is left empty until the album details are available. |
|
||||
| `data-audio-player-favorite` | The favorite toggle of the current track, in the condensed bar between repeat and mute. The player sets its media kind and track Id, and hides it while no track is loaded. A missing hook gets the built-in toggle in that place. |
|
||||
| `data-audio-player-artwork-carousel` | The carousel of the stored artwork of the current track's album. The player appends one `button.artwork-carousel-item` per stored image, carrying `data-artwork-path`, and toggles the `selected` class and `aria-pressed` on the chosen item. The element is hidden with the `hidden` attribute while the album has no stored artwork. |
|
||||
| `data-audio-player-cover-thumbnail`, `data-audio-player-cover-image` | The cover art of the condensed bar and of the expanded bar. Choosing an album artwork in the carousel replaces both images until the next track. |
|
||||
| `data-audio-player-vu-meter` | The root of the VU meter of the condensed bar, between the album art and the current time label. The player fills it with its channels, segments and peak markers, exactly as described in [The VU Meter](#the-vu-meter). A theme that does not render the hook gets the built-in meter inserted in that place. |
|
||||
@@ -408,10 +409,10 @@ The sub templates are rendered client side by the audio player script with the s
|
||||
|
||||
| Template | Fields |
|
||||
| --- | --- |
|
||||
| `queue-item` | `entryId` (the identity of this occurrence in the queue), `index` (the one based position in the queue), `trackId`, `albumId`, `artistId`, `libraryId`, `title`, `duration` (the formatted `m:ss` duration), `durationSeconds`, `coverArtUrl` (the resolved cover art URL, which is the music placeholder when the entry has no artwork), `isCurrent`, `isPlayed`, `isLast`, `isContinuation` (the entry was added by the autoplay continuation) and `isShuffled` (the entry was added by a shuffle batch). The item root must keep the `audio-player-queue-item` class, the stylesheet hook of a queue item: the player appends the rendered element as-is, so the class is what lets the theme style it. The player writes `is-current`, `is-played`, `is-continuation` and `is-shuffled` on the root itself, so a theme item does not need to render those state classes, and it writes `data-audio-player-queue-entry-id`, so a theme item does not need to render the identity either. |
|
||||
| `queue-item` | `entryId` (the identity of this occurrence in the queue), `index` (the one based position in the queue), `trackId`, `albumId`, `artistId`, `libraryId`, `title`, `duration` (the formatted `m:ss` duration), `durationSeconds`, `coverArtUrl` (the resolved cover art URL, which is the music placeholder when the entry has no artwork), `isCurrent`, `isPlayed`, `isLast`, `isContinuation` (the entry was added by the autoplay continuation) and `isShuffled` (the entry was added by a shuffle batch). The item root must keep the `audio-player-queue-item` class, the stylesheet hook of a queue item: the player appends the rendered element as-is, so the class is what lets the theme style it. The player writes `is-current`, `is-played`, `is-continuation` and `is-shuffled` on the root itself, so a theme item does not need to render those state classes, and it writes `data-audio-player-queue-entry-id`, so a theme item does not need to render the identity either. A theme item should render the favorite toggle with the `data-favorite-toggle`, `data-favorite-media-kind` and `data-favorite-media-item-id` attributes. The player appends the built-in toggle when it is missing. |
|
||||
| `playlist-item` | `index`, `trackId`, `albumId`, `artistId`, `libraryId`, `title`, `duration`, `durationSeconds`, `coverArtUrl` and `isCurrent`. The item root must keep the `audio-player-playlist-item` class, the stylesheet hook of a playlist item. The shell inlines this sub template for theme authors, but the player does not render a saved playlist list with it yet; the saved playlist page renders its own rows from the page data described below. |
|
||||
|
||||
A theme can omit either sub template: the player then renders that part with its own built-in markup. When a theme replaces the shell, it must keep the two plain text script element ids above, the element hooks of the bar, and the `audio-player-container`, `not-shown` and `expanded` classes the player toggles.
|
||||
A theme can omit any sub template: the player then renders that part with its own built-in markup. When a theme replaces the shell, it must keep the two plain text script element ids above, the element hooks of the bar, and the `audio-player-container`, `not-shown` and `expanded` classes the player toggles.
|
||||
|
||||
Every field of the `queue-item` and `playlist-item` models is untrusted: titles and identifiers come from file metadata and the music endpoints. Render these fields with the escaped form, `{{field}}`. The template engine also supports the unescaped form `{{{field}}}`, but these models contain no trusted HTML, so unescaped tags must not be used for them. Escaping does not neutralise whitespace in an unquoted attribute, so every model value placed in an attribute must sit inside quoted attribute marks, for example `data-track-id="{{trackId}}"` and never `data-track-id={{trackId}}`.
|
||||
|
||||
@@ -551,7 +552,7 @@ The fallback views keep these element hooks, which the application script drives
|
||||
|
||||
The playlist rows use the same play affordance contract as the music pages: an element with `data-audio-player-play` and the `data-track-id`, `data-library-id`, `data-album-id`, `data-artist-id`, `data-title`, `data-album-title`, `data-duration` and `data-cover-art-path` attributes is handed to the global player by event delegation. The page fills `data-track-id` from the entry `mediaItemId`, because a music entry references a track. The Play playlist control fetches every page of the playlist in order, builds an explicit queue from the playable entries and starts it through the player control API, so a theme template must keep the `play-playlist-button` hook for that control.
|
||||
|
||||
The playlist rows are reordered by dragging the handle with the `playlist-entry-drag-handle` class, and the row carries the `is-dragging` class while it is being dragged. The up and down controls remain available for keyboard and touch users, and the page uses the `playlist-entry-move-up`, `playlist-entry-move-down` and `playlist-entry-remove` classes to disable them while an entry mutation is in flight. A theme template that changes the row structure must keep the `playlist-entry` class and the `data-entry-id` attribute on the row, so the page script can find the row and commit its new position.
|
||||
The playlist rows are reordered by dragging the handle with the `playlist-entry-drag-handle` class, and the row carries the `is-dragging` class while it is being dragged. The up and down controls remain available for keyboard and touch users, and the page uses the `playlist-entry-move-up`, `playlist-entry-move-down` and `playlist-entry-remove` classes to disable them while an entry mutation is in flight. A theme template that changes the row structure must keep the `playlist-entry` class and the `data-entry-id` attribute on the row, so the page script can find the row and commit its new position. A playable row also renders the heart of the global favorites script (`data-favorite-toggle`, with the kind `MusicTrack`) and the declarative add-to-playlist action (`data-playlist-add` with the track, library, album, artist and title attributes), so the row can be favorited and saved without leaving the playlist. A theme template that replaces the row must keep both controls to keep those actions reachable.
|
||||
|
||||
#### The Shared Add to Playlist Action
|
||||
|
||||
@@ -559,6 +560,19 @@ The music library card on the home page, the artist cards, the album cards and t
|
||||
|
||||
The dialog is rendered by the application, not by the theme: it is a standard application dialog surface with a standard `enlightenment-combobox` of the playlists of the current user. When the scope carries a `trackId`, the dialog appends that single track through the single entry route. Otherwise, the server resolves the ordered track Ids of the scope and appends them to the selected playlist in one batch request. In both cases it shows the result notification and dispatches the `lumina:playlist-updated` event so an open playlist page refreshes. A theme that renders the dialog itself does not get this behavior; it must keep the action wired to the shared helper or reimplement the whole flow.
|
||||
|
||||
A page or a theme template can also render a declarative action that needs no script of its own. The global playlist script binds one click listener on the document, so the action works anywhere in the swapped page content, inside the player bar, and on controls that a page renders later. The action is any focusable element, normally a `button`, that carries these attributes:
|
||||
|
||||
| Attribute | Meaning |
|
||||
| --- | --- |
|
||||
| `data-playlist-add` | Required. Marks the element as an add-to-playlist action. |
|
||||
| `data-playlist-library-id` | Required. The Id of the media library the scope belongs to. An action without it is inert, because a scope is always resolved inside one library. |
|
||||
| `data-playlist-track-id` | Optional. The Id of a single track. When present, the action appends that track through the single entry route and the album and artist attributes are only descriptive. |
|
||||
| `data-playlist-album-id` | Optional. The Id of the album of a scope that is not a single track. |
|
||||
| `data-playlist-artist-id` | Optional. The Id of the artist of a scope that is not a single track. |
|
||||
| `data-playlist-title` | Optional. The title shown in the dialog, so the user sees what the action will add. |
|
||||
|
||||
The default action is prevented and the event stops propagating at the document listener, so link navigation is suppressed. An ancestor handler that already ran is not undone. A disabled action stays inert. Playlist rows and theme markup use these attributes; the player queue action uses its own combobox and button instead.
|
||||
|
||||
The layout provides the shared configuration as `window.playlistConfiguration`:
|
||||
|
||||
| Field | Content |
|
||||
@@ -569,7 +583,7 @@ The layout provides the shared configuration as `window.playlistConfiguration`:
|
||||
| `createPlaylistUrl` | The route of the dedicated create playlist page, linked from the empty state of the dialog. |
|
||||
| `strings` | The localized dialog labels, including `selectPlaylist`, `noPlaylists`, `createPlaylist`, `tracksAdded`, `tracksAddFailed` and `noTracksToAdd`. |
|
||||
|
||||
The player queue action does not use `addToPlaylistLabel`. Its label comes from the `PlaylistAddToPlaylist` layout resource, exposed to the player as `strings.addToPlaylist` in the audio player configuration.
|
||||
The player queue action does not use the declarative attributes. Its label comes from the `PlaylistAddToPlaylist` layout resource, exposed to the player as `strings.addToPlaylist` in the audio player configuration.
|
||||
|
||||
#### The Album Track Actions Menu
|
||||
|
||||
@@ -600,7 +614,7 @@ The fallback view renders one card per favorite, from the most recently favorite
|
||||
|
||||
#### Favorite Toggles
|
||||
|
||||
A favorite toggle is the heart of a media card or of a track row. It is rendered by a page or by a theme template, and it is driven entirely by the global script `wwwroot/js/favorites.js`, which every layout loads next to `playlists.js`. The script binds one click listener and one mutation observer on the document, so a toggle works anywhere in the swapped page content, including toggles that a page script adds later, and a page needs no script of its own. A theme owns the look of the toggle, and the script never renders markup: it only writes the attributes, the class and the texts described below.
|
||||
A favorite toggle is the heart of a media card, of a track row, or of the condensed audio player bar. It is rendered by a page or by a theme template, and it is driven entirely by the global script `wwwroot/js/favorites.js`, which every layout loads next to `playlists.js`. The script binds one click listener and one mutation observer on the document, so a toggle works anywhere in the swapped page content, including toggles that a page script adds later, and a page needs no script of its own. A theme owns the look of the toggle, and the script never renders markup: it only writes the attributes, the class and the texts described below.
|
||||
|
||||
A toggle is any focusable element, normally a `button`, that carries these attributes:
|
||||
|
||||
@@ -645,7 +659,7 @@ The script also exposes `window.LuminaFavorites` for page scripts that need more
|
||||
| `isFavorite(mediaKind, mediaItemId)` | Returns a promise of whether the item is a favorite. The answer always comes from the server, and the check is batched with the others of the same tick. It rejects when the kind or the Id is invalid, or when the request failed. |
|
||||
| `setFavoriteAsync(mediaKind, mediaItemId, shouldFavorite)` | Adds or removes the favorite, with the same in-flight rule, synchronization and failure notification from the global API helper as a click, and returns a promise of whether the item now has the requested state. A call for an item that is already being changed returns the running change when it asks for the same state, and `false` otherwise. |
|
||||
|
||||
The hearts are rendered on the cards of the books list, of the artists list and of the albums on the artist page (the kinds `Book`, `MusicArtist` and `MusicAlbum`), on the cards of the favorites page, and on the rows of the track table of the album page (the kind `MusicTrack`, after the duration). The detail pages of an artist, an album, a track and a book render no toggle. The audio player bar and the playlist rows have none either, so a theme should not assume they exist.
|
||||
The hearts are rendered on the cards of the books list, of the artists list and of the albums on the artist page (the kinds `Book`, `MusicArtist` and `MusicAlbum`), on the cards of the favorites page, on the rows of the track table of the album page (the kind `MusicTrack`, after the duration), on the rows of a saved playlist, on the favorite toggle of the condensed audio player bar for the current track, and on every queue item of the player (the kind `MusicTrack`). The detail pages of an artist, an album, a track and a book render no toggle. A theme that replaces a list must render the hearts again to keep favoriting reachable from it, and a theme queue item uses the same `data-favorite-toggle` contract.
|
||||
|
||||
A card heart is a plain `button` with the `card-favorite-toggle` class, with the three data attributes and nothing else, appended to the `media-card` element as a sibling of the `media-panel` link and of the `card-actions-trigger`. The stylesheet draws the heart with `::after`, like the dots of the actions trigger. The heart has the box of the actions trigger, sits immediately on its left, is shown on hover, while the actions menu of the card is open, and while any control of the card has the focus, shows the heart in the blue of the trigger, and shows it in red when the item is a favorite (`aria-pressed="true"` or the `is-favorite` class). A heart in the `loading` state is dimmed, and one in the `failed` state has an error border. A `media-card` that has no `card-actions-trigger`, like the cards of the favorites page, gets the heart in the place of the trigger, always visible so that it stays reachable by keyboard and on touch screens. A track row heart is a `button` with the `card-favorite-toggle track-favorite-toggle` classes inside a `td` with the `track-favorite-cell` class that follows the duration cell, and the `colgroup` of the table gets a `col` with the `track-favorite-column` class after the duration column. It is static, always visible and centered, like the actions trigger of the row. The hover text of every heart is the `title` that the script writes.
|
||||
|
||||
|
||||
Reference in new issue
Block a user