mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09:11:10 +00:00
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:
1 parent
4ffa81fffe
commit
f29f89f31f
60 files changed
+4483
-68
No files matched your search
+4
-1
@@ -39,6 +39,7 @@ public class MusicLibraryScanItemMetadataEntityFixture
|
||||
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
|
||||
/// <param name="workTitle">Optional. The title of the work.</param>
|
||||
/// <param name="includeMusicBrainzTags">Whether the MusicBrainz identifiers and the work title should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContainer">Whether the container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="MusicLibraryScanItemMetadataEntity"/>.</returns>
|
||||
public MusicLibraryScanItemMetadataEntity Create(
|
||||
Guid? id = null,
|
||||
@@ -58,7 +59,8 @@ public class MusicLibraryScanItemMetadataEntityFixture
|
||||
Guid? musicBrainzTrackId = null,
|
||||
Guid? musicBrainzWorkId = null,
|
||||
string? workTitle = null,
|
||||
bool includeMusicBrainzTags = true)
|
||||
bool includeMusicBrainzTags = true,
|
||||
bool includeContainer = true)
|
||||
{
|
||||
return new MusicLibraryScanItemMetadataEntity
|
||||
{
|
||||
@@ -78,6 +80,7 @@ public class MusicLibraryScanItemMetadataEntityFixture
|
||||
Channels = _faker.PickRandom(1, 2, 6),
|
||||
BitDepth = Random.Shared.Next(8, 32),
|
||||
AudioCodec = _faker.PickRandom("FLAC", "MP3", "AAC", "ALAC"),
|
||||
Container = includeContainer ? _faker.PickRandom("FLAC", "MP3", "OGG", "MP4", "AAC", "WAV") : null,
|
||||
Bitrate = Random.Shared.Next(96, 1411),
|
||||
MusicBrainzArtistId = includeMusicBrainzTags ? musicBrainzArtistId ?? Guid.NewGuid() : null,
|
||||
MusicBrainzReleaseArtistId = includeMusicBrainzTags ? musicBrainzReleaseArtistId ?? Guid.NewGuid() : null,
|
||||
|
||||
+5
@@ -37,6 +37,7 @@ public class TrackEntityFixture
|
||||
/// <param name="libraryId">Optional. The Id of the media library that owns the track.</param>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="title">Optional. The title of the track.</param>
|
||||
/// <param name="container">Optional. The container of the audio file of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="originalReleaseDate">Optional. The original release date of the track.</param>
|
||||
/// <param name="originalReleaseYear">Optional. The original release year of the track.</param>
|
||||
@@ -47,6 +48,7 @@ public class TrackEntityFixture
|
||||
/// <param name="includeOriginalReleaseYear">Whether the original release year should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReReleaseDate">Whether the re-release date should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeReReleaseYear">Whether the re-release year should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContainer">Whether the container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="metadataStatus">Optional. The metadata enrichment status of the track.</param>
|
||||
/// <returns>The created <see cref="TrackEntity"/>.</returns>
|
||||
public TrackEntity Create(
|
||||
@@ -55,6 +57,7 @@ public class TrackEntityFixture
|
||||
Guid? libraryId = null,
|
||||
string? path = null,
|
||||
string? title = null,
|
||||
string? container = null,
|
||||
int? trackNumber = null,
|
||||
DateOnly? originalReleaseDate = null,
|
||||
int? originalReleaseYear = null,
|
||||
@@ -65,6 +68,7 @@ public class TrackEntityFixture
|
||||
bool includeOriginalReleaseYear = true,
|
||||
bool includeReReleaseDate = true,
|
||||
bool includeReReleaseYear = true,
|
||||
bool includeContainer = true,
|
||||
MetadataStatus? metadataStatus = null)
|
||||
{
|
||||
Guid resolvedId = id ?? Guid.NewGuid();
|
||||
@@ -111,6 +115,7 @@ public class TrackEntityFixture
|
||||
.RuleFor(x => x.Channels, f => f.PickRandom(1, 2, 6))
|
||||
.RuleFor(x => x.BitDepth, Random.Shared.Next(8, 32))
|
||||
.RuleFor(x => x.AudioCodec, f => f.PickRandom("FLAC", "MP3", "AAC", "ALAC"))
|
||||
.RuleFor(x => x.Container, f => includeContainer ? (container ?? f.PickRandom("FLAC", "MP3", "OGG", "MP4", "AAC", "WAV")) : null)
|
||||
.RuleFor(x => x.Bitrate, Random.Shared.Next(96, 1411))
|
||||
.RuleFor(x => x.TrackNumber, f => trackNumber ?? f.Random.Int(1, 20))
|
||||
.RuleFor(x => x.DiscNumber, Random.Shared.Next(1, 3))
|
||||
|
||||
+5
@@ -61,6 +61,7 @@ public class AudioMetadataDtoFixture
|
||||
/// <param name="channels">Optional. The number of audio channels.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the audio.</param>
|
||||
/// <param name="audioCodec">Optional. The audio codec used.</param>
|
||||
/// <param name="container">Optional. The container of the audio file.</param>
|
||||
/// <param name="bitrate">Optional. The bitrate of the audio, in kbps.</param>
|
||||
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording.</param>
|
||||
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
|
||||
@@ -86,6 +87,7 @@ public class AudioMetadataDtoFixture
|
||||
/// <param name="includeChannels">Whether the channels should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitDepth">Whether the bit depth should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeAudioCodec">Whether the audio codec should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContainer">Whether the container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeBitrate">Whether the bitrate should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
@@ -114,6 +116,7 @@ public class AudioMetadataDtoFixture
|
||||
int? channels = null,
|
||||
int? bitDepth = null,
|
||||
string? audioCodec = null,
|
||||
string? container = null,
|
||||
int? bitrate = null,
|
||||
Guid? musicBrainzRecordingId = null,
|
||||
Guid? musicBrainzTrackId = null,
|
||||
@@ -139,6 +142,7 @@ public class AudioMetadataDtoFixture
|
||||
bool includeChannels = true,
|
||||
bool includeBitDepth = true,
|
||||
bool includeAudioCodec = true,
|
||||
bool includeContainer = true,
|
||||
bool includeBitrate = true,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
@@ -167,6 +171,7 @@ public class AudioMetadataDtoFixture
|
||||
includeChannels ? (channels ?? _faker.Random.Int(1, 8)) : null,
|
||||
includeBitDepth ? (bitDepth ?? _faker.Random.Int(8, 32)) : null,
|
||||
includeAudioCodec ? (audioCodec ?? _faker.Random.ArrayElement(["FLAC", "MP3", "AAC", "ALAC"])) : null,
|
||||
includeContainer ? (container ?? _faker.Random.ArrayElement(["MP3", "FLAC", "OGG", "MP4", "AAC", "WAV"])) : null,
|
||||
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null,
|
||||
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
|
||||
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
|
||||
|
||||
+7
-2
@@ -39,6 +39,7 @@ public class TrackResponseFixture
|
||||
/// <param name="albumId">Optional. The Id of the album the track belongs to.</param>
|
||||
/// <param name="libraryId">Optional. The Id of the media library this track belongs to.</param>
|
||||
/// <param name="path">Optional. The file system path of the track.</param>
|
||||
/// <param name="container">Optional. The container of the audio file of the track.</param>
|
||||
/// <param name="metadata">Optional. The audio metadata of the track.</param>
|
||||
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
|
||||
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
|
||||
@@ -56,6 +57,7 @@ public class TrackResponseFixture
|
||||
/// <param name="ratings">Optional. The list of ratings of the track.</param>
|
||||
/// <param name="includeMusicBrainzRecordingId">Whether the MusicBrainz recording Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeMusicBrainzTrackId">Whether the MusicBrainz track Id should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <param name="includeContainer">Whether the container should be included, or forced to <see langword="null"/>.</param>
|
||||
/// <returns>The created <see cref="TrackResponse"/>.</returns>
|
||||
public TrackResponse Create(
|
||||
Guid? id = null,
|
||||
@@ -78,7 +80,9 @@ public class TrackResponseFixture
|
||||
List<MediaContributorReferenceDto>? contributors = null,
|
||||
List<AudioRatingDto>? ratings = null,
|
||||
bool includeMusicBrainzRecordingId = true,
|
||||
bool includeMusicBrainzTrackId = true)
|
||||
bool includeMusicBrainzTrackId = true,
|
||||
bool includeContainer = true,
|
||||
string? container = null)
|
||||
{
|
||||
return new TrackResponse(
|
||||
id ?? Guid.NewGuid(),
|
||||
@@ -99,7 +103,8 @@ public class TrackResponseFixture
|
||||
moods ?? _moodDtoFixture.CreateMany(1),
|
||||
isrcs ?? _isrcDtoFixture.CreateMany(1),
|
||||
contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1),
|
||||
ratings ?? _audioRatingDtoFixture.CreateMany(1));
|
||||
ratings ?? _audioRatingDtoFixture.CreateMany(1),
|
||||
includeContainer ? (container ?? _faker.Random.ArrayElement(["MP3", "FLAC", "OGG", "MP4", "AAC", "WAV"])) : null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+3
@@ -39,6 +39,7 @@ public class AudioMetadataFixture
|
||||
/// <param name="originalLanguage">Optional. The original language of the audio.</param>
|
||||
/// <param name="bitDepth">Optional. The bit depth of the audio.</param>
|
||||
/// <param name="audioCodec">Optional. The audio codec used.</param>
|
||||
/// <param name="container">Optional. The container of the audio.</param>
|
||||
/// <param name="bitrate">Optional. The bitrate of the audio, in kbps.</param>
|
||||
/// <param name="acoustId">Optional. The AcoustID fingerprint identifier of the audio file.</param>
|
||||
/// <param name="replayGainTrackGain">Optional. The ReplayGain track gain, in decibels.</param>
|
||||
@@ -60,6 +61,7 @@ public class AudioMetadataFixture
|
||||
Optional<LanguageInfo>? originalLanguage = null,
|
||||
Optional<int>? bitDepth = null,
|
||||
Optional<string>? audioCodec = null,
|
||||
Optional<string>? container = null,
|
||||
Optional<int>? bitrate = null,
|
||||
Optional<string>? acoustId = null,
|
||||
Optional<decimal>? replayGainTrackGain = null,
|
||||
@@ -81,6 +83,7 @@ public class AudioMetadataFixture
|
||||
originalLanguage ?? Optional<LanguageInfo>.None(),
|
||||
bitDepth ?? Optional<int>.Some(_faker.Random.Int(8, 32)),
|
||||
audioCodec ?? Optional<string>.Some("PCM"),
|
||||
container ?? Optional<string>.Some(_faker.PickRandom("MP3", "FLAC", "OGG", "MP4", "AAC", "WAV")),
|
||||
bitrate ?? Optional<int>.Some(_faker.Random.Int(128, 320)),
|
||||
acoustId ?? Optional<string>.None(),
|
||||
replayGainTrackGain ?? Optional<decimal>.None(),
|
||||
|
||||
Reference in new issue
Block a user