Adds the playback manifest endpoint

This commit is contained in:
BinaryAlley committed 2026-10-15 14:58:57 +03:00
1 parent 7dc5953e1d
commit d7c1ae60c2
17 files changed
+993 -10

No files matched your search

@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
/// <summary>
/// Data transfer object for the stored probe result of a track, containing only the fields a playback manifest is built from.
/// </summary>
[DebuggerDisplay("Container: {Container} Codec: {AudioCodec}")]
public sealed record TrackPlaybackManifestDto
{
/// <summary>
/// Gets the container of the audio file of the track, for example MP3, FLAC, OGG, AAC, MP4 or WAV, if applicable.
/// </summary>
public string? Container { get; init; }
/// <summary>
/// Gets the audio codec used by the audio file of the track, if applicable.
/// </summary>
public string? AudioCodec { get; init; }
/// <summary>
/// Gets the duration of the audio of the track in seconds.
/// </summary>
public int DurationInSeconds { get; init; }
/// <summary>
/// Gets the sample rate of the audio of the track in Hz.
/// </summary>
public int SampleRate { get; init; }
/// <summary>
/// Gets the number of audio channels of the track.
/// </summary>
public int Channels { get; init; }
/// <summary>
/// Gets the bit depth of the audio of the track, if applicable.
/// </summary>
public int? BitDepth { get; init; }
/// <summary>
/// Gets the ReplayGain track gain of the track, in decibels, if applicable.
/// </summary>
public decimal? ReplayGainTrackGain { get; init; }
/// <summary>
/// Gets the ReplayGain track peak of the track, if applicable.
/// </summary>
public decimal? ReplayGainTrackPeak { get; init; }
/// <summary>
/// Gets the ReplayGain album gain of the track, in decibels, if applicable.
/// </summary>
public decimal? ReplayGainAlbumGain { get; init; }
/// <summary>
/// Gets the ReplayGain album peak of the track, if applicable.
/// </summary>
public decimal? ReplayGainAlbumPeak { get; init; }
}
@@ -74,6 +74,22 @@ public interface ITrackRepository : IRepository<TrackEntity>,
/// </returns>
Task<Result<TrackStreamDto?>> GetTrackStreamInfoAsync(Guid libraryId, Guid albumId, Guid artistId, Guid trackId, CancellationToken cancellationToken);
/// <summary>
/// Gets the stored probe result needed to build the playback manifest of the track identified by <paramref name="trackId"/>, when it belongs to
/// the album identified by <paramref name="albumId"/> and to the media library identified by <paramref name="libraryId"/>, and that album belongs
/// to the artist identified by <paramref name="artistId"/>.
/// </summary>
/// <param name="libraryId">The Id of the media library the track must belong to.</param>
/// <param name="albumId">The Id of the album the track must belong to.</param>
/// <param name="artistId">The Id of the artist that must own the album the track belongs to.</param>
/// <param name="trackId">The Id of the track whose playback manifest data is retrieved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either the <see cref="TrackPlaybackManifestDto"/> of the track, <see langword="null"/> when no track
/// matches the provided identifiers, or an error.
/// </returns>
Task<Result<TrackPlaybackManifestDto?>> GetPlaybackManifestInfoAsync(Guid libraryId, Guid albumId, Guid artistId, Guid trackId, CancellationToken cancellationToken);
/// <summary>
/// Resets the enrichment state of the tracks stored at the provided <paramref name="paths"/> in the media library identified by
/// <paramref name="libraryId"/>, together with their albums and artists, so that they are re-enriched, because their content changed since the last scan.