Adds music page play affordances and shuffle playback

Adds play and shuffle actions to music library, artist, and album cards.

Adds the library play context and the uniform shuffle endpoint.

Expands the player bar with queue covers, now playing details, and release type.

Updates the bundled themes, API documentation, and the user manual.
This commit is contained in:
BinaryAlley committed 2026-10-19 17:49:00 +03:00
1 parent 93821a2776
commit 067e9a21d0
132 files changed
+2935 -715

No files matched your search

@@ -26,6 +26,11 @@ public class MusicAlbumDto
/// </summary>
public Guid ArtistId { get; set; }
/// <summary>
/// Gets or sets the name of the artist the album belongs to.
/// </summary>
public string ArtistName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the Id of the media library this album belongs to.
/// </summary>
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a track returned by a randomized shuffle query.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class MusicShuffleTrackDto
{
/// <summary>
/// Gets or sets the Id of the track.
/// </summary>
public Guid TrackId { get; set; }
/// <summary>
/// Gets or sets the title of the track.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the duration of the track in seconds.
/// </summary>
public int DurationInSeconds { get; set; }
/// <summary>
/// Gets or sets the Id of the album the track belongs to.
/// </summary>
public Guid AlbumId { get; set; }
/// <summary>
/// Gets or sets the title of the album the track belongs to.
/// </summary>
public string AlbumTitle { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the Id of the artist the album belongs to.
/// </summary>
public Guid ArtistId { get; set; }
/// <summary>
/// Gets or sets the path of the cover of the album, if available.
/// </summary>
public string? CoverPath { get; set; }
}
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Represents a request to draw a random selection of tracks from a media library, an artist or an album.
/// </summary>
/// <param name="LibraryId">The unique identifier of the media library the tracks are sampled from. Required.</param>
/// <param name="Count">The maximum number of tracks to return. Required.</param>
/// <param name="ArtistId">The unique identifier of the artist whose tracks are sampled. Optional.</param>
/// <param name="AlbumId">The unique identifier of the album whose tracks are sampled. Optional.</param>
/// <param name="ExcludedTrackIds">The tracks that must not be returned, usually the ones already in the queue. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId} Count: {Count}")]
public record ShuffleTracksRequest(
Guid LibraryId,
int Count,
Guid? ArtistId,
Guid? AlbumId,
List<Guid>? ExcludedTrackIds
);
@@ -21,6 +21,7 @@ public static partial class ApiRoutes
public const string UPDATE_ALBUM_COVER = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/cover";
public const string DELETE_ALBUM = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}";
public const string GET_ALBUM_TRACKS_LITE = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/lite";
public const string SHUFFLE_TRACKS = "libraries/{libraryId}/tracks/shuffle";
public const string GET_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string UPDATE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string DELETE_TRACK = "libraries/{libraryId}/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
@@ -24,6 +24,7 @@ public static partial class WebRoutes
public const string UPDATE_ALBUM_COVER = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-update-cover";
public const string DELETE_ALBUM = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/api-delete-album";
public const string GET_ALBUM_TRACKS = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/api-get-tracks";
public const string SHUFFLE_TRACKS = "{culture}/library/audio-library/music-library/tracks/api-shuffle-tracks";
public const string TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}";
public const string GET_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-get-track";
public const string SAVE_TRACK = "{culture}/library/audio-library/music-library/artists/{artistId}/albums/{albumId}/tracks/{trackId}/api-save-track";
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
@@ -88,6 +89,13 @@ public class EditMusicAlbumViewEndpoint : BaseEndpoint<GetMusicAlbumViewRequest,
request = request with { AlbumId = Guid.TryParse(request.AlbumId, out Guid albumId) ? albumId.ToString() : Guid.Empty.ToString() };
MusicAlbumDto album = await _apiHttpClient.GetAsync<MusicAlbumDto>(ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId).Replace("{albumId}", request.AlbumId), cancellationToken).ConfigureAwait(false);
string title = album.Metadata?.Title ?? string.Empty;
// The play album trigger presents the album, so it carries the same cover this page displays: the stored cover, or the first stored artwork when the album has no cover.
string albumCoverPath = album.CoverPath ?? string.Empty;
if (string.IsNullOrWhiteSpace(albumCoverPath))
albumCoverPath = (album.Artwork ?? []).FirstOrDefault(artwork => !string.IsNullOrWhiteSpace(artwork.Path))?.Path ?? string.Empty;
// A release the API already reported as empty has nothing to play, so the themed play trigger starts disabled. The
// release list the page loads later only refines this state, and a failed request never changes it.
bool albumHasTracks = (album.Tracks?.Count ?? 0) > 0;
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
@@ -109,6 +117,9 @@ public class EditMusicAlbumViewEndpoint : BaseEndpoint<GetMusicAlbumViewRequest,
["trackUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ALBUM_COVER, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTIST, new { artistId = album.ArtistId }) ?? string.Empty) + "?libraryId=" + album.LibraryId,
["albumTitle"] = title,
["albumCoverPath"] = albumCoverPath,
["albumHasTracks"] = albumHasTracks,
["albumJson"] = JsonSerializer.Serialize(album, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
@@ -87,6 +87,9 @@ public class EditMusicArtistViewEndpoint : BaseEndpoint<GetMusicArtistViewReques
request = request with { ArtistId = Guid.TryParse(request.ArtistId, out Guid artistId) ? artistId.ToString() : Guid.Empty.ToString() };
MusicArtistDto artist = await _apiHttpClient.GetAsync<MusicArtistDto>(ApiRoutes.Music.GET_ARTIST.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", request.ArtistId), cancellationToken).ConfigureAwait(false);
string title = artist.Metadata?.Name ?? string.Empty;
// An artist the API already reported without releases has nothing to play, so the themed play trigger starts disabled.
// The release list the page loads later only refines this state, and a failed request never changes it.
bool artistHasReleases = (artist.Albums?.Count ?? 0) > 0;
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
@@ -108,6 +111,9 @@ public class EditMusicArtistViewEndpoint : BaseEndpoint<GetMusicArtistViewReques
["deleteAlbumUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) }) ?? string.Empty,
["coverUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.UPDATE_ARTIST_COVER, new { artistId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ARTISTS_INDEX) ?? string.Empty) + "?libraryId=" + artist.LibraryId,
["artistName"] = title,
["artistCoverPath"] = artist.CoverPath ?? string.Empty,
["artistHasReleases"] = artistHasReleases,
["artistJson"] = JsonSerializer.Serialize(artist, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
@@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
@@ -95,6 +96,12 @@ public class EditMusicTrackViewEndpoint : BaseEndpoint<GetMusicTrackViewRequest,
// The cover shown on the left of the track page is the cover of the album that holds the track, so the album is fetched alongside the track.
MusicAlbumDto album = await _apiHttpClient.GetAsync<MusicAlbumDto>(
ApiRoutes.Music.GET_ALBUM.Replace("{libraryId}", request.LibraryId.ToString()).Replace("{artistId}", normalizedArtistId).Replace("{albumId}", normalizedAlbumId), cancellationToken).ConfigureAwait(false);
// The track page and its play trigger show the same cover the album page shows: the stored cover, or the first stored
// artwork when the album has no cover. It is resolved once and used for both the themed page data and the fallback view.
string albumCoverPath = album.CoverPath ?? string.Empty;
if (string.IsNullOrWhiteSpace(albumCoverPath))
albumCoverPath = (album.Artwork ?? []).FirstOrDefault(artwork => !string.IsNullOrWhiteSpace(artwork.Path))?.Path ?? string.Empty;
string albumTitle = album.Metadata?.Title ?? string.Empty;
// The themed view is a regular page that submits its own requests, so a fresh anti-forgery token must be issued for it.
AntiforgeryTokenSet antiforgeryTokens = _antiforgery.GetAndStoreTokens(HttpContext);
@@ -114,7 +121,10 @@ public class EditMusicTrackViewEndpoint : BaseEndpoint<GetMusicTrackViewRequest,
["saveUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["deleteUrl"] = _urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_TRACK, new { artistId = default(Guid), albumId = default(Guid), trackId = default(Guid) }) ?? string.Empty,
["backUrl"] = (_urlService.GetAbsoluteUrl(WebRoutes.Music.ALBUM, new { artistId = normalizedArtistId, albumId = track.AlbumId }) ?? string.Empty) + "?libraryId=" + track.LibraryId,
["albumCoverPath"] = album.CoverPath ?? string.Empty,
["albumCoverPath"] = albumCoverPath,
["albumTitle"] = albumTitle,
["trackTitle"] = title,
["trackDurationInSeconds"] = track.Metadata?.DurationInSeconds,
["trackJson"] = JsonSerializer.Serialize(track, s_camelCaseJsonOptions),
["strings"] = ThemePageDataFactory.CreateLocalizedStrings(_localizer),
["stringsJson"] = JsonSerializer.Serialize(ThemePageDataFactory.CreateLocalizedStrings(_localizer), s_camelCaseJsonOptions)
@@ -127,7 +137,9 @@ public class EditMusicTrackViewEndpoint : BaseEndpoint<GetMusicTrackViewRequest,
Dictionary<string, object?> viewData = new()
{
["Title"] = title,
["AlbumCoverPath"] = album.CoverPath ?? string.Empty
["ArtistId"] = normalizedArtistId,
["AlbumCoverPath"] = albumCoverPath,
["AlbumTitle"] = albumTitle
};
return View("/Core/Views/Library/AudioLibrary/MusicLibrary/Tracks/Item.cshtml", track, viewData);
}
@@ -0,0 +1,67 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.Api;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using Lumina.Presentation.Web.Common.Routes;
using Lumina.Presentation.Web.Core.Endpoints.Common;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.ShuffleTracks;
/// <summary>
/// API endpoint for the <c>/{culture}/library/audio-library/music-library/tracks/api-shuffle-tracks</c> route.
/// </summary>
public class ShuffleTracksEndpoint : BaseEndpoint<ShuffleTracksRequest, IResult>
{
private readonly IApiHttpClient _apiHttpClient;
/// <summary>
/// Initializes a new instance of the <see cref="ShuffleTracksEndpoint"/> class.
/// </summary>
/// <param name="apiHttpClient">Injected service for interactions with the API.</param>
public ShuffleTracksEndpoint(IApiHttpClient apiHttpClient)
{
_apiHttpClient = apiHttpClient;
}
/// <summary>
/// Configures the endpoint.
/// </summary>
public override void Configure()
{
base.Configure();
Verbs(Http.POST);
Routes(WebRoutes.Music.SHUFFLE_TRACKS);
DontAutoTag();
Options(options => options.WithTags("Music"));
}
/// <summary>
/// Retrieves a random selection of tracks of the library identified in the request.
/// </summary>
/// <param name="request">The request containing the selection size, the optional scope and the tracks to exclude.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(ShuffleTracksRequest request, CancellationToken cancellationToken)
{
List<MusicShuffleTrackDto> response = await _apiHttpClient.PostAsync<List<MusicShuffleTrackDto>, ShuffleTracksRequest>(
BuildEndpoint(request.LibraryId), request, cancellationToken).ConfigureAwait(false);
return JsonSuccess(response);
}
/// <summary>
/// Builds the API endpoint used to retrieve a random selection of tracks.
/// </summary>
/// <param name="libraryId">The Id of the media library the tracks are sampled from.</param>
/// <returns>The API endpoint to which the retrieval request is sent.</returns>
private static string BuildEndpoint(Guid libraryId)
{
// The strongly typed Id is formatted as a Guid, so the substituted route value can never escape its URL segment.
return ApiRoutes.Music.SHUFFLE_TRACKS.Replace("{libraryId}", libraryId.ToString());
}
}
@@ -0,0 +1,36 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Presentation.Web.Common.DTO.AudioLibrary.MusicLibrary;
using Lumina.Presentation.Web.Common.Requests.Library.AudioLibrary.MusicLibrary.Tracks;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Web.Core.Endpoints.Library.AudioLibrary.MusicLibrary.Tracks.ShuffleTracks;
/// <summary>
/// Class used for providing a textual description for the <see cref="ShuffleTracksEndpoint"/> endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class ShuffleTracksEndpointSummary : Summary<ShuffleTracksEndpoint, ShuffleTracksRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="ShuffleTracksEndpointSummary"/> class.
/// </summary>
public ShuffleTracksEndpointSummary()
{
Summary = "Draws a random selection of tracks from a media library, an artist or an album.";
Description = "Returns uniformly random tracks from the whole library, one artist, or one album, excluding the tracks the caller already queued. The tracks are selected by the API database, so a large library does not have to be enumerated by the browser.";
Response(200, "The random selection of tracks is returned.", example: new[] { new MusicShuffleTrackDto
{
TrackId = Guid.NewGuid(),
Title = "Bohemian Rhapsody",
DurationInSeconds = 354,
AlbumId = Guid.NewGuid(),
AlbumTitle = "A Night at the Opera",
ArtistId = Guid.NewGuid(),
CoverPath = "/music/queen/a-night-at-the-opera/cover.jpg"
}});
}
}
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>لا يمكن أن تكون جودة البث فارغة!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>يجب أن يكون عدد المقطوعات العشوائية أكبر من صفر!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>يجب ألا يتجاوز عدد المقطوعات العشوائية 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>Die Streaming-Qualität darf nicht null sein!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>Die Anzahl der Shuffle-Titel muss größer als null sein!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>Die Anzahl der Shuffle-Titel darf höchstens 500 betragen!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>The streaming quality cannot be null!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>The shuffle track count must be greater than zero!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>The shuffle track count must be at most 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>¡La calidad de transmisión no puede ser nula!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>¡La cantidad de pistas de reproducción aleatoria debe ser mayor que cero!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>¡La cantidad de pistas de reproducción aleatoria no debe superar 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>La qualité de diffusion ne peut pas être nulle !</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>Le nombre de pistes du shuffle doit être supérieur à zéro !</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>Le nombre de pistes du shuffle ne doit pas dépasser 500 !</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>La qualità dello streaming non può essere nulla!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>Il numero di brani dello shuffle deve essere maggiore di zero!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>Il numero di brani dello shuffle non può superare 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>ストリーミング品質は null にできません。</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>シャッフルするトラック数は 0 より大きい必要があります。</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>シャッフルするトラック数は 500 以下である必要があります。</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>The streaming quality cannot be null!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>The shuffle track count must be greater than zero!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>The shuffle track count must be at most 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>Calitatea fluxului nu poate fi nulă!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>Numărul de piste pentru redare aleatorie trebuie să fie mai mare decât zero!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>Numărul de piste pentru redare aleatorie nu poate depăși 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>Якість потокового передавання не може бути порожньою!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>Кількість треків для перемішування має бути більшою за нуль!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>Кількість треків для перемішування не може перевищувати 500!</value>
</data>
</root>
@@ -843,4 +843,10 @@
<data name="StreamingQualityCannotBeNull" xml:space="preserve">
<value>流媒体质量不能为空!</value>
</data>
<data name="ShuffleTrackCountMustBeGreaterThanZero" xml:space="preserve">
<value>随机播放曲目数必须大于零!</value>
</data>
<data name="ShuffleTrackCountMustBeAtMost500" xml:space="preserve">
<value>随机播放曲目数不能超过 500!</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>لا توجد مكتبات</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>تشغيل عشوائي</value>
</data>
<data name="Play" xml:space="preserve">
<value>تشغيل</value>
</data>
<data name="Actions" xml:space="preserve">
<value>الإجراءات</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Keine Bibliotheken</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Zufällige Wiedergabe</value>
</data>
<data name="Play" xml:space="preserve">
<value>Abspielen</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Aktionen</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>No libraries</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Sin bibliotecas</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatorio</value>
</data>
<data name="Play" xml:space="preserve">
<value>Reproducir</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acciones</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Aucune bibliothèque</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Lecture aléatoire</value>
</data>
<data name="Play" xml:space="preserve">
<value>Lecture</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Nessuna libreria</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Riproduzione casuale</value>
</data>
<data name="Play" xml:space="preserve">
<value>Riproduci</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Azioni</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>ライブラリがありません</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>シャッフル</value>
</data>
<data name="Play" xml:space="preserve">
<value>再生</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>No libraries</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Nicio bibliotecă</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatoriu</value>
</data>
<data name="Play" xml:space="preserve">
<value>Redare</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acțiuni</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>Немає бібліотек</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Перемішати</value>
</data>
<data name="Play" xml:space="preserve">
<value>Відтворити</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Дії</value>
</data>
</root>
@@ -120,4 +120,13 @@
<data name="NoLibraries" xml:space="preserve">
<value>无库</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>随机播放</value>
</data>
<data name="Play" xml:space="preserve">
<value>播放</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>المعرّفات</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>تشغيل الألبوم</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>تشغيل المقطع</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Kennungen</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Album abspielen</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Titel abspielen</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identifiers</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Play album</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identificadores</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Reproducir el álbum</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Reproducir la pista</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identifiants</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Lire l'album</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Lire la piste</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identificatori</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Riproduci l'album</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Riproduci il brano</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>識別子</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>アルバムを再生</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>トラックを再生</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identifiers</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Play album</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Identificatori</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Redă albumul</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Redă piesa</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>Ідентифікатори</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>Відтворити альбом</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Відтворити трек</value>
</data>
</root>
@@ -1506,4 +1506,10 @@
<data name="Identifiers" xml:space="preserve">
<value>标识符</value>
</data>
<data name="PlayAlbum" xml:space="preserve">
<value>播放专辑</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>播放曲目</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>تعذر حذف العنصر.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>تشغيل عشوائي</value>
</data>
<data name="Play" xml:space="preserve">
<value>تشغيل</value>
</data>
<data name="Actions" xml:space="preserve">
<value>الإجراءات</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>Das Element konnte nicht gelöscht werden.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Zufällige Wiedergabe</value>
</data>
<data name="Play" xml:space="preserve">
<value>Abspielen</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Aktionen</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>The item could not be deleted.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>No se ha podido eliminar el elemento.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatorio</value>
</data>
<data name="Play" xml:space="preserve">
<value>Reproducir</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acciones</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>L'élément n'a pas pu être supprimé.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Lecture aléatoire</value>
</data>
<data name="Play" xml:space="preserve">
<value>Lecture</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>Non è stato possibile eliminare l'elemento.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Riproduzione casuale</value>
</data>
<data name="Play" xml:space="preserve">
<value>Riproduci</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Azioni</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>項目を削除できませんでした。</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>シャッフル</value>
</data>
<data name="Play" xml:space="preserve">
<value>再生</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>The item could not be deleted.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Actions</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>Elementul nu a putut fi șters.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatoriu</value>
</data>
<data name="Play" xml:space="preserve">
<value>Redare</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Acțiuni</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>Не вдалося видалити елемент.</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Перемішати</value>
</data>
<data name="Play" xml:space="preserve">
<value>Відтворити</value>
</data>
<data name="Actions" xml:space="preserve">
<value>Дії</value>
</data>
</root>
@@ -57,4 +57,13 @@
<data name="DeleteFailed" xml:space="preserve">
<value>无法删除该项目。</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>随机播放</value>
</data>
<data name="Play" xml:space="preserve">
<value>播放</value>
</data>
<data name="Actions" xml:space="preserve">
<value>操作</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>إضافة ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>تشغيل الكل</value>
</data>
<data name="Play" xml:space="preserve">
<value>تشغيل</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>تشغيل عشوائي</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>ISNI hinzufügen</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Alle abspielen</value>
</data>
<data name="Play" xml:space="preserve">
<value>Abspielen</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Zufällige Wiedergabe</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Add ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Play all</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Añadir ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Reproducir todo</value>
</data>
<data name="Play" xml:space="preserve">
<value>Reproducir</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatorio</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Ajouter un ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Tout lire</value>
</data>
<data name="Play" xml:space="preserve">
<value>Lire</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Lecture aléatoire</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Aggiungi ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Riproduci tutto</value>
</data>
<data name="Play" xml:space="preserve">
<value>Riproduci</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Riproduzione casuale</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>ISNI を追加</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>すべて再生</value>
</data>
<data name="Play" xml:space="preserve">
<value>再生</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>シャッフル</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Add ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Play all</value>
</data>
<data name="Play" xml:space="preserve">
<value>Play</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Shuffle</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Adaugă ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Redă tot</value>
</data>
<data name="Play" xml:space="preserve">
<value>Redă</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Aleatoriu</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>Додати ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>Відтворити все</value>
</data>
<data name="Play" xml:space="preserve">
<value>Відтворити</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>Перемішати</value>
</data>
</root>
@@ -1083,4 +1083,13 @@
<data name="AddIsni" xml:space="preserve">
<value>添加 ISNI</value>
</data>
<data name="PlayAll" xml:space="preserve">
<value>全部播放</value>
</data>
<data name="Play" xml:space="preserve">
<value>播放</value>
</data>
<data name="Shuffle" xml:space="preserve">
<value>随机播放</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>إضافة ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>تشغيل المقطع</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>ISWC hinzufügen</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Titel abspielen</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Add ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Añadir ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Reproducir la pista</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Ajouter un ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Lire la piste</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Aggiungi ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Riproduci il brano</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>ISWC を追加</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>トラックを再生</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Add ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Play track</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Adaugă ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Redă piesa</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>Додати ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>Відтворити трек</value>
</data>
</root>
@@ -1179,4 +1179,7 @@
<data name="AddWorkIswc" xml:space="preserve">
<value>添加 ISWC</value>
</data>
<data name="PlayTrack" xml:space="preserve">
<value>播放曲目</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>إعادة المحاولة</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>تبديل الارتفاع الكامل</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>توسيع المشغل أو طيه</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>تبديل الرؤية</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>تشغيل عشوائي متوقف</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>إيقاف</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>أعمال فنية للألبوم</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Wiederholen</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Vollhöhe Umschalten</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Player ein- oder ausklappen</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Sichtbarkeit Umschalten</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Zufallswiedergabe aus</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Stopp</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Albumcover</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Retry</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Toggle Full Height</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Expand or collapse player</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Toggle Visibility</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Shuffle off</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Stop</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Album artwork</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Reintentar</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Alternar Altura Completa</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Expandir o contraer el reproductor</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Alternar Visibilidad</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Reproducción aleatoria desactivada</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Detener</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Ilustraciones del álbum</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Réessayer</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Basculer Hauteur Complète</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Développer ou réduire le lecteur</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Basculer Visibilité</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Lecture aléatoire désactivée</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Arrêter</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Illustrations de l'album</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Riprova</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Attiva/Disattiva Altezza Piena</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Espandi o comprimi il lettore</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Attiva/Disattiva Visibilità</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Riproduzione casuale disattivata</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Ferma</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Illustrazioni dell'album</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>再試行</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>全高表示切替</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>プレーヤーを展開または折りたたむ</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>表示切替</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>シャッフルなし</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>停止</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>アルバムアートワーク</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Retry</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Toggle Full Height</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Expand or collapse player</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Toggle Visibility</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Shuffle off</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Stop</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Album artwork</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Reîncercare</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Comutare Înălțime Completă</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Extinde sau restrânge playerul</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Comutare Vizibilitate</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Redare aleatorie oprită</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Oprește</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Ilustrații album</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>Повторити</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>Перемкнути Повну Висоту</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>Розгорнути або згорнути плеєр</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>Перемкнути Видимість</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>Перемішування вимкнено</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>Зупинити</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>Обкладинки альбому</value>
</data>
</root>
@@ -168,8 +168,8 @@
<data name="Retry" xml:space="preserve">
<value>重试</value>
</data>
<data name="ToggleFullHeight" xml:space="preserve">
<value>切换全高</value>
<data name="ToggleExpanded" xml:space="preserve">
<value>展开或折叠播放器</value>
</data>
<data name="ToggleVisibility" xml:space="preserve">
<value>切换可见性</value>
@@ -216,4 +216,10 @@
<data name="AudioPlayerShuffleOff" xml:space="preserve">
<value>关闭随机播放</value>
</data>
<data name="AudioPlayerStop" xml:space="preserve">
<value>停止</value>
</data>
<data name="AudioPlayerAlbumArtwork" xml:space="preserve">
<value>专辑插图</value>
</data>
</root>
@@ -41,20 +41,16 @@ public sealed class ThemeAudioPlayerBuilder
{
Dictionary<string, object?> strings = new()
{
["toggleFullHeight"] = Localize("ToggleFullHeight"),
["toggleVisibility"] = Localize("ToggleVisibility"),
["toggleExpanded"] = Localize("ToggleExpanded"),
["previous"] = Localize("AudioPlayerPrevious"),
["next"] = Localize("AudioPlayerNext"),
["shuffle"] = Localize("AudioPlayerShuffle"),
["shuffleOff"] = Localize("AudioPlayerShuffleOff"),
["shuffleRelease"] = Localize("AudioPlayerShuffleRelease"),
["shuffleArtist"] = Localize("AudioPlayerShuffleArtist"),
["shuffleLibrary"] = Localize("AudioPlayerShuffleLibrary"),
["stop"] = Localize("AudioPlayerStop"),
["repeat"] = Localize("AudioPlayerRepeat"),
["repeatOff"] = Localize("AudioPlayerRepeatOff"),
["repeatAll"] = Localize("AudioPlayerRepeatAll"),
["repeatOne"] = Localize("AudioPlayerRepeatOne"),
["queue"] = Localize("AudioPlayerQueue")
["queue"] = Localize("AudioPlayerQueue"),
["albumArtwork"] = Localize("AudioPlayerAlbumArtwork")
};
return new ThemeAudioPlayerDto(
@@ -59,6 +59,123 @@
const librariesContainer = document.getElementById('libraries-container');
const noLibrariesMessage = document.getElementById('no-libraries');
const jsLocalizedStrings = {
actions: @Json.Serialize(_localizer["Actions"].Value),
play: @Json.Serialize(_localizer["Play"].Value),
shuffle: @Json.Serialize(_localizer["Shuffle"].Value)
};
// Closes the actions menus of all the music library cards.
function closeCardMenus() {
librariesContainer.querySelectorAll('.media-card.open').forEach(card => {
card.classList.remove('open');
const menu = card.querySelector('.card-actions-menu');
if (menu)
menu.classList.remove('open');
});
}
// Toggles the actions menu of a music library card, opening it with its top left corner at the given viewport position.
function toggleCardMenu(card, anchor) {
const wasOpen = card.classList.contains('open');
closeCardMenus();
if (wasOpen)
return;
card.classList.add('open');
const menu = card.querySelector('.card-actions-menu');
if (menu) {
menu.classList.add('open');
positionActionsMenu(menu, anchor);
}
}
// Resolves the viewport point where the card actions menu opens.
function resolveMenuAnchor(event) {
if (event.clientX !== 0 || event.clientY !== 0)
return { x: event.clientX, y: event.clientY };
const triggerRect = event.currentTarget.getBoundingClientRect();
return { x: triggerRect.left, y: triggerRect.bottom };
}
// Places the card actions menu with its top left corner at the requested viewport point.
function positionActionsMenu(menu, anchor) {
const margin = 4;
const maxLeft = Math.max(margin, window.innerWidth - menu.offsetWidth - margin);
const maxTop = Math.max(margin, window.innerHeight - menu.offsetHeight - margin);
menu.style.position = 'fixed';
menu.style.left = `${Math.min(Math.max(margin, anchor.x), maxLeft)}px`;
menu.style.top = `${Math.min(Math.max(margin, anchor.y), maxTop)}px`;
}
// Closes the actions menus when clicking or pressing a key outside them.
function handleCardMenuDismiss(event) {
if (event.type === 'keydown' && event.key !== 'Escape')
return;
if (event.type === 'click' && event.target.closest('.card-actions-menu, .card-actions-trigger'))
return;
closeCardMenus();
}
// Adds the actions menu of a music library card, with the play and shuffle actions that start the whole library.
function createMusicLibraryMenu(card, library) {
const libraryCoverPath = library.coverImage
? `/media/libraries/${library.id}/${library.coverImage.substring(library.coverImage.lastIndexOf('cover.'))}`
: '';
const trigger = document.createElement('button');
trigger.type = 'button';
trigger.className = 'card-actions-trigger';
trigger.setAttribute('aria-haspopup', 'menu');
trigger.setAttribute('aria-label', jsLocalizedStrings.actions);
trigger.addEventListener('click', event => {
event.preventDefault();
event.stopImmediatePropagation();
toggleCardMenu(card, resolveMenuAnchor(event));
});
const menu = document.createElement('nav');
menu.className = 'card-actions-menu';
menu.setAttribute('role', 'menu');
const playAction = document.createElement('a');
playAction.setAttribute('role', 'menuitem');
playAction.href = '#';
playAction.className = 'card-action-play';
playAction.textContent = jsLocalizedStrings.play;
playAction.setAttribute('data-audio-player-play-library', '');
playAction.dataset.libraryId = library.id;
playAction.dataset.title = library.title || '';
if (libraryCoverPath)
playAction.dataset.coverArtPath = libraryCoverPath;
menu.appendChild(playAction);
const shuffleAction = document.createElement('a');
shuffleAction.setAttribute('role', 'menuitem');
shuffleAction.href = '#';
shuffleAction.className = 'card-action-shuffle';
shuffleAction.textContent = jsLocalizedStrings.shuffle;
shuffleAction.setAttribute('data-audio-player-play-library-shuffled', '');
shuffleAction.dataset.libraryId = library.id;
menu.appendChild(shuffleAction);
menu.addEventListener('click', event => {
// The global audio player delegation handles the play and shuffle actions; the menu only closes here.
if (event.target.closest('.card-action-play, .card-action-shuffle'))
closeCardMenus();
});
card.appendChild(trigger);
card.appendChild(menu);
card.addEventListener('contextmenu', event => {
event.preventDefault();
event.stopImmediatePropagation();
toggleCardMenu(card, resolveMenuAnchor(event));
});
card.addEventListener('click', event => {
if (card.classList.contains('open') && !event.target.closest('.card-actions-menu'))
closeCardMenus();
});
}
async function InitializeAsync() {
if (isInitialized)
return;
@@ -95,7 +212,15 @@
<span class="text-light-two"><strong>${library.title}</strong></span>
`;
librariesContainer.appendChild(libraryElement);
// A music library gets a card actions menu with the play and shuffle actions for the whole library.
if (library.libraryType === 'Music') {
const card = document.createElement('div');
card.className = 'media-card';
card.appendChild(libraryElement);
createMusicLibraryMenu(card, library);
librariesContainer.appendChild(card);
} else
librariesContainer.appendChild(libraryElement);
});
// Bind the AJAX navigation behavior to the library links, which were created after the initial navigation binding.
bindNavigationLinks();
@@ -107,10 +232,14 @@
}
// Add listeners.
document.addEventListener('click', handleCardMenuDismiss);
document.addEventListener('keydown', handleCardMenuDismiss);
document.addEventListener('DOMContentLoaded', InitializeAsync);
// Register cleanup for these listeners.
cleanupFunctions.push(() => {
document.removeEventListener('click', handleCardMenuDismiss);
document.removeEventListener('keydown', handleCardMenuDismiss);
document.removeEventListener('DOMContentLoaded', InitializeAsync);
});
@@ -8,6 +8,10 @@
The tracks of the album are NOT edited inline: they are listed as cards that navigate to their own pages,
and the update request never changes the tracks.
The album header and every track row the script renders expose a play trigger for the global audio player. The player
handles those triggers by event delegation, so this view binds no playback listener; the trigger attribute contract
lives in docs/technical/theming/Theming.md.
To change the behavior of the page, edit this script (and the theme template, when present). To restyle
the page, edit the theme files. This fallback keeps every feature working without styling, so that a
broken theme is obvious to the user while the page still functions.
@@ -73,6 +77,13 @@
})
.ToList();
var artworkItemsJson = System.Text.Json.JsonSerializer.Serialize(artworkItems);
// The cover the play affordances hand to the player, resolved exactly like the cover this page displays: the stored cover, or the first stored artwork when the album has no cover.
var playCoverPath = Model.CoverPath;
if (string.IsNullOrWhiteSpace(playCoverPath))
playCoverPath = (Model.Artwork ?? []).FirstOrDefault(artwork => !string.IsNullOrWhiteSpace(artwork.Path))?.Path ?? string.Empty;
// The play album trigger starts disabled when the album is already known to hold no tracks, so an empty release cannot be
// clicked before the track list request resolves. A failed request never changes this state.
var hasTracks = (Model.Tracks?.Count ?? 0) > 0;
}
@inject IViewLocalizer _localizer
@@ -88,6 +99,16 @@
<div class="shine-effect"></div>
<div class="form-row">
<button id="btn-back-to-artist" type="button" class="abort-button">@_localizer["BackToArtist"]</button>
<!-- The play album trigger is handled by the global audio player script through event delegation, so this page binds no click handler of its own. -->
<button id="btn-play-album" type="button" class="confirm-button" @(hasTracks ? string.Empty : "disabled")
data-audio-player-play
data-library-id="@libraryId"
data-album-id="@albumId"
data-artist-id="@artistId"
data-title="@(metadata?.Title ?? string.Empty)"
data-cover-art-path="@(playCoverPath ?? string.Empty)">
@_localizer["PlayAlbum"]
</button>
</div>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">@_localizer["EditAlbum"]</h1>
@@ -112,6 +133,7 @@
<div class="form-row">
<table class="w-100 form-table tracks-table">
<colgroup>
<col />
<col class="track-number-column" />
<col />
<col class="track-duration-column" />
@@ -589,6 +611,7 @@
const artistId = '@artistId';
const albumId = '@albumId';
const albumTitle = @Json.Serialize(metadata?.Title ?? string.Empty);
const libraryId = '@libraryId';
const saveUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Music.SAVE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) })'.replace('/@(default(Guid))', `/${artistId}`).replace('/@(default(Guid))', `/${albumId}`);
const deleteUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.Music.DELETE_ALBUM, new { artistId = default(Guid), albumId = default(Guid) })'.replace('/@(default(Guid))', `/${artistId}`).replace('/@(default(Guid))', `/${albumId}`);
@@ -601,6 +624,7 @@
const btnBackToArtist = document.getElementById('btn-back-to-artist');
const btnSaveAlbum = document.getElementById('btn-save-album');
const btnDeleteAlbum = document.getElementById('btn-delete-album');
const btnPlayAlbum = document.getElementById('btn-play-album');
const btnAddCatalogNumber = document.getElementById('btn-add-catalog-number');
const btnAddReleaseType = document.getElementById('btn-add-release-type');
const btnAddGenre = document.getElementById('btn-add-genre');
@@ -633,9 +657,34 @@
noCover: @Json.Serialize(_localizer["NoCover"].Value),
coverSaved: @Json.Serialize(_localizer["CoverSaved"].Value),
coverUploadFailed: @Json.Serialize(_localizer["CoverUploadFailed"].Value),
playTrack: @Json.Serialize(_localizer["PlayTrack"].Value),
remove: @Json.Serialize(_localizer["Remove"].Value)
};
// Normalizes a cover path with the same rule the server uses: a missing or whitespace only path means no artwork.
function normalizeCoverPath(coverPath) {
return typeof coverPath === 'string' ? coverPath.trim() : '';
}
// The cover path the play affordances hand to the player, kept in step with the artwork the page currently displays.
let currentCoverPath = normalizeCoverPath(@Json.Serialize(playCoverPath ?? string.Empty));
// Writes the cover of a play descriptor onto a trigger, dropping the attribute when the context has no artwork.
function applyDescriptorCover(trigger, coverPath) {
const normalizedCoverPath = normalizeCoverPath(coverPath);
if (normalizedCoverPath)
trigger.dataset.coverArtPath = normalizedCoverPath;
else
delete trigger.dataset.coverArtPath;
}
// Hands every play trigger the cover the page currently displays, so a play started after choosing or uploading an artwork shows that artwork in the player bar.
function applyPlayAffordanceCover(coverPath) {
currentCoverPath = normalizeCoverPath(coverPath);
applyDescriptorCover(btnPlayAlbum, currentCoverPath);
tracksBody.querySelectorAll('[data-audio-player-play]').forEach(trigger => applyDescriptorCover(trigger, currentCoverPath));
}
// Reads the trimmed value of the element with the provided id.
function readValue(id) {
const element = document.getElementById(id);
@@ -898,20 +947,51 @@
return `${minutes}:${paddedSeconds}`;
}
// Renders a row of the tracks table per track, or shows the empty message when the album has no tracks.
// Renders a row of the tracks table per track, or shows the empty message when the album has no tracks. A failed
// request returns undefined, which is not an empty album: it leaves the existing rows and the play album state intact.
function renderTracks(response) {
if (!response || !Array.isArray(response.data))
return;
tracksBody.innerHTML = '';
const tracks = response && response.data ? response.data : [];
const tracks = response.data;
noTracksMessage.classList.toggle('hidden', tracks.length !== 0);
// Only a successful empty list disables the play album trigger. The player can still build the queue itself when
// the track list could not be loaded.
btnPlayAlbum.disabled = tracks.length === 0;
tracks.forEach(track => tracksBody.appendChild(createTrackRow(track)));
bindNavigationLinks();
}
// Creates a row of the tracks table, with the name of the track linking to its own page.
// Creates the play trigger of a track row. It describes a track context, so the player plays exactly this track.
function createTrackPlayButton(track) {
const button = document.createElement('button');
button.type = 'button';
button.className = 'confirm-button';
button.setAttribute('data-audio-player-play', '');
button.dataset.libraryId = libraryId;
button.dataset.trackId = track.id;
button.dataset.albumId = albumId;
button.dataset.artistId = artistId;
button.dataset.title = track.title || '';
button.dataset.albumTitle = albumTitle;
button.dataset.duration = String(track.durationInSeconds || '');
applyDescriptorCover(button, currentCoverPath);
// The button carries no visible text, so its accessible name names both the action and the track it plays.
const label = `${jsLocalizedStrings.playTrack}: ${track.title || ''}`;
button.setAttribute('aria-label', label);
button.title = label;
button.textContent = '\u25B6';
return button;
}
// Creates a row of the tracks table, with the play trigger, the number, the name of the track linking to its own page and the duration.
function createTrackRow(track) {
const row = document.createElement('tr');
row.className = 'track-row';
const playCell = document.createElement('td');
playCell.appendChild(createTrackPlayButton(track));
const numberCell = document.createElement('td');
numberCell.textContent = track.trackNumber;
@@ -925,6 +1005,7 @@
const durationCell = document.createElement('td');
durationCell.textContent = formatDuration(track.durationInSeconds);
row.appendChild(playCell);
row.appendChild(numberCell);
row.appendChild(nameCell);
row.appendChild(durationCell);
@@ -1007,6 +1088,8 @@
coverImage.dataset.coverPath = storedPath;
coverPathLabel.textContent = storedPath ? storedPath : jsLocalizedStrings.noCover;
coverPathLabel.title = storedPath;
// The player shows the cover the page displays, so the uploaded cover is handed to the play triggers too.
applyPlayAffordanceCover(storedPath);
};
reader.readAsDataURL(file);
notificationService.show(jsLocalizedStrings.coverSaved, NotificationType.SUCCESS);
@@ -1042,12 +1125,14 @@
artworkCarousel.querySelectorAll('.artwork-carousel-item').forEach(item => {
item.classList.toggle('selected', item.dataset.artworkPath === artworkPath);
});
// The play affordances hand the player the cover the page currently displays, so a play started after choosing an artwork shows that artwork in the player bar.
applyPlayAffordanceCover(artworkPath);
}
// Shows the cover image of the album, or the first stored artwork when there is no cover, or a placeholder when the album has neither.
function showCover() {
const coverPath = coverImage.dataset.coverPath || '';
const artworkPath = coverPath || (artworkItems.length > 0 ? artworkItems[0].path : '');
const coverPath = normalizeCoverPath(coverImage.dataset.coverPath);
const artworkPath = coverPath || (artworkItems.length > 0 ? normalizeCoverPath(artworkItems[0].path) : '');
if (artworkPath) {
selectArtwork(artworkPath);
} else {
@@ -110,6 +110,9 @@
sortAscending: '@_localizer["SortAscending"]',
sortDescending: '@_localizer["SortDescending"]',
viewDetails: '@_localizer["ViewDetails"]',
actions: '@_localizer["Actions"]',
play: '@_localizer["Play"]',
shuffle: '@_localizer["Shuffle"]',
deleteItem: '@_localizer["Delete"]',
deleteConfirm: '@_localizer["DeleteConfirm"]',
deleteFailed: '@_localizer["DeleteFailed"]'
@@ -208,7 +211,7 @@
trigger.type = 'button';
trigger.className = 'card-actions-trigger';
trigger.setAttribute('aria-haspopup', 'menu');
trigger.setAttribute('aria-label', jsLocalizedStrings.viewDetails);
trigger.setAttribute('aria-label', jsLocalizedStrings.actions);
trigger.addEventListener('click', event => {
event.preventDefault();
event.stopImmediatePropagation();
@@ -218,11 +221,54 @@
const menu = document.createElement('nav');
menu.className = 'card-actions-menu';
menu.setAttribute('role', 'menu');
menu.innerHTML = `
<a role="menuitem" href="${artistUrl}">${jsLocalizedStrings.viewDetails}</a>
<a role="menuitem" href="#" class="card-action-delete">${jsLocalizedStrings.deleteItem}</a>`;
const detailsAction = document.createElement('a');
detailsAction.setAttribute('role', 'menuitem');
detailsAction.href = artistUrl;
detailsAction.textContent = jsLocalizedStrings.viewDetails;
const playAction = document.createElement('a');
playAction.setAttribute('role', 'menuitem');
playAction.href = '#';
playAction.className = 'card-action-play';
playAction.textContent = jsLocalizedStrings.play;
playAction.setAttribute('data-audio-player-play', '');
playAction.dataset.libraryId = libraryId;
playAction.dataset.artistId = artist.id;
playAction.dataset.title = artist.name || '';
if (artist.coverPath)
playAction.dataset.coverArtPath = artist.coverPath;
const shuffleAction = document.createElement('a');
shuffleAction.setAttribute('role', 'menuitem');
shuffleAction.href = '#';
shuffleAction.className = 'card-action-shuffle';
shuffleAction.textContent = jsLocalizedStrings.shuffle;
shuffleAction.setAttribute('data-audio-player-play-shuffled', '');
shuffleAction.setAttribute('data-audio-player-shuffle-scope', 'artist');
shuffleAction.dataset.libraryId = libraryId;
shuffleAction.dataset.artistId = artist.id;
shuffleAction.dataset.title = artist.name || '';
if (artist.coverPath)
shuffleAction.dataset.coverArtPath = artist.coverPath;
const deleteAction = document.createElement('a');
deleteAction.setAttribute('role', 'menuitem');
deleteAction.href = '#';
deleteAction.className = 'card-action-delete';
deleteAction.textContent = jsLocalizedStrings.deleteItem;
menu.appendChild(detailsAction);
menu.appendChild(playAction);
menu.appendChild(shuffleAction);
menu.appendChild(deleteAction);
menu.addEventListener('click', async event => {
// The global audio player delegation handles the play and shuffle actions; the menu only closes here.
if (event.target.closest('.card-action-play, .card-action-shuffle')) {
closeCardMenus();
return;
}
const deleteItem = event.target.closest('.card-action-delete');
const menuItem = event.target.closest('a[role="menuitem"]');
if (!menuItem)
@@ -9,6 +9,9 @@
The albums of the artist are NOT edited inline: they are listed as cards that navigate to their own pages,
and the update request only round-trips the albums unchanged, so that updating the artist never drops them.
The artist header exposes a play all trigger for the global audio player. The player handles the trigger by event
delegation, so this view binds no playback listener; the trigger attribute contract lives in docs/technical/theming/Theming.md.
To change the behavior of the page, edit this script (and the theme template, when present). To restyle
the page, edit the theme files. This fallback keeps every feature working without styling, so that a
broken theme is obvious to the user while the page still functions.
@@ -36,6 +39,9 @@
var aliases = metadata?.Aliases ?? [];
var contributors = Model.Contributors ?? [];
var ratings = Model.Ratings ?? [];
// The play all trigger starts disabled when the artist is already known to hold no releases, so an empty discography
// cannot be clicked before the release list request resolves. A failed request never changes this state.
var hasReleases = (Model.Albums?.Count ?? 0) > 0;
var genres = metadata?.Genres ?? [];
var tags = metadata?.Tags ?? [];
var area = metadata?.Area;
@@ -110,6 +116,15 @@
<div class="shine-effect"></div>
<div class="form-row">
<button id="btn-back-to-artists" type="button" class="abort-button">@_localizer["BackToArtists"]</button>
<!-- The play all trigger is handled by the global audio player script through event delegation, so this page binds no click handler of its own. -->
<button id="btn-play-artist" type="button" class="confirm-button" @(hasReleases ? string.Empty : "disabled")
data-audio-player-play
data-library-id="@libraryId"
data-artist-id="@artistId"
data-title="@(metadata?.Name ?? string.Empty)"
data-cover-art-path="@(Model.CoverPath ?? string.Empty)">
@_localizer["PlayAll"]
</button>
</div>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">@_localizer["EditArtist"]</h1>
@@ -624,6 +639,7 @@
const btnBackToArtists = document.getElementById('btn-back-to-artists');
const btnSaveArtist = document.getElementById('btn-save-artist');
const btnDeleteArtist = document.getElementById('btn-delete-artist');
const btnPlayArtist = document.getElementById('btn-play-artist');
const btnAddAlias = document.getElementById('btn-add-alias');
const btnAddIpi = document.getElementById('btn-add-ipi');
const btnAddIsni = document.getElementById('btn-add-isni');
@@ -656,6 +672,8 @@
noCover: @Json.Serialize(_localizer["NoCover"].Value),
coverSaved: @Json.Serialize(_localizer["CoverSaved"].Value),
coverUploadFailed: @Json.Serialize(_localizer["CoverUploadFailed"].Value),
play: @Json.Serialize(_localizer["Play"].Value),
shuffle: @Json.Serialize(_localizer["Shuffle"].Value),
remove: @Json.Serialize(_localizer["Remove"].Value)
};
@@ -932,6 +950,28 @@
return deleteAlbumUrlTemplate.replace('/@(default(Guid))', `/${artistId}`).replace('/@(default(Guid))', `/${albumId}`) + `?libraryId=${libraryId}`;
}
// Writes the play descriptor of an album onto an album card menu action.
function applyAlbumPlayDescriptor(trigger, album) {
trigger.dataset.libraryId = libraryId;
trigger.dataset.artistId = artistId;
trigger.dataset.albumId = album.id;
trigger.dataset.title = album.title || '';
if (album.coverPath)
trigger.dataset.coverArtPath = album.coverPath;
else
delete trigger.dataset.coverArtPath;
}
// Creates an action of the album card actions menu.
function createAlbumMenuAction(label, className) {
const action = document.createElement('a');
action.setAttribute('role', 'menuitem');
action.href = '#';
action.className = className;
action.textContent = label;
return action;
}
// The localized labels of the release types, keyed by their canonical enum name.
const releaseTypeLabels = {
'Album': '@_localizer["Album"].Value',
@@ -962,11 +1002,16 @@
renderReleases(response);
}
// Renders the releases of the artist, grouped by their primary release type, each group ordered by release year.
// Renders the releases of the artist, grouped by their primary release type, each group ordered by release year. A
// failed request returns undefined, which is not an empty discography: it leaves the existing list and play state intact.
function renderReleases(response) {
if (!response || !Array.isArray(response.data))
return;
albumsContainer.querySelectorAll('.release-group').forEach(group => group.remove());
const releases = response && response.data ? response.data : [];
const releases = response.data;
noAlbumsMessage.classList.toggle('hidden', releases.length !== 0);
// Only a successful empty list disables the play all trigger. The player can still build the queue itself when the release list could not be loaded.
btnPlayArtist.disabled = releases.length === 0;
// The releases are grouped by their first release type, falling back to "Other" when the type is not known.
const groups = new Map();
@@ -1072,8 +1117,28 @@
const menu = document.createElement('nav');
menu.className = 'card-actions-menu';
menu.setAttribute('role', 'menu');
menu.innerHTML = `<a role="menuitem" href="#" class="card-action-delete">${jsLocalizedStrings.remove}</a>`;
const playAction = createAlbumMenuAction(jsLocalizedStrings.play, 'card-action-play');
playAction.setAttribute('data-audio-player-play', '');
applyAlbumPlayDescriptor(playAction, album);
const shuffleAction = createAlbumMenuAction(jsLocalizedStrings.shuffle, 'card-action-shuffle');
shuffleAction.setAttribute('data-audio-player-play-shuffled', '');
shuffleAction.setAttribute('data-audio-player-shuffle-scope', 'release');
applyAlbumPlayDescriptor(shuffleAction, album);
const deleteAction = createAlbumMenuAction(jsLocalizedStrings.remove, 'card-action-delete');
menu.appendChild(playAction);
menu.appendChild(shuffleAction);
menu.appendChild(deleteAction);
menu.addEventListener('click', async event => {
// Play and shuffle are handled by the global audio player delegation, so the menu only closes here.
if (event.target.closest('.card-action-play, .card-action-shuffle')) {
closeCardMenus();
return;
}
const deleteItem = event.target.closest('.card-action-delete');
if (!deleteItem)
return;
@@ -1237,6 +1302,11 @@
coverImage.dataset.coverPath = storedPath;
coverPathLabel.textContent = storedPath ? storedPath : jsLocalizedStrings.noCover;
coverPathLabel.title = storedPath;
// The player shows the cover the page displays, so the uploaded cover is handed to the play trigger too.
if (storedPath)
btnPlayArtist.dataset.coverArtPath = storedPath;
else
delete btnPlayArtist.dataset.coverArtPath;
};
reader.readAsDataURL(file);
notificationService.show(jsLocalizedStrings.coverSaved, NotificationType.SUCCESS);
@@ -10,6 +10,9 @@
The audio properties, the release information, the language and original language, the work, the
contributors, the ratings, the moods and the ISRCs are all editable, and they are all round-tripped on save.
The track header exposes a play trigger for the global audio player. The player handles the trigger by event
delegation, so this view binds no playback listener; the trigger attribute contract lives in docs/technical/theming/Theming.md.
To change the behavior of the page, edit this script (and the theme template, when present). To restyle
the page, edit the theme files. This fallback keeps every feature working without styling, so that a
broken theme is obvious to the user while the page still functions.
@@ -35,8 +38,10 @@
var libraryId = Model.LibraryId.ToString();
// The cover shown on the left is the cover of the album the track belongs to, passed in by the endpoint.
var albumCoverPath = ViewData["AlbumCoverPath"]?.ToString() ?? string.Empty;
// The track DTO does not carry the Id of its artist, so it is taken from the route that rendered the view.
var artistId = Context.Request.RouteValues["artistId"]?.ToString() ?? string.Empty;
var albumTitle = ViewData["AlbumTitle"]?.ToString() ?? string.Empty;
// The track DTO does not carry the Id of its artist, so the endpoint passes the normalized route value it used to load
// the track and its album. Both render paths therefore hand the player the same artist Id.
var artistId = ViewData["ArtistId"]?.ToString() ?? string.Empty;
var metadata = Model.Metadata;
var work = Model.Work;
var releaseInfo = metadata?.ReleaseInfo;
@@ -82,6 +87,19 @@
<div class="shine-effect"></div>
<div class="form-row">
<button id="btn-back-to-album" type="button" class="abort-button">@_localizer["BackToAlbum"]</button>
<!-- The play trigger is handled by the global audio player script through event delegation, so this page binds no click handler of its own. -->
<button id="btn-play-track" type="button" class="confirm-button"
data-audio-player-play
data-library-id="@libraryId"
data-track-id="@trackId"
data-album-id="@Model.AlbumId"
data-artist-id="@artistId"
data-title="@(metadata?.Title ?? string.Empty)"
data-album-title="@albumTitle"
data-duration="@(metadata?.DurationInSeconds?.ToString(CultureInfo.InvariantCulture) ?? string.Empty)"
data-cover-art-path="@albumCoverPath">
@_localizer["PlayTrack"]
</button>
</div>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">@_localizer["EditTrack"]</h1>
@@ -1,4 +1,4 @@
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Localization
@inject IStringLocalizerFactory _stringLocalizerFactory
@@ -20,27 +20,25 @@
The DOM contract a theme must preserve is:
- The container element with the 'audio-player-container' class, carrying 'not-shown' while the bar is hidden,
and 'full-height' while it is expanded. The audio player toggles both classes. While the bar is hidden the
player also sets the 'inert' attribute on it, and removes it when the bar is shown, so a collapsed bar keeps
none of its focusable controls in the tab order.
- The main content element, carrying 'audio-player-not-shown' while the bar is hidden, and 'audio-player-full-height'
while it is expanded. The audio player toggles both classes on it as well.
- The elements with the ids 'audio-player-full-height-toggle' and 'audio-player-close', which the global site script
binds and routes to the audio player.
- The hook attributes the audio player binds: 'data-audio-player-play-pause', '-previous', '-next', '-shuffle',
'-shuffle-control', '-shuffle-menu', '-repeat', '-progress', '-progress-played', '-progress-downloaded',
'-progress-undownloaded', '-current-time', '-total-time', '-track-name', '-cover-thumbnail', '-cover-image',
'-volume', '-volume-level', '-mute' and '-queue'. The volume fill element ('-volume-level') is a styling hook the
stylesheet drives from the custom properties below, not one the script writes to.
- The shuffle scope items carry 'data-audio-player-shuffle-scope' ('off', 'release', 'artist' or 'library'), inside
the menu element carrying 'data-audio-player-shuffle-menu'. The shuffle control carries 'data-audio-player-shuffle'
and is wrapped by 'data-audio-player-shuffle-control', so the player can open the menu near it and close it on an
outside click. It is a menu button: it carries 'aria-haspopup' and 'aria-expanded', gets the 'is-active' class while
shuffle is on, and does not carry 'aria-pressed'. The scope items get 'aria-checked' and the 'is-selected' class, and
the 'off' item is selected while shuffle is off. The repeat toggle carries 'data-audio-player-repeat' and the player
writes 'data-audio-player-repeat-mode' ('off', 'all' or 'one') and toggles the 'is-active' and 'is-one' classes on it.
and 'expanded' while it is expanded. The audio player toggles both classes. While the bar is hidden the player
also sets the 'inert' attribute on it, and removes it when the bar is shown, so a collapsed bar keeps none of
its focusable controls in the tab order. The position and orientation of the container are entirely theme-owned:
this fallback stylesheet uses a flex column with the bar at the bottom, but a theme may place the bar vertically
on a side and expand its queue horizontally.
- The main content element, carrying 'audio-player-not-shown' while the bar is hidden, and
'audio-player-bar-expanded' while it is expanded. The audio player toggles these classes on it as well.
- The element with the id 'audio-player-expand-toggle', which the global site script binds and routes to the audio player.
- The hook attributes the audio player binds: 'data-audio-player-play-pause', '-stop', '-previous', '-next', '-repeat',
'-progress', '-progress-played', '-progress-downloaded', '-progress-undownloaded', '-current-time', '-total-time',
'-track-name', '-album-name', '-now-playing-title', '-now-playing-release-type', '-now-playing-release',
'-now-playing-year', '-now-playing-artist', '-artwork-carousel', '-cover-thumbnail', '-cover-image', '-volume', '-volume-level', '-mute' and '-queue'.
The volume fill element ('-volume-level') is a styling hook the stylesheet drives from the custom properties below,
not one the script writes to. The repeat toggle carries 'data-audio-player-repeat' and the player writes
'data-audio-player-repeat-mode' ('off', 'all' or 'one') and toggles the 'is-active' and 'is-one' classes on it.
A queue item root rendered by the player always carries 'data-audio-player-queue-entry-id', whether it comes from the
theme sub template or from the built-in markup, so clicking it starts that entry.
theme sub template or from the built-in markup, so clicking it starts that entry. The queue element stays the scroll
container of the list, because the player scrolls the current entry to the start of whichever axis the theme makes
scrollable when playback advances or the bar expands.
- The three state progress bar: the played part carries 'audio-player-progress-played', the downloaded but not
played part carries 'audio-player-progress-downloaded', and the not yet downloaded part carries
'audio-player-progress-undownloaded'. Each layer also carries 'data-audio-player-progress-layer' ('played',
@@ -57,22 +55,40 @@
'audio-player-template-queue-item' and 'audio-player-template-playlist-item'. This application fallback partial
renders neither element; it intentionally uses the built-in queue item markup.
The play affordances the pages hand to the player use the 'data-audio-player-play' trigger attribute, and a play next
affordance uses 'data-audio-player-play-next'. A track trigger must carry libraryId, trackId, albumId and artistId,
because the playback manifest route needs all four Ids. The 'The Audio Player Bar' section of
The play affordances the pages hand to the player use the 'data-audio-player-play' trigger attribute, a shuffled play
affordance uses 'data-audio-player-play-shuffled' together with 'data-audio-player-shuffle-scope' ('release', 'artist' or
'library'), a whole library play affordance uses 'data-audio-player-play-library' with 'data-library-id', a whole library
shuffle affordance uses 'data-audio-player-play-library-shuffled' with 'data-library-id', and a play next affordance uses
'data-audio-player-play-next'. A track trigger must carry libraryId, trackId, albumId and artistId, because the playback
manifest route needs all four Ids. The 'Play Affordances on the Music Pages' section of
docs/technical/theming/Theming.md documents this contract for theme authors.
*@
<div class="audio-player-container not-shown" hidden>
<!-- Expanded area: cover art, and the queue when the play context holds more than one track. -->
<!-- Expanded area: current track details and album artwork beside the current queue, including a single track. -->
<div class="audio-player-expanded">
<img class="audio-player-cover-image" data-audio-player-cover-image alt="" />
<div class="audio-player-now-playing">
<img class="audio-player-cover-image" data-audio-player-cover-image alt="" />
<div class="audio-player-now-playing-labels">
<span class="audio-player-now-playing-title" data-audio-player-now-playing-title></span>
<div class="audio-player-now-playing-release-line">
<span class="audio-player-now-playing-release-type" data-audio-player-now-playing-release-type></span>
<span class="audio-player-now-playing-release" data-audio-player-now-playing-release></span>
<span class="audio-player-now-playing-year" data-audio-player-now-playing-year></span>
</div>
<span class="audio-player-now-playing-artist" data-audio-player-now-playing-artist></span>
</div>
<div class="audio-player-artwork-carousel artwork-carousel" data-audio-player-artwork-carousel role="group" aria-label="@localizer["AudioPlayerAlbumArtwork"]" hidden></div>
</div>
<ul class="audio-player-queue" data-audio-player-queue aria-label="@localizer["AudioPlayerQueue"]"></ul>
</div>
<!-- Condensed bar: transport controls, three state progress bar, volume, and track name. -->
<div class="audio-player-bar">
<img class="audio-player-cover-thumbnail" data-audio-player-cover-thumbnail alt="" />
<span class="audio-player-track-name" data-audio-player-track-name></span>
<div class="audio-player-track-labels">
<span class="audio-player-track-name" data-audio-player-track-name></span>
<span class="audio-player-album-name" data-audio-player-album-name></span>
</div>
<span class="audio-player-time audio-player-current-time" data-audio-player-current-time>0:00</span>
<div class="audio-player-progress" data-audio-player-progress data-audio-player-progress-state="idle" role="slider" tabindex="0"
aria-label="@localizer["AudioPlayerSeek"]" aria-valuemin="0" aria-valuemax="1" aria-valuenow="0" aria-busy="false">
@@ -82,24 +98,15 @@
</div>
<span class="audio-player-time audio-player-total-time" data-audio-player-total-time>--:--</span>
<div class="audio-player-queue-controls">
<div class="audio-player-shuffle-control" data-audio-player-shuffle-control>
<button type="button" class="audio-player-button audio-player-shuffle" data-audio-player-shuffle
aria-haspopup="menu" aria-expanded="false" aria-label="@localizer["AudioPlayerShuffle"]">
<span class="audio-player-shuffle-icon" aria-hidden="true">&#8646;</span>
</button>
<div class="audio-player-shuffle-menu" data-audio-player-shuffle-menu role="menu" hidden>
<button type="button" role="menuitemradio" aria-checked="true" data-audio-player-shuffle-scope="off">@localizer["AudioPlayerShuffleOff"]</button>
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="release">@localizer["AudioPlayerShuffleRelease"]</button>
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="artist">@localizer["AudioPlayerShuffleArtist"]</button>
<button type="button" role="menuitemradio" aria-checked="false" data-audio-player-shuffle-scope="library">@localizer["AudioPlayerShuffleLibrary"]</button>
</div>
</div>
<button type="button" class="audio-player-button audio-player-previous" data-audio-player-previous aria-label="@localizer["AudioPlayerPrevious"]">
<span class="audio-player-previous-icon" aria-hidden="true"></span>
</button>
<button type="button" class="audio-player-button audio-player-play-pause" data-audio-player-play-pause aria-label="@localizer["AudioPlayerPlay"]">
<span class="audio-player-play-pause-icon" aria-hidden="true"></span>
</button>
<button type="button" class="audio-player-button audio-player-stop" data-audio-player-stop aria-label="@localizer["AudioPlayerStop"]">
<span class="audio-player-stop-icon" aria-hidden="true"></span>
</button>
<button type="button" class="audio-player-button audio-player-next" data-audio-player-next aria-label="@localizer["AudioPlayerNext"]">
<span class="audio-player-next-icon" aria-hidden="true"></span>
</button>
@@ -119,8 +126,9 @@
</div>
</div>
<div class="audio-player-controls">
<button type="button" id="audio-player-full-height-toggle">@localizer["ToggleFullHeight"]</button>
<button type="button" id="audio-player-close">@localizer["ToggleVisibility"]</button>
<button type="button" id="audio-player-expand-toggle" aria-label="@localizer["ToggleExpanded"]">
<span class="audio-player-expand-icon" aria-hidden="true"></span>
</button>
</div>
</div>
</div>
@@ -50,6 +50,12 @@
getArtistsUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ARTISTS)',
getArtistAlbumsUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ARTIST_ALBUMS)',
getAlbumTracksUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ALBUM_TRACKS)',
// The full album details, used by the expanded player for the release labels and the artwork carousel of the
// current track's album. The route carries the artist and album Ids, and the library Id is a query parameter.
getAlbumUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.GET_ALBUM)',
// The endpoint that draws a uniformly random batch of tracks of a library, artist or album. The server samples the
// database, so a shuffle of a large library never has to enumerate its albums and tracks in the browser.
shuffleTracksUrl: '@_urlService.GetRelativeUrl(WebRoutes.Music.SHUFFLE_TRACKS)',
strings: {
play: '@localizer["AudioPlayerPlay"]',
pause: '@localizer["AudioPlayerPause"]',
@@ -60,16 +66,12 @@
buffering: '@localizer["AudioPlayerBuffering"]',
previous: '@localizer["AudioPlayerPrevious"]',
next: '@localizer["AudioPlayerNext"]',
shuffle: '@localizer["AudioPlayerShuffle"]',
shuffleOff: '@localizer["AudioPlayerShuffleOff"]',
shuffleRelease: '@localizer["AudioPlayerShuffleRelease"]',
shuffleArtist: '@localizer["AudioPlayerShuffleArtist"]',
shuffleLibrary: '@localizer["AudioPlayerShuffleLibrary"]',
repeat: '@localizer["AudioPlayerRepeat"]',
repeatOff: '@localizer["AudioPlayerRepeatOff"]',
repeatAll: '@localizer["AudioPlayerRepeatAll"]',
repeatOne: '@localizer["AudioPlayerRepeatOne"]',
queue: '@localizer["AudioPlayerQueue"]'
queue: '@localizer["AudioPlayerQueue"]',
albumArtwork: '@localizer["AudioPlayerAlbumArtwork"]'
}
};
</script>
+221 -70
View File
@@ -1251,9 +1251,9 @@ body {
border-color: #FFFFFF;
}
/* Audio player bar. This is the application fallback styling: the themes own the final look, and the
audio player script owns the state. The 'not-shown' and 'full-height' classes on the container, and
the matching 'audio-player-not-shown' and 'audio-player-full-height' classes on main, are the contract. */
/* Audio player bar. This is the application fallback styling: the themes own the final look and layout, and the
audio player script owns the state. The container carries 'not-shown' and 'expanded'; main carries the matching
'audio-player-not-shown' and 'audio-player-bar-expanded' classes. A theme is free to replace every rule below. */
.audio-player-container {
position: fixed;
left: 0px;
@@ -1262,11 +1262,15 @@ body {
z-index: 997;
display: flex;
flex-direction: column;
/* The bar stays anchored to the bottom of the viewport while the expanded area above it grows and shrinks. */
justify-content: flex-end;
height: 50px;
overflow: hidden;
background-color: #1C1C1C;
border-top: 1px solid #444444;
transition: height 0.4s ease;
/* The expand and collapse duration is one value, so a theme can keep the height, fade and padding transitions in step by overriding this property on the container. */
--audio-player-expanded-duration: 0.4s;
transition: height var(--audio-player-expanded-duration) ease;
}
.audio-player-container.not-shown {
@@ -1274,12 +1278,6 @@ body {
border-top-width: 0px;
}
/* The shuffle scope menu opens above the bar, so the bar lets it overflow while the menu is open. Every other state keeps
the overflow hidden that collapses the bar to its height. */
.audio-player-container.is-menu-open {
overflow: visible;
}
/* The 'hidden' attribute keeps the bar unrendered until the audio player script takes over, so that a page load
never shows it, not even for a frame while the stylesheets settle. The script removes it once the bar is already
in its hidden state, so the removal is never visible. */
@@ -1306,8 +1304,8 @@ html.audio-player-initializing .audio-player-container {
padding-bottom: 0px;
}
.audio-player-container.full-height {
height: calc(100% - 22px); /* full height minus the height of the menu bar */
.audio-player-container.expanded {
height: calc(100% - 22px); /* expanded height, less the height of the menu bar */
}
.audio-player-bar {
@@ -1327,14 +1325,31 @@ html.audio-player-initializing .audio-player-container {
object-fit: cover;
}
.audio-player-track-name {
.audio-player-track-labels {
display: flex;
flex: 1 1 20%;
min-width: 0px;
flex-direction: column;
overflow: hidden;
}
.audio-player-track-name,
.audio-player-album-name {
min-width: 0px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.audio-player-album-name {
font-size: 11px;
color: #9AA7B0;
}
.audio-player-album-name:empty {
display: none;
}
.audio-player-time {
flex: 0 0 auto;
font-size: 12px;
@@ -1418,8 +1433,7 @@ html.audio-player-initializing .audio-player-container {
cursor: grabbing;
}
/* The queue controls hold the shuffle scope menu, the skip controls and the repeat toggle. They sit next to the play
control, so the bar reads as one transport row. */
/* The queue controls hold the skip controls and the repeat toggle. They sit next to the play control, so the bar reads as one transport row. */
.audio-player-queue-controls {
position: relative;
flex: 0 0 auto;
@@ -1476,14 +1490,7 @@ html.audio-player-initializing .audio-player-container {
box-shadow: 3px 0px 0px #E6E6E6;
}
/* The shuffle and repeat glyphs are text, so a theme can replace them with its own imagery while keeping the hooks. */
.audio-player-shuffle-control {
position: relative;
display: flex;
align-items: center;
}
.audio-player-shuffle-icon,
/* The repeat glyph is text, so a theme can replace it with its own imagery while keeping the hook. */
.audio-player-repeat-icon {
display: block;
font-size: 17px;
@@ -1491,7 +1498,6 @@ html.audio-player-initializing .audio-player-container {
color: #E6E6E6;
}
.audio-player-shuffle.is-active .audio-player-shuffle-icon,
.audio-player-repeat.is-active .audio-player-repeat-icon {
color: #6DCBFE;
}
@@ -1514,40 +1520,6 @@ html.audio-player-initializing .audio-player-container {
display: block;
}
/* The shuffle scope menu opens above the control, because the bar is anchored to the bottom of the page. */
.audio-player-shuffle-menu {
position: absolute;
right: 0px;
bottom: calc(100% + 6px);
z-index: 998;
display: flex;
flex-direction: column;
min-width: 150px;
padding: 4px;
background-color: #1C1C1C;
border: 1px solid #444444;
}
.audio-player-shuffle-menu[hidden] {
display: none;
}
.audio-player-shuffle-menu button {
padding: 6px 8px;
background: none;
border: none;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
}
.audio-player-shuffle-menu button:hover,
.audio-player-shuffle-menu button.is-selected {
background-color: #2A2A2A;
color: #6DCBFE;
}
/* The play affordance is a right pointing triangle, and the pause affordance two bars, both drawn with CSS
so that a theme can restyle them without an image. */
.audio-player-play-pause-icon {
@@ -1567,6 +1539,14 @@ html.audio-player-initializing .audio-player-container {
border-left: 3px solid #E6E6E6;
}
/* The stop affordance is a filled square, drawn with CSS so a theme can restyle it without an image. */
.audio-player-stop-icon {
display: block;
width: 10px;
height: 10px;
background-color: #E6E6E6;
}
.audio-player-volume-control {
flex: 0 0 auto;
display: flex;
@@ -1621,35 +1601,183 @@ html.audio-player-initializing .audio-player-container {
}
.audio-player-controls button {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
padding: 0px;
background: none;
border: none;
padding: 0px;
color: inherit;
font: inherit;
cursor: pointer;
}
.audio-player-expanded {
display: none;
flex: 1 1 auto;
min-height: 0px;
gap: 16px;
padding: 16px;
overflow-y: auto;
/* The expand control is a pair of chevrons: they point up while the bar is collapsed, because activating the
control expands the bar, and down while it is expanded, because activating it collapses the bar again. */
.audio-player-expand-icon {
position: relative;
display: block;
width: 12px;
height: 14px;
}
.audio-player-container.full-height .audio-player-expanded {
.audio-player-expand-icon::before,
.audio-player-expand-icon::after {
content: "";
position: absolute;
left: 1px;
width: 8px;
height: 8px;
border-top: 2px solid #E6E6E6;
border-left: 2px solid #E6E6E6;
transform: rotate(45deg);
}
.audio-player-expand-icon::before {
top: 0px;
}
.audio-player-expand-icon::after {
top: 5px;
}
.audio-player-container.expanded .audio-player-expand-icon::before,
.audio-player-container.expanded .audio-player-expand-icon::after {
transform: rotate(225deg);
}
/* Fallback layout only. The expanded area stays in the flex column so the condensed bar remains anchored to the bottom
while this area grows and shrinks above it. A theme can replace this with a vertical bar, a horizontal queue, an
overlay, or any other layout; the player only toggles the state classes. Its vertical padding is zero while collapsed,
because padding cannot shrink with the flex item and would otherwise push the bar out of the viewport during the
fallback collapse transition. */
.audio-player-expanded {
display: flex;
flex: 1 1 auto;
flex-direction: row;
min-height: 0px;
gap: 16px;
padding: 0px 16px;
overflow-y: auto;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition:
opacity var(--audio-player-expanded-duration) ease,
visibility 0s linear var(--audio-player-expanded-duration),
padding-top var(--audio-player-expanded-duration) ease,
padding-bottom var(--audio-player-expanded-duration) ease;
}
.audio-player-container.expanded .audio-player-expanded {
padding-top: 16px;
padding-bottom: 16px;
opacity: 1;
visibility: visible;
pointer-events: auto;
transition-delay: 0s, 0s, 0s, 0s;
}
/* The expanded player presents the current track's cover, labels and stored album artwork in one column beside the queue. */
.audio-player-now-playing {
flex: 0 0 auto;
display: flex;
flex-direction: column;
gap: 8px;
width: 240px;
min-width: 0px;
}
.audio-player-cover-image {
display: block;
flex: 0 0 auto;
width: 240px;
height: 240px;
object-fit: cover;
}
.audio-player-now-playing .audio-player-cover-image {
width: 100%;
}
.audio-player-now-playing-labels {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0px;
}
.audio-player-now-playing-title {
min-width: 0px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
font-weight: 700;
color: #E6E6E6;
}
.audio-player-now-playing-release-line {
display: flex;
flex-wrap: wrap;
gap: 4px;
min-width: 0px;
}
.audio-player-now-playing-release,
.audio-player-now-playing-year,
.audio-player-now-playing-artist {
min-width: 0px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
color: #9AA7B0;
}
.audio-player-now-playing-release-type {
flex: 0 0 auto;
align-self: center;
padding: 1px 5px;
border: 1px solid #555555;
border-radius: 3px;
background-color: #2A2A2A;
color: #E6E6E6;
font-size: 10px;
line-height: 1.3;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.audio-player-now-playing-release-type:empty {
display: none;
}
.audio-player-now-playing-release {
flex: 1 1 auto;
}
.audio-player-now-playing-year {
flex: 0 0 auto;
}
.audio-player-now-playing-release:empty,
.audio-player-now-playing-year:empty,
.audio-player-now-playing-artist:empty {
display: none;
}
.audio-player-artwork-carousel {
max-width: 100%;
margin-top: 2px;
}
.audio-player-artwork-carousel[hidden] {
display: none;
}
.audio-player-queue {
flex: 1 1 auto;
margin: 0px;
@@ -1658,21 +1786,35 @@ html.audio-player-initializing .audio-player-container {
list-style: none;
}
/* A queue item carries its album cover, so a queue built from a whole library shuffle stays readable when consecutive
entries come from different artists and releases. The row is slightly taller than the plain text rows it replaced. */
.audio-player-queue-item {
display: flex;
justify-content: space-between;
gap: 12px;
padding: 6px 8px;
align-items: center;
gap: 10px;
min-height: 52px;
padding: 8px;
box-sizing: border-box;
border-bottom: 1px solid #333333;
cursor: pointer;
}
.audio-player-queue-item-cover {
display: block;
flex: 0 0 auto;
width: 36px;
height: 36px;
object-fit: cover;
background-color: #333333;
}
.audio-player-queue-item.is-played .audio-player-queue-item-title {
color: #8A8A8A;
}
.audio-player-queue-item.is-current .audio-player-queue-item-title {
color: #6DCBFE;
font-weight: 700;
}
.audio-player-queue-item:focus {
@@ -1680,7 +1822,16 @@ html.audio-player-initializing .audio-player-container {
}
.audio-player-queue-item-title {
flex: 1 1 auto;
min-width: 0px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.audio-player-queue-item-duration {
flex: 0 0 auto;
font-size: 12px;
color: #9AA7B0;
font-variant-numeric: tabular-nums;
}
@@ -22,12 +22,23 @@
* small concurrency bound so a prolific artist does not turn into hundreds of sequential requests.
* - Track context (libraryId, trackId):
* The descriptor itself is the only item. A track page does not load the album or the discography around it.
* - Library context (libraryId, without a trackId, albumId or artistId):
* WebRoutes.Music.GET_ARTISTS ("api-get-artists") returns the artists in artist page order. The first artist that has
* tracks starts the queue with its whole discography; the autoplay continuation then moves through the remaining artists in the same order.
* - Shuffle (release, artist or library scope):
* WebRoutes.Music.SHUFFLE_TRACKS ("api-shuffle-tracks") returns a uniformly random batch of tracks of the
* scope, selected by the API database, together with the album, artist and cover data of each track. The request
* carries the tracks the queue already holds, so consecutive batches do not repeat a track.
* - Now playing album details:
* WebRoutes.Music.GET_ALBUM ("api-get-album") returns the metadata and stored artwork of the current track's album,
* which the expanded player shows under its cover. The player requests it only while expanded and caches its small summary per album.
*
* The autoplay continuation at the end of an album or an artist uses the same endpoints:
* The autoplay continuation at the end of an album, an artist or a library uses the same endpoints:
* - After an album, the remaining releases of the artist, in the release order this module applies (primary release
* type group, then release year, title and Id). When those are exhausted, the next artists of the library, in the
* artist order of GET_ARTISTS ("api-get-artists"), one artist at a time, each with all of its releases and tracks.
* - After an artist, the next artists of the library, one at a time.
* - After the first artist of a library context, the next artists of the library, one at a time.
* A continuation batch is never built for a track context or for an explicit queue, and it is dropped as soon as the user
* queues an explicit play next item.
*
@@ -35,11 +46,8 @@
* --------------
* Shuffle is offered per release, per artist and per library. It does not materialize a whole category: it appends a
* batch of {@link SHUFFLE_BATCH_SIZE} randomized tracks and, while the queue approaches the end of that batch, appends
* another batch of the same category. The release and artist scopes only load the lightweight release metadata of the
* category and prefetch the track lists of a small, bounded number of releases in parallel, never the whole category.
* The library scope only loads the lightweight artist metadata and the releases of one artist at a time, so choosing
* shuffle on an entire library never puts every track of the library into the queue and never fetches every track of the
* library at once.
* another batch of the same category. The server selects each batch uniformly at random from every matching track of the
* scope and excludes the tracks the queue already holds, so a shuffle of a large library is not limited to the albums or artists that happen to be loaded first.
*
* Lifetime
* --------
@@ -85,6 +93,7 @@
LuminaAudioPlayer.PlayContextKind = Object.freeze({
ALBUM: 'album',
ARTIST: 'artist',
LIBRARY: 'library',
TRACK: 'track',
QUEUE: 'queue'
});
@@ -105,14 +114,6 @@
*/
const SHUFFLE_LOOKAHEAD = 10;
/**
* The number of release track lists a shuffle batch fetches at the same time. A batch of 100 tracks spans about nine
* releases, so resolving their track lists concurrently removes most of the sequential wait before the batch is ready.
* @readonly
* @type {number}
*/
const SHUFFLE_PREFETCH_CONCURRENCY = 4;
/**
* The number of history entries the queue keeps, so a very long session cannot grow the queue without bound.
* @readonly
@@ -218,23 +219,6 @@
return leftId === rightId ? 0 : (leftId < rightId ? -1 : 1);
}
/**
* Shuffles a copy of a list with the Fisher-Yates algorithm.
* @template T
* @param {Array<T>} items - The items to shuffle.
* @returns {Array<T>} A new, shuffled list; the input is never mutated.
*/
function shuffleCopy(items) {
const result = Array.isArray(items) ? [...items] : [];
for (let index = result.length - 1; index > 0; index--) {
const swapIndex = Math.floor(Math.random() * (index + 1));
const value = result[index];
result[index] = result[swapIndex];
result[swapIndex] = value;
}
return result;
}
/**
* Reads a value from an insertion ordered cache and marks it as the most recently used.
* @param {Map<string, *>} cache - The cache to read.
@@ -354,7 +338,7 @@
// the autoplay continuation.
this.shuffle = false;
this.shuffleScope = LuminaAudioPlayer.QueueShuffleScope.RELEASE;
// The play context the queue was built from: { kind, libraryId, albumId, artistId, title, coverArtPath }.
// The play context the queue was built from: { kind, libraryId, albumId, artistId, title, coverArtPath, coverArtUrl }.
this.context = null;
// True while the autoplay continuation of an album or artist may still append entries.
this.continuationEnabled = false;
@@ -1057,6 +1041,7 @@
* Creates an instance of QueueContextService.
* @param {Object} options - The service options.
* @param {Function} options.fetchJsonAsync - The JSON transport, in the shape of the player's fetchJsonAsync.
* @param {Function} options.postJsonAsync - The JSON POST transport, in the shape of the player's postJsonAsync.
* @param {Function} options.getConfiguration - A function returning the endpoints configuration of the player.
* @param {Function} [options.getShouldIgnoreThePrefix] - A function returning the user's alpha picker prefix preference,
* so the artist order the queue uses matches the order the artist page shows.
@@ -1064,11 +1049,12 @@
constructor(options) {
const settings = options || {};
this.fetchJsonAsync = settings.fetchJsonAsync;
this.postJsonAsync = settings.postJsonAsync;
this.getConfiguration = settings.getConfiguration;
this.getShouldIgnoreThePrefix = settings.getShouldIgnoreThePrefix || (() => false);
// The ordered release list of an artist is reused by the artist context and by the continuation, so a long
// discography does not re-fetch the same ordered list. Both caches are bounded LRUs, because a library shuffle
// can otherwise visit every artist of the library for the whole page lifetime.
// discography does not re-fetch the same ordered list. Both caches are bounded LRUs, because a long session can
// otherwise visit every artist of a library for the whole page lifetime.
this.releaseCache = new Map();
this.artistCache = new Map();
}
@@ -1083,7 +1069,7 @@
}
/**
* Builds the queue of a play descriptor.
* Builds the queue of a play descriptor. A descriptor that names only a library builds the ordered library context, starting with the first artist that has tracks.
* @param {Object} descriptor - The normalized play descriptor.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<{ descriptors: Array<Object>, context: Object, continuationEnabled: boolean }>} The queue.
@@ -1126,7 +1112,9 @@
libraryId: context.libraryId,
artistId: context.artistId,
albumId: context.albumId,
coverArtPath: context.coverArtPath
albumTitle: context.title,
coverArtPath: context.coverArtPath,
coverArtUrl: context.coverArtUrl
});
return { descriptors, context, continuationEnabled: descriptors.length > 0 };
}
@@ -1135,10 +1123,41 @@
this.assertContextIds(context, false);
// An artist context is the whole discography in artist page order. The track lists are fetched with a small
// concurrency bound, so a prolific artist does not turn into hundreds of sequential requests.
const descriptors = await this.fetchArtistDescriptorsAsync(context.artistId, context.libraryId, context.coverArtPath, signal);
const descriptors = await this.fetchArtistDescriptorsAsync(context.artistId, context.libraryId, context.coverArtPath, context.coverArtUrl, signal);
return { descriptors, context, continuationEnabled: descriptors.length > 0 };
}
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The play descriptor identifies no track, album or artist.');
// A descriptor with only a library Id plays the whole library in artist page order. The first artist with
// tracks starts the queue, and the library continuation moves through the remaining artists.
const context = this.createContext(descriptor, LuminaAudioPlayer.PlayContextKind.LIBRARY);
const descriptors = await this.buildLibraryDescriptorsAsync(context, signal);
return { descriptors, context, continuationEnabled: descriptors.length > 0 };
}
/**
* Builds the first ordered batch of a whole library, using the first artist that has tracks. The artist storage
* order is the order of the artist page, so playback continues through the library the same way the page lists it.
* @param {Object} context - The library play context.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Array<Object>>} The play descriptors of the first artist that has tracks.
* @throws {LuminaAudioPlayer.PlayerError} When the session expired or an endpoint failed.
*/
async buildLibraryDescriptorsAsync(context, signal) {
const artists = await this.fetchArtistsAsync(context.libraryId, signal);
for (const artist of artists) {
const artistId = String(artist.id);
const descriptors = await this.fetchArtistDescriptorsAsync(
artistId,
context.libraryId,
artist.coverPath || '',
'',
signal);
if (descriptors.length > 0) {
// The continuation starts after this artist, so the library context remembers where playback began.
context.artistId = artistId;
return descriptors;
}
}
return [];
}
/**
@@ -1164,7 +1183,7 @@
// Empty releases are skipped, never treated as the end of the discography: a partially scanned release must
// not truncate the releases and artists that follow it.
for (const candidate of candidates) {
const descriptors = await this.fetchAlbumDescriptorsAsync(candidate, context.artistId, context.libraryId, context.coverArtPath, signal);
const descriptors = await this.fetchAlbumDescriptorsAsync(candidate, context.artistId, context.libraryId, context.coverArtPath, context.coverArtUrl, signal);
if (descriptors.length > 0)
return { descriptors, isExhausted: false };
}
@@ -1172,7 +1191,8 @@
// The discography of the artist is over, so autoplay continues with the next artist of the library.
return this.buildNextArtistBatchAsync(context, queue, signal);
}
if (context.kind === LuminaAudioPlayer.PlayContextKind.ARTIST)
if (context.kind === LuminaAudioPlayer.PlayContextKind.ARTIST
|| context.kind === LuminaAudioPlayer.PlayContextKind.LIBRARY)
return this.buildNextArtistBatchAsync(context, queue, signal);
return { descriptors: [], isExhausted: true };
}
@@ -1195,7 +1215,12 @@
.slice(currentIndex >= 0 ? currentIndex + 1 : 0)
.filter((artist) => !queue.hasQueuedArtist(artist.id));
for (const artist of candidates) {
const descriptors = await this.fetchArtistDescriptorsAsync(String(artist.id), context.libraryId, artist.coverPath || context.coverArtPath, signal);
const descriptors = await this.fetchArtistDescriptorsAsync(
String(artist.id),
context.libraryId,
artist.coverPath || '',
'',
signal);
if (descriptors.length > 0)
return { descriptors, isExhausted: false };
}
@@ -1203,58 +1228,66 @@
}
/**
* Creates the shuffle source of a scope.
* Creates the shuffle source of a scope. The source requests each batch from the shuffle endpoint, which samples the
* database uniformly at random from every track of the scope and excludes the tracks already queued.
* @param {string} scope - One of the {@link LuminaAudioPlayer.QueueShuffleScope} values.
* @param {AudioQueue} queue - The queue the shuffle replaces.
* @param {Object|null} descriptor - The descriptor that is playing, used to resolve the category when the context is incomplete.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<LuminaAudioPlayer.ShuffleSource>} The shuffle source.
* @throws {LuminaAudioPlayer.PlayerError} When the scope cannot be resolved for this queue.
*/
async createShuffleSourceAsync(scope, queue, descriptor, signal) {
async createShuffleSourceAsync(scope, queue, descriptor) {
const context = queue && queue.context ? queue.context : null;
const libraryId = (context && context.libraryId) || (descriptor && descriptor.libraryId);
const artistId = (descriptor && descriptor.artistId) || (context && context.artistId);
const albumId = (descriptor && descriptor.albumId) || (context && context.albumId);
if (!LuminaAudioPlayer.isGuid(libraryId))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The shuffle scope carries no valid library Id.', { field: 'libraryId' });
if (scope === LuminaAudioPlayer.QueueShuffleScope.RELEASE) {
if (!LuminaAudioPlayer.isGuid(artistId) || !LuminaAudioPlayer.isGuid(albumId))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The release shuffle scope needs an album and its artist.');
const tracks = await this.fetchAlbumTracksAsync(artistId, albumId, libraryId, signal);
return new LuminaAudioPlayer.ShuffleSource({
scope,
albums: [{ id: albumId, artistId, coverPath: (descriptor && descriptor.coverArtPath) || (context && context.coverArtPath) || '' }],
tracksByAlbum: { [albumId]: tracks },
fetchAlbumsAsync: null,
fetchTracksAsync: null,
libraryId
});
}
if (scope === LuminaAudioPlayer.QueueShuffleScope.ARTIST) {
if (!LuminaAudioPlayer.isGuid(artistId))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The artist shuffle scope needs an artist Id.');
const albums = await this.fetchArtistAlbumsAsync(artistId, libraryId, signal);
return new LuminaAudioPlayer.ShuffleSource({
scope,
albums: albums.map((album) => ({ id: String(album.id), artistId, coverPath: album.coverPath || '', title: album.title || '' })),
tracksByAlbum: null,
fetchAlbumsAsync: null,
fetchTracksAsync: (albumArtistId, albumId, albumLibraryId, batchSignal) => this.fetchAlbumTracksAsync(albumArtistId, albumId, albumLibraryId, batchSignal),
libraryId
});
}
if (scope === LuminaAudioPlayer.QueueShuffleScope.LIBRARY)
return new LuminaAudioPlayer.ShuffleSource({
scope,
albums: [],
tracksByAlbum: null,
fetchArtistsAsync: (shuffleLibraryId, batchSignal) => this.fetchArtistsAsync(shuffleLibraryId, batchSignal),
fetchAlbumsAsync: (albumArtistId, albumLibraryId, batchSignal) => this.fetchArtistAlbumsAsync(albumArtistId, albumLibraryId, batchSignal),
fetchTracksAsync: (albumArtistId, albumId, albumLibraryId, batchSignal) => this.fetchAlbumTracksAsync(albumArtistId, albumId, albumLibraryId, batchSignal),
libraryId
});
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The shuffle scope is not known.');
if (scope === LuminaAudioPlayer.QueueShuffleScope.RELEASE && (!LuminaAudioPlayer.isGuid(artistId) || !LuminaAudioPlayer.isGuid(albumId)))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The release shuffle scope needs an album and its artist.');
if (scope === LuminaAudioPlayer.QueueShuffleScope.ARTIST && !LuminaAudioPlayer.isGuid(artistId))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The artist shuffle scope needs an artist Id.');
if (scope !== LuminaAudioPlayer.QueueShuffleScope.RELEASE
&& scope !== LuminaAudioPlayer.QueueShuffleScope.ARTIST
&& scope !== LuminaAudioPlayer.QueueShuffleScope.LIBRARY)
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The shuffle scope is not known.');
const url = this.buildUrl('shuffleTracksUrl', {}, {});
return new LuminaAudioPlayer.ShuffleSource({
// The server picks the random tracks from every matching row of the database, so the browser never has to enumerate the albums and tracks of a library before it can draw a batch.
fetchBatchAsync: async (excludedTrackIds, count, signal) => {
if (typeof this.postJsonAsync !== 'function')
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The shuffle endpoint is not available.');
const request = {
libraryId,
count,
excludedTrackIds: excludedTrackIds instanceof Set ? [...excludedTrackIds] : []
};
if (scope === LuminaAudioPlayer.QueueShuffleScope.RELEASE || scope === LuminaAudioPlayer.QueueShuffleScope.ARTIST)
request.artistId = artistId;
if (scope === LuminaAudioPlayer.QueueShuffleScope.RELEASE)
request.albumId = albumId;
const rows = await this.postJsonAsync(url, request, { signal, label: 'the shuffled tracks' });
if (signal && signal.aborted)
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The request for the shuffled tracks was aborted.');
if (rows === LuminaAudioPlayer.REDIRECTED)
throwSessionExpired();
if (rows === undefined || rows === null)
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The shuffled tracks could not be loaded.');
if (!Array.isArray(rows))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The shuffled tracks response is not a list.');
return rows.map((row) => LuminaAudioPlayer.createPlayDescriptor({
trackId: row.trackId,
albumId: row.albumId,
artistId: row.artistId,
libraryId,
title: row.title || '',
albumTitle: row.albumTitle || '',
durationInSeconds: row.durationInSeconds,
coverArtPath: row.coverPath || ''
})).filter((entry) => entry !== null);
}
});
}
/**
@@ -1270,7 +1303,8 @@
albumId: descriptor.albumId || '',
artistId: descriptor.artistId || '',
title: descriptor.title || '',
coverArtPath: descriptor.coverArtPath || ''
coverArtPath: descriptor.coverArtPath || '',
coverArtUrl: descriptor.coverArtUrl || ''
};
}
@@ -1352,22 +1386,52 @@
return artists;
}
/**
* Fetches the full details of an album, used by the expanded player for its now playing labels and artwork.
* @param {string} artistId - The Id of the artist the album belongs to.
* @param {string} albumId - The Id of the album.
* @param {string} libraryId - The Id of the library.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Object>} The album details, with its metadata and stored artwork.
* @throws {LuminaAudioPlayer.PlayerError} When the album details cannot be loaded.
*/
async fetchAlbumDetailsAsync(artistId, albumId, libraryId, signal) {
if (!LuminaAudioPlayer.isGuid(artistId) || !LuminaAudioPlayer.isGuid(albumId) || !LuminaAudioPlayer.isGuid(libraryId))
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.INVALID_DESCRIPTOR, 'The album details request carries no valid album context.');
const url = this.buildUrl('getAlbumUrl', { artistId, albumId }, { libraryId });
const data = await this.fetchJsonAsync(url, signal, 'the album details');
if (signal && signal.aborted)
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The request for the album details was aborted.');
if (data === LuminaAudioPlayer.REDIRECTED)
throwSessionExpired();
if (data === undefined || data === null || typeof data !== 'object')
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The album details could not be loaded.');
return data;
}
/**
* Fetches every track of an album and turns it into play descriptors.
* @param {Object} album - The release row.
* @param {string} artistId - The Id of the artist.
* @param {string} libraryId - The Id of the library.
* @param {string} fallbackCoverPath - The cover to use when the release has none.
* @param {string} fallbackCoverPath - The cover path to use when the release has none.
* @param {string} [fallbackCoverUrl] - The resolved cover URL to use when the release has neither a cover path nor a fallback path.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Array<Object>>} The play descriptors of the release.
*/
async fetchAlbumDescriptorsAsync(album, artistId, libraryId, fallbackCoverPath, signal) {
async fetchAlbumDescriptorsAsync(album, artistId, libraryId, fallbackCoverPath, fallbackCoverUrl, signal) {
const tracks = await this.fetchAlbumTracksAsync(artistId, String(album.id), libraryId, signal);
const coverArtPath = album.coverPath || fallbackCoverPath || '';
// A release with its own stored cover path keeps that cover. The fallback URL is only a stand-in for a scope,
// such as an artist image, and must not replace the cover of a release that has one.
const coverArtUrl = album.coverPath ? '' : (fallbackCoverUrl || '');
return this.createTrackDescriptors(tracks, {
libraryId,
artistId,
albumId: String(album.id),
coverArtPath: album.coverPath || fallbackCoverPath || ''
albumTitle: album.title || '',
coverArtPath,
coverArtUrl
});
}
@@ -1377,16 +1441,17 @@
* and Id.
* @param {string} artistId - The Id of the artist.
* @param {string} libraryId - The Id of the library.
* @param {string} fallbackCoverPath - The cover to use when a release has none.
* @param {string} fallbackCoverPath - The cover path to use when a release has none.
* @param {string} [fallbackCoverUrl] - The resolved cover URL to use when a release has neither a cover path nor a fallback path.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Array<Object>>} The play descriptors of the artist.
*/
async fetchArtistDescriptorsAsync(artistId, libraryId, fallbackCoverPath, signal) {
async fetchArtistDescriptorsAsync(artistId, libraryId, fallbackCoverPath, fallbackCoverUrl, signal) {
const albums = await this.fetchArtistAlbumsAsync(artistId, libraryId, signal);
// The releases are fetched with a small concurrency bound, so a prolific artist does not produce hundreds of
// sequential requests, while the API is not flooded with one request per release either.
const perAlbum = await mapWithConcurrencyAsync(albums, ALBUM_FETCH_CONCURRENCY, (album) =>
this.fetchAlbumDescriptorsAsync(album, artistId, libraryId, fallbackCoverPath, signal));
this.fetchAlbumDescriptorsAsync(album, artistId, libraryId, fallbackCoverPath, fallbackCoverUrl, signal));
return perAlbum.flat();
}
@@ -1408,8 +1473,10 @@
artistId: album.artistId,
libraryId: album.libraryId,
title: track.title || '',
albumTitle: album.albumTitle || '',
durationInSeconds: track.durationInSeconds,
coverArtPath: album.coverArtPath || ''
coverArtPath: album.coverArtPath || '',
coverArtUrl: album.coverArtUrl || ''
});
if (descriptor)
descriptors.push(descriptor);
@@ -1503,38 +1570,19 @@
/**
* Draws randomized tracks of one shuffle scope, one batch at a time.
*
* The source keeps the tracks of a release it has not queued yet in a pool, so a batch never repeats a queued track and
* a release that straddles two batches is not fetched twice. The artist and library scopes only fetch the lightweight
* release metadata up front, or discover the releases of one artist at a time, and prefetch the track lists of a bounded
* number of releases in parallel, which is what keeps a library shuffle from loading every track of the library.
* The tracks are selected by the server from every matching row of the database, so each batch is a uniform random
* sample across the whole library, artist or album, no matter how the tracks are grouped into albums. The source only
* remembers whether the previous batch exhausted the scope.
*/
class ShuffleSource {
/**
* Creates an instance of ShuffleSource.
* @param {Object} options - The source options.
* @param {string} options.scope - One of the {@link LuminaAudioPlayer.QueueShuffleScope} values.
* @param {Array<Object>} options.albums - The releases the scope draws from, already known when the scope is a release or an artist.
* @param {Object|null} options.tracksByAlbum - The track rows of a release, keyed by album Id, when they are already known.
* @param {Function|null} options.fetchArtistsAsync - The function that fetches the artists of the library, used by the library scope.
* @param {Function|null} options.fetchAlbumsAsync - The function that fetches the releases of an artist, used by the library scope.
* @param {Function|null} options.fetchTracksAsync - The function that fetches the tracks of a release.
* @param {string} options.libraryId - The Id of the library.
* @param {Function} options.fetchBatchAsync - The function that requests a random batch, in the shape <c>(excludedTrackIds, count, signal)</c>.
*/
constructor(options) {
const settings = options || {};
this.scope = settings.scope;
this.libraryId = settings.libraryId;
this.albumQueue = shuffleCopy(settings.albums || []);
this.loadedAlbums = settings.tracksByAlbum ? { ...settings.tracksByAlbum } : {};
this.trackPools = new Map();
// The release pools that were already fetched and are not drawn empty yet, so a batch that stops mid-release keeps
// the remaining tracks ready for the next batch.
this.readyPools = [];
this.fetchArtistsAsync = settings.fetchArtistsAsync || null;
this.fetchAlbumsAsync = settings.fetchAlbumsAsync || null;
this.fetchTracksAsync = settings.fetchTracksAsync || null;
// The library scope discovers artists lazily, and never holds more than one artist's releases at a time.
this.artistQueue = null;
this.fetchBatchAsync = settings.fetchBatchAsync;
this.isExhausted = false;
}
@@ -1546,168 +1594,16 @@
* @returns {Promise<Array<Object>>} The descriptors of the batch, never longer than the count.
*/
async nextBatchAsync(excludedTrackIds, count = SHUFFLE_BATCH_SIZE, signal) {
const excluded = excludedTrackIds instanceof Set ? excludedTrackIds : new Set();
const batch = [];
if (this.isExhausted)
return batch;
while (batch.length < count) {
await this.ensureReadyPoolsAsync(signal);
if (this.readyPools.length === 0) {
this.isExhausted = true;
break;
}
const ready = this.readyPools.shift();
const pool = ready.pool;
while (pool.length > 0 && batch.length < count) {
const descriptor = pool.pop();
const identity = getTrackIdentity(descriptor);
if (!identity || excluded.has(identity))
continue;
excluded.add(identity);
batch.push(descriptor);
}
// A release that straddled the batch keeps its remaining tracks ready, so the next batch finishes it instead
// of leaving those tracks unreachable.
if (pool.length > 0) {
this.readyPools.push(ready);
// The other ready releases are still offered before the batch ends, but a release that is only half drawn
// must not starve them when the next batch starts.
if (this.readyPools.length > 1)
this.readyPools.push(this.readyPools.shift());
} else {
// A drained release is never drawn again, so its pool does not stay in the per release map for the rest
// of the shuffle session.
this.trackPools.delete(String(ready.album.id));
}
}
return batch;
}
/**
* Fills the ready release pools, fetching the track lists of several releases at the same time. The batch filler then
* draws from the ready pools, so filling 100 tracks does not wait for one release track list at a time.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<void>} A promise that completes when at least one pool is ready, or the category is exhausted.
*/
async ensureReadyPoolsAsync(signal) {
if (this.readyPools.length > 0 || this.isExhausted)
return;
const albums = [];
while (albums.length < SHUFFLE_PREFETCH_CONCURRENCY) {
let album = this.albumQueue.shift();
if (!album) {
album = await this.loadNextAlbumAsync(signal);
if (!album)
break;
}
albums.push(album);
}
if (albums.length === 0) {
return [];
if (typeof this.fetchBatchAsync !== 'function')
throw new LuminaAudioPlayer.PlayerError(LuminaAudioPlayer.PlayerErrorCode.QUEUE_LOAD_FAILED, 'The shuffle source has no endpoint.');
const batch = await this.fetchBatchAsync(excludedTrackIds instanceof Set ? excludedTrackIds : new Set(), count, signal);
const result = Array.isArray(batch) ? batch : [];
// A short batch means the server ran out of tracks that are not already queued, so the scope is exhausted.
if (result.length < count)
this.isExhausted = true;
return;
}
const results = await Promise.allSettled(albums.map((album) => this.getTrackPoolAsync(album, signal)));
const readyPools = [];
const failedAlbums = [];
for (let index = 0; index < results.length; index++) {
if (results[index].status === 'fulfilled')
readyPools.push({ album: albums[index], pool: results[index].value });
else
failedAlbums.push(albums[index]);
}
const isAborted = signal && signal.aborted;
const failure = results.find((result) => result.status === 'rejected');
// A batch that was aborted while its prefetches were settling belongs to a shuffle that is already gone. It is
// reported as the same abort the caller expects, so no partial pool of it is drawn.
if (isAborted)
throw failure ? failure.reason : new Error('The shuffle prefetch was aborted.');
// A release whose track list failed is put back into the queue instead of being lost for the rest of the shuffle.
if (failedAlbums.length > 0)
this.albumQueue.push(...failedAlbums);
if (readyPools.length === 0) {
if (failure)
throw failure.reason;
this.isExhausted = true;
return;
}
this.readyPools = readyPools;
}
/**
* Loads the next release of the category.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Object|null>} The release, or null when the category has no more releases.
*/
async loadNextAlbumAsync(signal) {
if (this.scope !== LuminaAudioPlayer.QueueShuffleScope.LIBRARY)
return null;
while (true) {
// The releases of the current artist come first, and the next artist is only discovered when those are
// exhausted, so one artist's releases are never mixed with a second fetch of the artist list.
const album = this.albumQueue.shift();
if (album)
return album;
const artist = await this.loadNextArtistAsync(signal);
if (!artist)
return null;
const albums = typeof this.fetchAlbumsAsync === 'function'
? await this.fetchAlbumsAsync(String(artist.id), this.libraryId, signal)
: [];
this.albumQueue = shuffleCopy(albums.map((albumRow) => ({
id: String(albumRow.id),
artistId: String(artist.id),
coverPath: albumRow.coverPath || '',
title: albumRow.title || ''
})));
}
}
/**
* Loads the next artist of the library, one at a time, so the library is never enumerated as a whole set of tracks.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Object|null>} The artist, or null when the library has no more artists.
*/
async loadNextArtistAsync(signal) {
if (this.scope !== LuminaAudioPlayer.QueueShuffleScope.LIBRARY || typeof this.fetchArtistsAsync !== 'function')
return null;
if (this.artistQueue === null) {
const artists = await this.fetchArtistsAsync(this.libraryId, signal);
this.artistQueue = shuffleCopy(artists.map((artist) => ({ id: String(artist.id), coverPath: artist.coverPath || '' })));
}
return this.artistQueue.length > 0 ? this.artistQueue.shift() : null;
}
/**
* Gets the randomized pool of the tracks of a release that the queue has not drawn yet.
* @param {Object} album - The release.
* @param {AbortSignal} [signal] - The signal that cancels the request when the player supersedes or stops it.
* @returns {Promise<Array<Object>>} The remaining descriptors of the release.
*/
async getTrackPoolAsync(album, signal) {
const albumId = String(album.id);
if (this.trackPools.has(albumId))
return this.trackPools.get(albumId);
let tracks = this.loadedAlbums[albumId];
// The raw rows are released as soon as they are turned into descriptors, so a long library shuffle keeps only the
// remaining pool of the releases it has open, not every row it has already fetched.
if (tracks)
delete this.loadedAlbums[albumId];
if (!tracks && typeof this.fetchTracksAsync === 'function')
tracks = await this.fetchTracksAsync(album.artistId, albumId, this.libraryId, signal);
const descriptors = Array.isArray(tracks)
? tracks.map((track) => LuminaAudioPlayer.createPlayDescriptor({
trackId: track.id,
albumId,
artistId: album.artistId,
libraryId: this.libraryId,
title: track.title || '',
durationInSeconds: track.durationInSeconds,
coverArtPath: album.coverPath || ''
})).filter((descriptor) => descriptor !== null)
: [];
const pool = shuffleCopy(descriptors);
this.trackPools.set(albumId, pool);
return pool;
return result;
}
}
File diff suppressed because it is too large. Load diff
+7 -24
View File
@@ -4,8 +4,7 @@ const progressIndicator = document.getElementById('progress-indicator');
const progressIndicatorValue = document.getElementById('progress-indicator-value');
const progressIndicatorValueShadow = document.getElementById('progress-indicator-value-shadow');
const progressIndicatorValueText = document.getElementById('progress-indicator-value-text');
const audioPlayerFullHeightToggle = document.getElementById('audio-player-full-height-toggle');
const audioPlayerClose = document.getElementById('audio-player-close');
const audioPlayerExpandToggle = document.getElementById('audio-player-expand-toggle');
let enableConsoleDebugMessages = false; // whether to display debug messages at the developer console, or not
@@ -648,32 +647,16 @@ function getElementOffset(id) {
}
/**
* Closes the audio player, by routing to the audio player that owns the bar.
*
* The player bar is the single owner of its own classes, its state and its visibility, so this control, and the full
* height control below, only route to it. The two controls exist only when the bar is rendered, which is only for an
* authenticated visitor, for whom the audio player is always created, so there is no separate no-player fallback to
* keep in sync with the player.
* Expands the audio player, or collapses it back, by routing to the audio player that owns the bar.
*/
function toggleAudioPlayerVisibility() {
function toggleAudioPlayerExpanded() {
const player = window.LuminaAudioPlayer && window.LuminaAudioPlayer.instance;
if (player && typeof player.stopAsync === 'function')
player.stopAsync();
if (player && typeof player.toggleExpanded === 'function')
player.toggleExpanded();
}
/**
* Expands the audio player into its full height form, or collapses it back, by routing to the audio player that owns the bar.
*/
function toggleAudioPlayerFullHeight() {
const player = window.LuminaAudioPlayer && window.LuminaAudioPlayer.instance;
if (player && typeof player.toggleFullHeight === 'function')
player.toggleFullHeight();
}
if (audioPlayerFullHeightToggle)
audioPlayerFullHeightToggle.addEventListener('click', toggleAudioPlayerFullHeight);
if (audioPlayerClose)
audioPlayerClose.addEventListener('click', toggleAudioPlayerVisibility);
if (audioPlayerExpandToggle)
audioPlayerExpandToggle.addEventListener('click', toggleAudioPlayerExpanded);
/**