Extends the music library listings with covers, sorting and alpha filtering.

This commit is contained in:
BinaryAlley committed 2026-10-13 13:26:14 +03:00
1 parent 0019821e87
commit 9d82f283e4
69 files changed
+3613 -268

No files matched your search

@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
@@ -23,4 +25,19 @@ public sealed record AlbumLiteRow
/// Gets the number of tracks of the release.
/// </summary>
public int TotalTracks { get; init; }
/// <summary>
/// Gets the path of the image representing the album, if available.
/// </summary>
public string? CoverPath { get; init; }
/// <summary>
/// Gets the release year of the album (the re-release year, if available, or the original release year), if known.
/// </summary>
public int? ReleaseYear { get; init; }
/// <summary>
/// Gets the set of types of the release.
/// </summary>
public List<MusicReleaseType>? ReleaseTypes { get; init; }
}
@@ -18,4 +18,9 @@ public sealed record ArtistLiteRow
/// Gets the name of the artist.
/// </summary>
public required string Name { get; init; }
/// <summary>
/// Gets the path of the image representing the artist, if available.
/// </summary>
public string? CoverPath { get; init; }
}
@@ -28,4 +28,9 @@ public sealed record TrackLiteRow
/// Gets the number of the disc the track belongs to, if applicable.
/// </summary>
public int? DiscNumber { get; init; }
/// <summary>
/// Gets the duration of the track in seconds.
/// </summary>
public int DurationInSeconds { get; init; }
}
@@ -157,8 +157,10 @@ public static class AlbumEntityMapping
/// Converts <paramref name="repositoryEntity"/> to <see cref="AlbumResponse"/>.
/// </summary>
/// <param name="repositoryEntity">The repository entity to be converted.</param>
/// <param name="coverPath">The optional path of the image representing the album.</param>
/// <param name="artwork">The optional stored artwork of the album, in display order.</param>
/// <returns>The converted response entity.</returns>
public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity)
public static AlbumResponse ToResponse(this AlbumEntity repositoryEntity, string? coverPath = null, IReadOnlyList<MediaArtworkDto>? artwork = null)
{
ReleaseInfoDto releaseInfo = new(
repositoryEntity.OriginalReleaseDate,
@@ -220,7 +222,9 @@ public static class AlbumEntityMapping
repositoryEntity.UpdatedOnUtc,
[.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))],
[.. repositoryEntity.Ratings.ToResponses()],
[.. repositoryEntity.Tracks.Select(track => track.ToResponse())]);
[.. repositoryEntity.Tracks.Select(track => track.ToResponse())],
coverPath,
artwork ?? []);
}
/// <summary>
@@ -24,7 +24,10 @@ public static class AlbumLiteRowMapping
return new AlbumLiteResponse(
readModel.Id,
readModel.Title,
readModel.TotalTracks);
readModel.TotalTracks,
readModel.CoverPath,
readModel.ReleaseYear,
readModel.ReleaseTypes);
}
/// <summary>
@@ -147,8 +147,9 @@ public static class ArtistEntityMapping
/// Converts <paramref name="repositoryEntity"/> to <see cref="ArtistResponse"/>.
/// </summary>
/// <param name="repositoryEntity">The repository entity to be converted.</param>
/// <param name="coverPath">The optional path of the image representing the artist.</param>
/// <returns>The converted response entity.</returns>
public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity)
public static ArtistResponse ToResponse(this ArtistEntity repositoryEntity, string? coverPath = null)
{
MusicArtistMetadataDto metadata = new(
repositoryEntity.Name,
@@ -178,7 +179,8 @@ public static class ArtistEntityMapping
repositoryEntity.UpdatedOnUtc,
[.. repositoryEntity.Contributors.Select(contributor => new MediaContributorReferenceDto(contributor.MediaContributorId, contributor.Role))],
[.. repositoryEntity.Ratings.ToResponses()],
[.. repositoryEntity.Albums.Select(album => album.ToResponse())]);
[.. repositoryEntity.Albums.Select(album => album.ToResponse())],
coverPath);
}
/// <summary>
@@ -23,7 +23,8 @@ public static class ArtistLiteRowMapping
{
return new ArtistLiteResponse(
readModel.Id,
readModel.Name);
readModel.Name,
readModel.CoverPath);
}
/// <summary>
@@ -30,6 +30,10 @@ public static class GetArtistsLiteRequestMapping
return new GetArtistsLiteQuery(
libraryId,
paginationData,
request.SearchTerm);
request.SearchTerm,
request.FilterAlphaKey,
request.ShouldIgnoreThePrefixForAlphaPicker,
request.SortBy,
request.SortOrder);
}
}
@@ -25,7 +25,8 @@ public static class TrackLiteRowMapping
readModel.Id,
readModel.Title,
readModel.TrackNumber,
readModel.DiscNumber);
readModel.DiscNumber,
readModel.DurationInSeconds);
}
/// <summary>