Captures the audio container of the music tracks

Adds a Container to the audio metadata, captured with TagLibSharp from the concrete type of the parsed file during the music library scan and stored on the track through a new column and an EF migration. The container is refreshed when a file changes, survives track and artist edits and provider enrichment, and is exposed read-only in the track responses, never settable through a request.

Extracts the container resolution into a testable resolver used by the scan pipeline and the ID3 plugin, refuses to read a file that is itself a reparse point during extraction, and updates the endpoint summaries, the API and domain documentation, and the tests.
This commit is contained in:
BinaryAlley committed 2026-10-14 13:40:28 +03:00
1 parent 4ffa81fffe
commit f29f89f31f
60 files changed
+4483 -68

No files matched your search

@@ -56,6 +56,7 @@ public class Id3TrackMetadataProviderTests : IDisposable
Assert.Equal("The Track", result.Title);
Assert.Equal(MusicKey.CSharpMinor, result.Key);
Assert.Equal(128, result.Bpm);
Assert.Equal("WAV", result.Container);
Assert.NotNull(result.Contributors);
Assert.Contains(result.Contributors, contributor => contributor.Name!.DisplayName == "The Artist");
}
@@ -15,6 +15,11 @@ namespace Lumina.Plugins.ID3.IntegrationTests.Core.Tags;
[ExcludeFromCodeCoverage]
public class Id3TagReaderTests : IDisposable
{
/// <summary>
/// A minimal, valid, one by one pixel PNG image, used to exercise a container that has no dedicated parser.
/// </summary>
private const string PNG_BYTES = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAANSURBVBhXY2BgYGAAAAAFAAGKM+MAAAAAAElFTkSuQmCC";
private readonly Id3TagReader _sut = new();
private readonly string _temporaryDirectory;
@@ -131,6 +136,7 @@ public class Id3TagReaderTests : IDisposable
Assert.Equal(16, result.BitDepth);
Assert.True(result.Bitrate > 0);
Assert.Equal("PCM Audio", result.AudioCodec);
Assert.Equal("WAV", result.Container);
Assert.Equal("https://artist.example", result.Website);
Assert.Equal(artistId.ToString(), result.MusicBrainzArtistId);
Assert.Equal(releaseArtistId.ToString(), result.MusicBrainzReleaseArtistId);
@@ -192,6 +198,7 @@ public class Id3TagReaderTests : IDisposable
Assert.Equal(1, result.Channels);
Assert.Equal(16, result.BitDepth);
Assert.Equal("PCM Audio", result.AudioCodec);
Assert.Equal("WAV", result.Container);
Assert.Null(result.Website);
Assert.Null(result.MusicBrainzArtistId);
Assert.Null(result.MusicBrainzReleaseArtistId);
@@ -216,6 +223,21 @@ public class Id3TagReaderTests : IDisposable
Assert.Null(result);
}
[Fact]
public void Read_WhenTheContainerHasNoDedicatedParser_ShouldFallBackToTheMimeTypeName()
{
// Arrange
string path = Path.Combine(_temporaryDirectory, "cover.png");
File.WriteAllBytes(path, Convert.FromBase64String(PNG_BYTES));
// Act
Id3TagDto? result = _sut.Read(path);
// Assert
Assert.NotNull(result);
Assert.Equal("PNG", result.Container);
}
[Fact]
public void Read_WhenCalledTwiceForTheSamePath_ShouldReturnTheCachedSnapshot()
{