mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 14:11:10 +00:00
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:
1 parent
93821a2776
commit
067e9a21d0
132 files changed
+2935
-715
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Read model of a track returned by a randomized shuffle query, carrying everything the client needs to queue and play it.
|
||||
/// </summary>
|
||||
public sealed record ShuffleTrackRowDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the Id of the track.
|
||||
/// </summary>
|
||||
public required Guid TrackId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title of the track.
|
||||
/// </summary>
|
||||
public required string Title { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the track in seconds.
|
||||
/// </summary>
|
||||
public int DurationInSeconds { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the album the track belongs to.
|
||||
/// </summary>
|
||||
public required Guid AlbumId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the title of the album the track belongs to.
|
||||
/// </summary>
|
||||
public required string AlbumTitle { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Id of the artist the album belongs to.
|
||||
/// </summary>
|
||||
public required Guid ArtistId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path of the cover of the album, if available.
|
||||
/// </summary>
|
||||
public string? CoverPath { get; init; }
|
||||
}
|
||||
+13
@@ -49,6 +49,19 @@ public interface ITrackRepository : IRepository<TrackEntity>,
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a paginated result of <see cref="TrackLiteRow"/>, or an error.</returns>
|
||||
Task<Result<PaginatedResultDto<TrackLiteRow>>> GetTracksLiteByAlbumIdAsync(Guid albumId, PaginationDataDto? paginationData, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a uniformly random selection of tracks of the library identified by <paramref name="libraryId"/>, optionally scoped to
|
||||
/// an artist or an album, excluding the tracks in <paramref name="excludedTrackIds"/>.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The Id of the library whose tracks are sampled.</param>
|
||||
/// <param name="artistId">The Id of the artist whose tracks are sampled, or <see langword="null"/> for every artist of the library.</param>
|
||||
/// <param name="albumId">The Id of the album whose tracks are sampled, or <see langword="null"/> for every album of the scope.</param>
|
||||
/// <param name="excludedTrackIds">The tracks that must not be returned.</param>
|
||||
/// <param name="count">The maximum number of tracks to return.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>An <see cref="Result{TValue}"/> containing either a collection of <see cref="ShuffleTrackRowDto"/>, or an error.</returns>
|
||||
Task<Result<IReadOnlyList<ShuffleTrackRowDto>>> GetShuffleTracksLiteAsync(Guid libraryId, Guid? artistId, Guid? albumId, IReadOnlyCollection<Guid> excludedTrackIds, int count, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the track of the library identified by <paramref name="libraryId"/> that is stored at the provided <paramref name="path"/>.
|
||||
/// </summary>
|
||||
|
||||
+2
-1
@@ -170,7 +170,7 @@ public static class AlbumEntityMapping
|
||||
repositoryEntity.ReleaseCountry,
|
||||
repositoryEntity.ReleaseVersion
|
||||
);
|
||||
// language and original language make sense only if their subproperties have values
|
||||
// Language and original language make sense only if their subproperties have values.
|
||||
LanguageInfoDto? languageInfo = !string.IsNullOrWhiteSpace(repositoryEntity.LanguageCode) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageName) ||
|
||||
!string.IsNullOrWhiteSpace(repositoryEntity.LanguageNativeName)
|
||||
@@ -207,6 +207,7 @@ public static class AlbumEntityMapping
|
||||
return new AlbumResponse(
|
||||
repositoryEntity.Id,
|
||||
repositoryEntity.ArtistId,
|
||||
repositoryEntity.Artist?.Name ?? string.Empty,
|
||||
repositoryEntity.LibraryId,
|
||||
metadata,
|
||||
repositoryEntity.MediaFormat,
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="ShuffleTrackRowDto"/>.
|
||||
/// </summary>
|
||||
public static class ShuffleTrackRowDtoMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="readModel"/> to <see cref="ShuffleTrackResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="readModel">The read model to be converted.</param>
|
||||
/// <returns>The converted response.</returns>
|
||||
public static ShuffleTrackResponse ToResponse(this ShuffleTrackRowDto readModel)
|
||||
{
|
||||
return new ShuffleTrackResponse(
|
||||
readModel.TrackId,
|
||||
readModel.Title,
|
||||
readModel.DurationInSeconds,
|
||||
readModel.AlbumId,
|
||||
readModel.AlbumTitle,
|
||||
readModel.ArtistId,
|
||||
readModel.CoverPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts <paramref name="readModels"/> to a collection of <see cref="ShuffleTrackResponse"/>.
|
||||
/// </summary>
|
||||
/// <param name="readModels">The read models to be converted.</param>
|
||||
/// <returns>The converted responses.</returns>
|
||||
public static IReadOnlyList<ShuffleTrackResponse> ToResponses(this IEnumerable<ShuffleTrackRowDto> readModels)
|
||||
{
|
||||
return [.. readModels.Select(readModel => readModel.ToResponse())];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Queries.ShuffleTracks;
|
||||
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="ShuffleTracksRequest"/>.
|
||||
/// </summary>
|
||||
public static class ShuffleTracksRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="ShuffleTracksQuery"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <param name="libraryId">The Id of the library the tracks are sampled from, taken from the route.</param>
|
||||
/// <returns>The converted query.</returns>
|
||||
public static ShuffleTracksQuery ToQuery(this ShuffleTracksRequest request, string? libraryId)
|
||||
{
|
||||
return new ShuffleTracksQuery(
|
||||
libraryId,
|
||||
request.Count,
|
||||
request.ArtistId,
|
||||
request.AlbumId,
|
||||
request.ExcludedTrackIds);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user