Adds the music metadata data transfer objects, their requests and responses, and extends the artwork data transfer object

This commit is contained in:
BinaryAlley committed 2026-10-06 20:38:00 +03:00
1 parent 5529e99024
commit a939d8fd5f
48 files changed
+1961 -161

No files matched your search

@@ -25,7 +25,7 @@ namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.Mus
public class AlbumResponseFixture
{
private readonly Faker _faker = new();
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
private readonly TrackResponseFixture _trackResponseFixture = new();
@@ -38,8 +38,11 @@ public class AlbumResponseFixture
/// <param name="libraryId">Optional. The Id of the media library the album belongs to.</param>
/// <param name="metadata">Optional. The album metadata of the album.</param>
/// <param name="mediaFormat">Optional. The physical or digital medium of the album.</param>
/// <param name="packaging">Optional. The outermost physical packaging of the album.</param>
/// <param name="barcode">Optional. The barcode of the album.</param>
/// <param name="catalogNumber">Optional. The catalog number of the album.</param>
/// <param name="label">Optional. The name of the label that issued the album.</param>
/// <param name="asin">Optional. The ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">Optional. The MusicBrainz identifier of the release artist.</param>
@@ -49,8 +52,11 @@ public class AlbumResponseFixture
/// <param name="ratings">Optional. The list of ratings of the album.</param>
/// <param name="tracks">Optional. The list of tracks of the album.</param>
/// <param name="includeMediaFormat">Whether the media format should be included, or forced to <see langword="null"/>.</param>
/// <param name="includePackaging">Whether the packaging should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBarcode">Whether the barcode should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCatalogNumber">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCatalogNumbers">Whether the catalog number should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLabel">Whether the label should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAsin">Whether the ASIN should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMusicBrainzReleaseId">Whether the MusicBrainz release Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMusicBrainzReleaseGroupId">Whether the MusicBrainz release group Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMusicBrainzReleaseArtistId">Whether the MusicBrainz release artist Id should be included, or forced to <see langword="null"/>.</param>
@@ -63,10 +69,13 @@ public class AlbumResponseFixture
Guid? id = null,
Guid? artistId = null,
Guid? libraryId = null,
AlbumMetadataDto? metadata = null,
MusicAlbumMetadataDto? metadata = null,
MusicMediaFormat? mediaFormat = null,
MusicReleasePackaging? packaging = null,
string? barcode = null,
string? catalogNumber = null,
List<string>? catalogNumbers = null,
string? label = null,
string? asin = null,
Guid? musicBrainzReleaseId = null,
Guid? musicBrainzReleaseGroupId = null,
Guid? musicBrainzReleaseArtistId = null,
@@ -76,8 +85,11 @@ public class AlbumResponseFixture
List<AudioRatingDto>? ratings = null,
List<TrackResponse>? tracks = null,
bool includeMediaFormat = true,
bool includePackaging = true,
bool includeBarcode = true,
bool includeCatalogNumber = true,
bool includeCatalogNumbers = true,
bool includeLabel = true,
bool includeAsin = true,
bool includeMusicBrainzReleaseId = true,
bool includeMusicBrainzReleaseGroupId = true,
bool includeMusicBrainzReleaseArtistId = true,
@@ -90,10 +102,13 @@ public class AlbumResponseFixture
id ?? Guid.NewGuid(),
artistId ?? Guid.NewGuid(),
libraryId ?? Guid.NewGuid(),
metadata ?? _albumMetadataDtoFixture.Create(),
metadata ?? _musicAlbumMetadataDtoFixture.Create(),
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
includeCatalogNumber ? (catalogNumber ?? _faker.Random.AlphaNumeric(10)) : null,
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(10)]) : null,
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? Guid.NewGuid()) : null,
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? Guid.NewGuid()) : null,
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? Guid.NewGuid()) : null,
@@ -1,7 +1,11 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
@@ -20,7 +24,9 @@ namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.Mus
public class ArtistResponseFixture
{
private readonly Faker _faker = new();
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
private readonly AlbumResponseFixture _albumResponseFixture = new();
/// <summary>
@@ -28,45 +34,60 @@ public class ArtistResponseFixture
/// </summary>
/// <param name="id">Optional. The Id of the artist.</param>
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to.</param>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="metadata">Optional. The metadata of the artist.</param>
/// <param name="website">Optional. The website of the artist.</param>
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
/// <param name="ipis">Optional. The IPI codes of the artist.</param>
/// <param name="isnis">Optional. The ISNI codes of the artist.</param>
/// <param name="contributors">Optional. The list of contributor references of the artist.</param>
/// <param name="ratings">Optional. The list of ratings of the artist.</param>
/// <param name="albums">Optional. The list of albums of the artist.</param>
/// <param name="createdOnUtc">Optional. The date and time when the artist was created.</param>
/// <param name="updatedOnUtc">Optional. The date and time when the artist was updated.</param>
/// <param name="includeWebsite">Whether the website should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMusicBrainzArtistId">Whether the MusicBrainz artist Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIpis">Whether the IPI codes should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIsnis">Whether the ISNI codes should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeUpdatedOnUtc">Whether the update date should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeRatings">Whether the ratings should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbums">Whether the albums should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="ArtistResponse"/>.</returns>
public ArtistResponse Create(
Guid? id = null,
Guid? libraryId = null,
string? name = null,
MusicArtistMetadataDto? metadata = null,
string? website = null,
Guid? musicBrainzArtistId = null,
List<string>? ipis = null,
List<string>? isnis = null,
List<MediaContributorReferenceDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
List<AlbumResponse>? albums = null,
DateTime? createdOnUtc = null,
DateTime? updatedOnUtc = null,
bool includeWebsite = true,
bool includeMusicBrainzArtistId = true,
bool includeIpis = true,
bool includeIsnis = true,
bool includeUpdatedOnUtc = true,
bool includeContributors = true,
bool includeRatings = true,
bool includeAlbums = true)
{
return new ArtistResponse(
id ?? Guid.NewGuid(),
libraryId ?? Guid.NewGuid(),
name ?? _faker.Name.FullName(),
metadata ?? _musicArtistMetadataDtoFixture.Create(),
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? Guid.NewGuid()) : null,
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null,
includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null,
includeIpis ? (ipis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(9))]) : null,
includeIsnis ? (isnis ?? [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => _faker.Random.AlphaNumeric(16))]) : null,
createdOnUtc ?? _faker.Date.Past().ToUniversalTime(),
includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null);
includeUpdatedOnUtc ? (updatedOnUtc ?? _faker.Date.Recent().ToUniversalTime()) : null,
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(1)) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(1)) : null,
includeAlbums ? (albums ?? _albumResponseFixture.CreateMany(1)) : null);
}
/// <summary>
@@ -25,7 +25,8 @@ namespace Lumina.Contracts.Fixtures.Core.Responses.MediaLibrary.AudioLibrary.Mus
public class TrackResponseFixture
{
private readonly Faker _faker = new();
private readonly AudioMetadataDtoFixture _audioMetadataDtoFixture = new();
private readonly MusicTrackMetadataDtoFixture _musicTrackMetadataDtoFixture = new();
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
private readonly MoodDtoFixture _moodDtoFixture = new();
private readonly IsrcDtoFixture _isrcDtoFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
@@ -44,10 +45,9 @@ public class TrackResponseFixture
/// <param name="script">Optional. The script used by the language of the track.</param>
/// <param name="key">Optional. The musical key of the track.</param>
/// <param name="bpm">Optional. The tempo of the track in beats per minute.</param>
/// <param name="work">Optional. The title of the work the track is a recording of.</param>
/// <param name="work">Optional. The work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz recording Id of the track.</param>
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz track Id of the track.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz work Id of the track.</param>
/// <param name="createdOnUtc">Optional. The date and time when the track was created.</param>
/// <param name="updatedOnUtc">Optional. The date and time when the track was updated.</param>
/// <param name="moods">Optional. The list of moods of the track.</param>
@@ -56,23 +56,21 @@ 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="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="TrackResponse"/>.</returns>
public TrackResponse Create(
Guid? id = null,
Guid? albumId = null,
Guid? libraryId = null,
string? path = null,
AudioMetadataDto? metadata = null,
MusicTrackMetadataDto? metadata = null,
int? trackNumber = null,
int? discNumber = null,
string? script = null,
MusicKey? key = null,
int? bpm = null,
string? work = null,
MusicWorkDto? work = null,
Guid? musicBrainzRecordingId = null,
Guid? musicBrainzTrackId = null,
Guid? musicBrainzWorkId = null,
DateTime? createdOnUtc = null,
DateTime? updatedOnUtc = null,
List<MoodDto>? moods = null,
@@ -80,24 +78,22 @@ public class TrackResponseFixture
List<MediaContributorReferenceDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeMusicBrainzWorkId = true)
bool includeMusicBrainzTrackId = true)
{
return new TrackResponse(
id ?? Guid.NewGuid(),
albumId ?? Guid.NewGuid(),
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
metadata ?? _audioMetadataDtoFixture.Create(),
metadata ?? _musicTrackMetadataDtoFixture.Create(),
trackNumber ?? _faker.Random.Int(1, 30),
discNumber ?? (_faker.Random.Bool() ? _faker.Random.Int(1, 3) : null),
script ?? (_faker.Random.Bool() ? _faker.Random.AlphaNumeric(4) : null),
key ?? (_faker.Random.Bool() ? _faker.PickRandom<MusicKey>() : null),
bpm ?? (_faker.Random.Bool() ? _faker.Random.Int(40, 220) : null),
work ?? (_faker.Random.Bool() ? _faker.Lorem.Sentence() : null),
work ?? _musicWorkDtoFixture.Create(),
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? Guid.NewGuid()) : null,
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? Guid.NewGuid()) : null,
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? Guid.NewGuid()) : null,
createdOnUtc ?? _faker.Date.Past().ToUniversalTime(),
updatedOnUtc ?? (_faker.Random.Bool() ? _faker.Date.Recent().ToUniversalTime() : null),
moods ?? _moodDtoFixture.CreateMany(1),