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

@@ -1,4 +1,5 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System.Diagnostics;
#endregion
@@ -7,10 +8,16 @@ namespace Lumina.Contracts.DTO.Common;
/// <summary>
/// Data transfer object for the artwork of a media item, provided by an artwork provider.
/// </summary>
/// <param name="Type">The type of the artwork, like the cover or the back of the media item.</param>
/// <param name="Ordinal">The ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered.</param>
/// <param name="LocalPath">The local file system path of the artwork, when the artwork is a local file.</param>
/// <param name="RemoteUrl">The remote URL of the artwork, when the artwork is fetched over the web.</param>
[DebuggerDisplay("LocalPath: {LocalPath}, RemoteUrl: {RemoteUrl}")]
/// <param name="IsTemporary">Whether a local artwork is a temporary file produced by the provider, which is deleted after the artwork is stored.</param>
[DebuggerDisplay("Type: {Type}, Ordinal: {Ordinal}, LocalPath: {LocalPath}, RemoteUrl: {RemoteUrl}")]
public sealed record ArtworkDto(
ArtworkType Type,
int Ordinal,
string? LocalPath,
string? RemoteUrl
string? RemoteUrl,
bool IsTemporary = false
);
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
@@ -9,32 +11,60 @@ using System.Diagnostics;
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of an album.
/// Data transfer object for the metadata of an album, returned by a metadata provider.
/// </summary>
/// <param name="Title">The title of the album. Required.</param>
/// <param name="OriginalTitle">The original title of the album, if different from the current title. Optional.</param>
/// <param name="Description">A brief description or summary of the album. Optional.</param>
/// <param name="Disambiguation">The disambiguation comment of the album, used to distinguish albums with the same title. Optional.</param>
/// <param name="ReleaseInfo">The release information, including release date and other relevant details. Required.</param>
/// <param name="Language">The language of the album. Optional.</param>
/// <param name="OriginalLanguage">The original language of the album, if it has been translated. Optional.</param>
/// <param name="Tags">The list of tags that further describe or categorize the album. Required.</param>
/// <param name="Genres">The list of genres associated with the album. Required.</param>
/// <param name="ReleaseType">The type of the release. Optional.</param>
/// <param name="Script">The script used by the language of the release of the album. Optional.</param>
/// <param name="ReleaseTypes">The set of types of the release. Optional.</param>
/// <param name="ReleaseStatus">The status of the release. Optional.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="TotalDiscs">The number of discs of the release. Optional.</param>
/// <param name="TotalTracks">The number of tracks of the release. Required.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the album, each with the role they played. Required.</param>
/// <param name="Ratings">The list of ratings for the album. Required.</param>
/// <param name="ReleaseTitle">The title of the specific release (edition) the album files match, if different from the release group title. Optional.</param>
[DebuggerDisplay("Title: {Title}")]
public record AlbumMetadataDto(
public sealed record AlbumMetadataDto(
string? Title,
string? OriginalTitle,
string? Description,
string? Disambiguation,
ReleaseInfoDto? ReleaseInfo,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
List<TagDto>? Tags,
List<GenreDto>? Genres,
MusicReleaseType? ReleaseType,
string? Script,
List<MusicReleaseType>? ReleaseTypes,
MusicReleaseStatus? ReleaseStatus,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
int? TotalDiscs,
int? TotalTracks
);
int? TotalTracks,
string? Barcode,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
List<MediaContributorDto>? Contributors,
List<AudioRatingDto>? Ratings,
string? ReleaseTitle = null
) : MetadataDto;
@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for an album metadata lookup.
/// </summary>
/// <param name="LibraryId">The Id of the media library the album belongs to.</param>
/// <param name="Path">The file system path of a track of the album.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group of the album, if applicable.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release of the album, if applicable.</param>
/// <param name="Title">The title of the album, if applicable.</param>
/// <param name="ArtistName">The name of the artist of the album, if applicable.</param>
/// <param name="ReleaseYear">The year the album was released, if applicable.</param>
/// <param name="TrackCount">The number of tracks the local album has, if applicable. It is used to select a release whose tracklist matches the local files.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record AlbumMetadataLookupDto(
Guid LibraryId,
string Path,
Guid? MusicBrainzReleaseGroupId = null,
Guid? MusicBrainzReleaseId = null,
string? Title = null,
string? ArtistName = null,
int? ReleaseYear = null,
int? TrackCount = null
) : MetadataLookupDto;
@@ -0,0 +1,60 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of a music artist.
/// </summary>
/// <param name="Name">The name of the artist.</param>
/// <param name="SortName">The sort name of the artist, a variant of the name used when sorting artists, if applicable.</param>
/// <param name="Disambiguation">The disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.</param>
/// <param name="Type">The type of the artist, if applicable.</param>
/// <param name="Gender">The gender of the artist, applicable only to artists that are persons or characters, if applicable.</param>
/// <param name="Country">The ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.</param>
/// <param name="Area">The area the artist is primarily identified with, if applicable.</param>
/// <param name="BeginArea">The area the artist began in, if applicable.</param>
/// <param name="EndArea">The area the artist ended in, if applicable.</param>
/// <param name="LifeSpanBegin">The date the artist started existing, if applicable.</param>
/// <param name="LifeSpanEnd">The date the artist stopped existing, if applicable.</param>
/// <param name="IsEnded">Whether the artist no longer exists.</param>
/// <param name="Website">The website of the artist, if applicable.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist, if applicable.</param>
/// <param name="Ipis">The list of IPI (Interested Party Information) codes of the artist.</param>
/// <param name="Isnis">The list of ISNI (International Standard Name Identifier) codes of the artist.</param>
/// <param name="Aliases">The list of alternative names of the artist.</param>
/// <param name="Genres">The list of genres associated with the artist.</param>
/// <param name="Tags">The list of tags that further describe or categorize the artist.</param>
/// <param name="Ratings">The list of ratings for the artist.</param>
/// <param name="Contributors">The list of media contributors that make up the artist, each with the role they played.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record ArtistMetadataDto(
string? Name,
string? SortName,
string? Disambiguation,
MusicArtistType? Type,
MusicArtistGender? Gender,
string? Country,
MusicAreaDto? Area,
MusicAreaDto? BeginArea,
MusicAreaDto? EndArea,
DateOnly? LifeSpanBegin,
DateOnly? LifeSpanEnd,
bool IsEnded,
string? Website,
Guid? MusicBrainzArtistId,
List<string>? Ipis,
List<string>? Isnis,
List<MusicArtistAliasDto>? Aliases,
List<GenreDto>? Genres,
List<TagDto>? Tags,
List<AudioRatingDto>? Ratings,
List<MediaContributorDto>? Contributors
) : MetadataDto;
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a music artist metadata lookup.
/// </summary>
/// <param name="LibraryId">The Id of the media library the artist belongs to.</param>
/// <param name="Path">The file system path of a track of the artist.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist, if applicable.</param>
/// <param name="Name">The name of the artist, if applicable.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record ArtistMetadataLookupDto(
Guid LibraryId,
string Path,
Guid? MusicBrainzArtistId = null,
string? Name = null
) : MetadataLookupDto;
@@ -1,5 +1,8 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -8,36 +11,60 @@ using System.Diagnostics;
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the audio metadata of a track.
/// Data transfer object for the audio metadata of a track, returned by a metadata provider.
/// </summary>
/// <param name="Title">The title of the track. Required.</param>
/// <param name="OriginalTitle">The original title of the track, if different from the current title. Optional.</param>
/// <param name="Description">A brief description or summary of the track. Optional.</param>
/// <param name="Disambiguation">The disambiguation comment of the track, used to distinguish tracks with the same title. Optional.</param>
/// <param name="ReleaseInfo">The release information, including release date and other relevant details. Required.</param>
/// <param name="Language">The language of the track. Optional.</param>
/// <param name="OriginalLanguage">The original language of the track, if it has been translated. Optional.</param>
/// <param name="Tags">The list of tags that further describe or categorize the track. Required.</param>
/// <param name="Genres">The list of genres associated with the track. Required.</param>
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="IsVideo">Whether the recording of the track is a video recording.</param>
/// <param name="Work">The work the track is a recording of, if applicable. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="DurationInSeconds">The duration of the audio of the track in seconds. Required.</param>
/// <param name="SampleRate">The sample rate of the audio of the track in Hz. Required.</param>
/// <param name="Channels">The number of audio channels of the track. Required.</param>
/// <param name="BitDepth">The bit depth of the audio of the track. Optional.</param>
/// <param name="AudioCodec">The audio codec used by the track. Optional.</param>
/// <param name="Bitrate">The bitrate of the audio of the track in kbps. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track, each with the role they played. Required.</param>
/// <param name="Ratings">The list of ratings for the track. Required.</param>
[DebuggerDisplay("Title: {Title}")]
public record AudioMetadataDto(
public sealed record AudioMetadataDto(
string? Title,
string? OriginalTitle,
string? Description,
string? Disambiguation,
ReleaseInfoDto? ReleaseInfo,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
List<TagDto>? Tags,
List<GenreDto>? Genres,
string? Script,
MusicKey? Key,
int? Bpm,
bool IsVideo,
MusicWorkDto? Work,
List<IsrcDto>? Isrcs,
List<MoodDto>? Moods,
int? DurationInSeconds,
int? SampleRate,
int? Channels,
int? BitDepth,
string? AudioCodec,
int? Bitrate
);
int? Bitrate,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
List<MediaContributorDto>? Contributors,
List<AudioRatingDto>? Ratings
) : MetadataDto;
@@ -0,0 +1,48 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of an album, as used by the API.
/// </summary>
/// <remarks>
/// The identifiers, the contributors and the ratings of the album are kept alongside this object, as siblings, rather than inside it.
/// </remarks>
/// <param name="Title">The title of the album. Required.</param>
/// <param name="OriginalTitle">The original title of the album, if different from the current title. Optional.</param>
/// <param name="Description">A brief description or summary of the album. Optional.</param>
/// <param name="Disambiguation">The disambiguation comment of the album, used to distinguish albums with the same title. Optional.</param>
/// <param name="ReleaseInfo">The release information, including release date and other relevant details. Required.</param>
/// <param name="Language">The language of the album. Optional.</param>
/// <param name="OriginalLanguage">The original language of the album, if it has been translated. Optional.</param>
/// <param name="Tags">The list of tags that further describe or categorize the album. Required.</param>
/// <param name="Genres">The list of genres associated with the album. Required.</param>
/// <param name="Script">The script used by the language of the release of the album. Optional.</param>
/// <param name="ReleaseTypes">The set of types of the release. Optional.</param>
/// <param name="ReleaseStatus">The status of the release. Optional.</param>
/// <param name="TotalDiscs">The number of discs of the release. Optional.</param>
/// <param name="TotalTracks">The number of tracks of the release. Required.</param>
/// <param name="ReleaseTitle">The title of the specific release (edition) the album files match, if different from the release group title. Optional.</param>
[DebuggerDisplay("Title: {Title}")]
public record MusicAlbumMetadataDto(
string? Title,
string? OriginalTitle,
string? Description,
string? Disambiguation,
ReleaseInfoDto? ReleaseInfo,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
List<TagDto>? Tags,
List<GenreDto>? Genres,
string? Script,
List<MusicReleaseType>? ReleaseTypes,
MusicReleaseStatus? ReleaseStatus,
int? TotalDiscs,
int? TotalTracks,
string? ReleaseTitle = null
);
@@ -0,0 +1,25 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a MusicBrainz area, the geographic area a music artist is associated with.
/// </summary>
/// <param name="MusicBrainzAreaId">The MusicBrainz identifier of the area.</param>
/// <param name="Name">The name of the area.</param>
/// <param name="SortName">The sort name of the area, if applicable.</param>
/// <param name="Disambiguation">The disambiguation comment of the area, if applicable.</param>
/// <param name="Type">The MusicBrainz type of the area, if applicable.</param>
/// <param name="Iso3166Code">The ISO 3166 code of the area, if applicable.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record MusicAreaDto(
Guid? MusicBrainzAreaId,
string? Name,
string? SortName,
string? Disambiguation,
string? Type,
string? Iso3166Code
);
@@ -0,0 +1,29 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for an alternative name of a music artist.
/// </summary>
/// <param name="Name">The name of the alias.</param>
/// <param name="SortName">The sort name of the alias, if applicable.</param>
/// <param name="Type">The type of the alias, if applicable.</param>
/// <param name="Locale">The locale the alias is used in, if applicable.</param>
/// <param name="IsPrimary">Whether this is the primary alias of the artist.</param>
/// <param name="BeginDate">The date the alias began being used, if applicable.</param>
/// <param name="EndDate">The date the alias stopped being used, if applicable.</param>
/// <param name="IsEnded">Whether the alias is no longer used.</param>
[DebuggerDisplay("Name: {Name}")]
public sealed record MusicArtistAliasDto(
string? Name,
string? SortName,
string? Type,
string? Locale,
bool IsPrimary,
DateOnly? BeginDate,
DateOnly? EndDate,
bool IsEnded
);
@@ -0,0 +1,49 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the metadata of a music artist, as used by the API.
/// </summary>
/// <remarks>
/// The identifiers, the contributors and the ratings of the artist are kept alongside this object, as siblings, rather than inside it.
/// </remarks>
/// <param name="Name">The name of the artist.</param>
/// <param name="SortName">The sort name of the artist, a variant of the name used when sorting artists, if applicable.</param>
/// <param name="Disambiguation">The disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.</param>
/// <param name="Type">The type of the artist, if applicable.</param>
/// <param name="Gender">The gender of the artist, applicable only to artists that are persons or characters, if applicable.</param>
/// <param name="Country">The ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.</param>
/// <param name="Area">The area the artist is primarily identified with, if applicable.</param>
/// <param name="BeginArea">The area the artist began in, if applicable.</param>
/// <param name="EndArea">The area the artist ended in, if applicable.</param>
/// <param name="LifeSpanBegin">The date the artist started existing, if applicable.</param>
/// <param name="LifeSpanEnd">The date the artist stopped existing, if applicable.</param>
/// <param name="IsEnded">Whether the artist no longer exists.</param>
/// <param name="Genres">The list of genres associated with the artist.</param>
/// <param name="Tags">The list of tags that further describe or categorize the artist.</param>
/// <param name="Aliases">The list of alternative names of the artist.</param>
[DebuggerDisplay("Name: {Name}")]
public record MusicArtistMetadataDto(
string? Name,
string? SortName,
string? Disambiguation,
MusicArtistType? Type,
MusicArtistGender? Gender,
string? Country,
MusicAreaDto? Area,
MusicAreaDto? BeginArea,
MusicAreaDto? EndArea,
DateOnly? LifeSpanBegin,
DateOnly? LifeSpanEnd,
bool IsEnded,
List<GenreDto>? Genres,
List<TagDto>? Tags,
List<MusicArtistAliasDto>? Aliases
);
@@ -0,0 +1,59 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for the audio metadata of a track, as used by the API.
/// </summary>
/// <remarks>
/// The identifiers, the contributors and the ratings of the track are kept alongside this object, as siblings, rather than inside it.
/// </remarks>
/// <param name="Title">The title of the track. Required.</param>
/// <param name="OriginalTitle">The original title of the track, if different from the current title. Optional.</param>
/// <param name="Description">A brief description or summary of the track. Optional.</param>
/// <param name="Disambiguation">The disambiguation comment of the track, used to distinguish tracks with the same title. Optional.</param>
/// <param name="ReleaseInfo">The release information, including release date and other relevant details. Required.</param>
/// <param name="Language">The language of the track. Optional.</param>
/// <param name="OriginalLanguage">The original language of the track, if it has been translated. Optional.</param>
/// <param name="Tags">The list of tags that further describe or categorize the track. Required.</param>
/// <param name="Genres">The list of genres associated with the track. Required.</param>
/// <param name="IsVideo">Whether the recording of the track is a video recording.</param>
/// <param name="DurationInSeconds">The duration of the audio of the track in seconds. Required.</param>
/// <param name="SampleRate">The sample rate of the audio of the track in Hz. Required.</param>
/// <param name="Channels">The number of audio channels of the track. Required.</param>
/// <param name="BitDepth">The bit depth of the audio of the track. Optional.</param>
/// <param name="AudioCodec">The audio codec used by the track. Optional.</param>
/// <param name="Bitrate">The bitrate of the audio of the track in kbps. Optional.</param>
/// <param name="AcoustId">The AcoustID fingerprint identifier of the audio file of the track. Optional.</param>
/// <param name="ReplayGainTrackGain">The ReplayGain track gain of the track in decibels. Optional.</param>
/// <param name="ReplayGainTrackPeak">The ReplayGain track peak of the track. Optional.</param>
/// <param name="ReplayGainAlbumGain">The ReplayGain album gain of the track in decibels. Optional.</param>
/// <param name="ReplayGainAlbumPeak">The ReplayGain album peak of the track. Optional.</param>
[DebuggerDisplay("Title: {Title}")]
public record MusicTrackMetadataDto(
string? Title,
string? OriginalTitle,
string? Description,
string? Disambiguation,
ReleaseInfoDto? ReleaseInfo,
LanguageInfoDto? Language,
LanguageInfoDto? OriginalLanguage,
List<TagDto>? Tags,
List<GenreDto>? Genres,
bool IsVideo,
int? DurationInSeconds,
int? SampleRate,
int? Channels,
int? BitDepth,
string? AudioCodec,
int? Bitrate,
string? AcoustId = null,
decimal? ReplayGainTrackGain = null,
decimal? ReplayGainTrackPeak = null,
decimal? ReplayGainAlbumGain = null,
decimal? ReplayGainAlbumPeak = null
);
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a MusicBrainz work, the musical composition a track is a recording of.
/// </summary>
/// <remarks>
/// The contributors credited on the work are carried by the contributors of the metadata of the track.
/// </remarks>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work.</param>
/// <param name="Title">The title of the work.</param>
/// <param name="Type">The MusicBrainz type of the work, if applicable.</param>
/// <param name="Languages">The list of languages of the work.</param>
/// <param name="Iswcs">The list of ISWC (International Standard Musical Work Code) of the work.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record MusicWorkDto(
Guid? MusicBrainzWorkId,
string? Title,
string? Type,
List<LanguageInfoDto>? Languages,
List<string>? Iswcs
);
@@ -0,0 +1,40 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Data transfer object for a track metadata lookup.
/// </summary>
/// <param name="LibraryId">The Id of the media library the track belongs to.</param>
/// <param name="Path">The file system path of the track.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording of the track, if applicable.</param>
/// <param name="Isrc">The ISRC (International Standard Recording Code) of the track, if applicable.</param>
/// <param name="Title">The title of the track, if applicable.</param>
/// <param name="ArtistName">The name of the artist of the track, if applicable.</param>
/// <param name="ReleaseName">The name of the release the track belongs to, if applicable.</param>
/// <param name="TrackNumber">The number of the track on its disc, if applicable.</param>
/// <param name="DurationInSeconds">The duration of the track in seconds, if applicable.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release the track belongs to, if applicable.</param>
/// <param name="DiscNumber">The number of the disc the track belongs to, if applicable.</param>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work the track is a recording of, read from the tags, if applicable. It is used as a fallback when MusicBrainz does not link the recording to a work.</param>
/// <param name="WorkTitle">The title of the work the track is a recording of, read from the tags, if applicable. Its presence means the work of the tags is already complete, so the work is not resolved from MusicBrainz again.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record TrackMetadataLookupDto(
Guid LibraryId,
string Path,
Guid? MusicBrainzRecordingId = null,
string? Isrc = null,
string? Title = null,
string? ArtistName = null,
string? ReleaseName = null,
int? TrackNumber = null,
int? DurationInSeconds = null,
Guid? MusicBrainzReleaseId = null,
int? DiscNumber = null,
Guid? MusicBrainzWorkId = null,
string? WorkTitle = null
) : MetadataLookupDto;
@@ -1,5 +1,4 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
@@ -17,8 +16,11 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album
/// </summary>
/// <param name="Metadata">The album metadata of the album. Required.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumber">The catalog number of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
@@ -27,10 +29,13 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album
/// <param name="Tracks">The list of tracks of the album. Required.</param>
[DebuggerDisplay("Title: {Metadata.Title}")]
public record AddAlbumRequest(
AlbumMetadataDto? Metadata,
MusicAlbumMetadataDto? Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
string? CatalogNumber,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
@@ -1,5 +1,4 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
@@ -16,8 +15,11 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album
/// </summary>
/// <param name="Metadata">The album metadata of the album. Required.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumber">The catalog number of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
@@ -25,10 +27,13 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album
/// <param name="Ratings">The list of ratings for this album. Required.</param>
[DebuggerDisplay("Title: {Metadata.Title}")]
public record UpdateAlbumRequest(
AlbumMetadataDto? Metadata,
MusicAlbumMetadataDto? Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
string? CatalogNumber,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using System;
using System.Collections.Generic;
@@ -11,16 +13,22 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
/// <summary>
/// Represents a request to add an artist, together with the albums of the artist and the tracks of those albums.
/// </summary>
/// <param name="Name">The name of the artist. Required.</param>
/// <param name="Metadata">The metadata of the artist. Required.</param>
/// <param name="Website">The website of the artist. Optional.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist. Optional.</param>
/// <param name="Ipis">The list of IPI (Interested Party Information) codes of the artist. Optional.</param>
/// <param name="Isnis">The list of ISNI (International Standard Name Identifier) codes of the artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that make up the artist. Required.</param>
/// <param name="Ratings">The list of ratings for the artist. Required.</param>
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks. Required.</param>
[DebuggerDisplay("Name: {Name}")]
[DebuggerDisplay("Name: {Metadata.Name}")]
public record AddArtistRequest(
string? Name,
MusicArtistMetadataDto? Metadata,
string? Website,
Guid? MusicBrainzArtistId,
List<string>? Ipis,
List<string>? Isnis,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings,
List<AddAlbumRequest>? Albums
);
@@ -16,8 +16,11 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
/// <param name="AlbumId">The Id of the album, when the album already exists. Optional.</param>
/// <param name="Metadata">The album metadata of the album. Required.</param>
/// <param name="MediaFormat">The physical or digital medium of the album. Optional.</param>
/// <param name="Packaging">The outermost physical packaging of the album. Optional.</param>
/// <param name="Barcode">The barcode of the album. Optional.</param>
/// <param name="CatalogNumber">The catalog number of the album. Optional.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album. Optional.</param>
/// <param name="Label">The name of the label that issued the album. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album. Optional.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release. Optional.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group. Optional.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist. Optional.</param>
@@ -27,10 +30,13 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
[DebuggerDisplay("Title: {Metadata.Title}")]
public record UpdateArtistAlbumRequest(
Guid? AlbumId,
AlbumMetadataDto? Metadata,
MusicAlbumMetadataDto? Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
string? CatalogNumber,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -10,16 +12,22 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
/// <summary>
/// Represents a request to update an existing artist.
/// </summary>
/// <param name="Name">The name of the artist. Required.</param>
/// <param name="Metadata">The metadata of the artist. Required.</param>
/// <param name="Website">The website of the artist. Optional.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist. Optional.</param>
/// <param name="Ipis">The list of IPI (Interested Party Information) codes of the artist. Optional.</param>
/// <param name="Isnis">The list of ISNI (International Standard Name Identifier) codes of the artist. Optional.</param>
/// <param name="Contributors">The list of media contributors that make up the artist. Required.</param>
/// <param name="Ratings">The list of ratings for the artist. Required.</param>
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks. Required.</param>
[DebuggerDisplay("Name: {Name}")]
[DebuggerDisplay("Name: {Metadata.Name}")]
public record UpdateArtistRequest(
string? Name,
MusicArtistMetadataDto? Metadata,
string? Website,
Guid? MusicBrainzArtistId,
List<string>? Ipis,
List<string>? Isnis,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings,
List<UpdateArtistAlbumRequest>? Albums
);
@@ -22,10 +22,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="Work">The title of the work the track is a recording of. Optional.</param>
/// <param name="Work">The work the track is a recording of. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track. Required.</param>
@@ -34,16 +33,15 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis
public record UpdateArtistTrackRequest(
Guid? TrackId,
string? Path,
AudioMetadataDto? Metadata,
MusicTrackMetadataDto? Metadata,
int? TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
string? Work,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
Guid? MusicBrainzWorkId,
List<MoodDto>? Moods,
List<IsrcDto>? Isrcs,
List<MediaContributorReferenceDto>? Contributors,
@@ -21,10 +21,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="Work">The title of the work the track is a recording of. Optional.</param>
/// <param name="Work">The work the track is a recording of. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track. Required.</param>
@@ -32,16 +31,15 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track
[DebuggerDisplay("Title: {Metadata.Title}")]
public record AddTrackRequest(
string? Path,
AudioMetadataDto? Metadata,
MusicTrackMetadataDto? Metadata,
int? TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
string? Work,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
Guid? MusicBrainzWorkId,
List<MoodDto>? Moods,
List<IsrcDto>? Isrcs,
List<MediaContributorReferenceDto>? Contributors,
@@ -21,10 +21,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track
/// <param name="Script">The script used by the language of the track. Optional.</param>
/// <param name="Key">The musical key of the track. Optional.</param>
/// <param name="Bpm">The tempo of the track in beats per minute. Optional.</param>
/// <param name="Work">The title of the work the track is a recording of. Optional.</param>
/// <param name="Work">The work the track is a recording of. Optional.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording. Optional.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track. Optional.</param>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work. Optional.</param>
/// <param name="Moods">The list of moods of the track. Optional.</param>
/// <param name="Isrcs">The list of ISRC (International Standard Recording Code) of the track. Optional.</param>
/// <param name="Contributors">The list of media contributors that performed on the track. Required.</param>
@@ -32,16 +31,15 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track
[DebuggerDisplay("Title: {Metadata.Title}")]
public record UpdateTrackRequest(
string? Path,
AudioMetadataDto? Metadata,
MusicTrackMetadataDto? Metadata,
int? TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
string? Work,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
Guid? MusicBrainzWorkId,
List<MoodDto>? Moods,
List<IsrcDto>? Isrcs,
List<MediaContributorReferenceDto>? Contributors,
@@ -19,8 +19,11 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu
/// <param name="LibraryId">The Id of the media library this album belongs to.</param>
/// <param name="Metadata">The album metadata of the album.</param>
/// <param name="MediaFormat">The physical or digital medium of the album, if applicable.</param>
/// <param name="Packaging">The outermost physical packaging of the album, if applicable.</param>
/// <param name="Barcode">The barcode of the album, if applicable.</param>
/// <param name="CatalogNumber">The catalog number of the album, if applicable.</param>
/// <param name="CatalogNumbers">The catalog numbers of the album, if applicable.</param>
/// <param name="Label">The name of the label that issued the album, if applicable.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the album, if applicable.</param>
/// <param name="MusicBrainzReleaseId">The MusicBrainz identifier of the release, if applicable.</param>
/// <param name="MusicBrainzReleaseGroupId">The MusicBrainz identifier of the release group, if applicable.</param>
/// <param name="MusicBrainzReleaseArtistId">The MusicBrainz identifier of the release artist, if applicable.</param>
@@ -34,10 +37,13 @@ public record AlbumResponse(
Guid Id,
Guid ArtistId,
Guid LibraryId,
AlbumMetadataDto Metadata,
MusicAlbumMetadataDto Metadata,
MusicMediaFormat? MediaFormat,
MusicReleasePackaging? Packaging,
string? Barcode,
string? CatalogNumber,
List<string>? CatalogNumbers,
string? Label,
string? ASIN,
Guid? MusicBrainzReleaseId,
Guid? MusicBrainzReleaseGroupId,
Guid? MusicBrainzReleaseArtistId,
@@ -1,5 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using System;
using System.Collections.Generic;
@@ -13,22 +15,28 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Arti
/// </summary>
/// <param name="Id">The Id of the artist.</param>
/// <param name="LibraryId">The Id of the media library this artist belongs to.</param>
/// <param name="Name">The name of the artist.</param>
/// <param name="Metadata">The metadata of the artist.</param>
/// <param name="Website">The website of the artist, if applicable.</param>
/// <param name="MusicBrainzArtistId">The MusicBrainz identifier of the artist, if applicable.</param>
/// <param name="Contributors">The list of references to the media contributors that make up the artist, each with the role they played.</param>
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks.</param>
/// <param name="Ipis">The list of IPI (Interested Party Information) codes of the artist.</param>
/// <param name="Isnis">The list of ISNI (International Standard Name Identifier) codes of the artist.</param>
/// <param name="CreatedOnUtc">The date and time when the artist was created.</param>
/// <param name="UpdatedOnUtc">The optional date and time when the artist was updated.</param>
[DebuggerDisplay("Name: {Name}")]
/// <param name="Contributors">The list of references to the media contributors that make up the artist, each with the role they played.</param>
/// <param name="Ratings">The list of ratings for this artist.</param>
/// <param name="Albums">The list of albums of the artist, each with its own list of tracks.</param>
[DebuggerDisplay("Name: {Metadata.Name}")]
public record ArtistResponse(
Guid Id,
Guid LibraryId,
string Name,
MusicArtistMetadataDto Metadata,
string? Website,
Guid? MusicBrainzArtistId,
List<MediaContributorReferenceDto>? Contributors,
List<AlbumResponse>? Albums,
List<string>? Ipis,
List<string>? Isnis,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
DateTime? UpdatedOnUtc,
List<MediaContributorReferenceDto>? Contributors,
List<AudioRatingDto>? Ratings,
List<AlbumResponse>? Albums
);
@@ -24,10 +24,9 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Trac
/// <param name="Script">The script used by the language of the track, if applicable.</param>
/// <param name="Key">The musical key of the track, if applicable.</param>
/// <param name="Bpm">The tempo of the track in beats per minute, if applicable.</param>
/// <param name="Work">The title of the work the track is a recording of, if applicable.</param>
/// <param name="Work">The work the track is a recording of, if applicable.</param>
/// <param name="MusicBrainzRecordingId">The MusicBrainz identifier of the recording, if applicable.</param>
/// <param name="MusicBrainzTrackId">The MusicBrainz identifier of the track, if applicable.</param>
/// <param name="MusicBrainzWorkId">The MusicBrainz identifier of the work, if applicable.</param>
/// <param name="CreatedOnUtc">The date and time when the track was created.</param>
/// <param name="UpdatedOnUtc">The optional date and time when the track was updated.</param>
/// <param name="Moods">The list of moods of the track.</param>
@@ -40,16 +39,15 @@ public record TrackResponse(
Guid AlbumId,
Guid LibraryId,
string Path,
AudioMetadataDto Metadata,
MusicTrackMetadataDto Metadata,
int TrackNumber,
int? DiscNumber,
string? Script,
MusicKey? Key,
int? Bpm,
string? Work,
MusicWorkDto? Work,
Guid? MusicBrainzRecordingId,
Guid? MusicBrainzTrackId,
Guid? MusicBrainzWorkId,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc,
List<MoodDto>? Moods,
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Contracts.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
@@ -18,12 +19,16 @@ public class ArtworkDtoFixture
/// </summary>
/// <param name="localPath">Optional. The local file system path of the artwork.</param>
/// <param name="remoteUrl">Optional. The remote URL of the artwork.</param>
/// <param name="type">Optional. The type of the artwork.</param>
/// <param name="ordinal">Optional. The ordinal of the artwork within its type.</param>
/// <returns>The created <see cref="ArtworkDto"/>.</returns>
public ArtworkDto Create(
string? localPath = null,
string? remoteUrl = null)
string? remoteUrl = null,
ArtworkType type = ArtworkType.Cover,
int ordinal = 0)
{
return new ArtworkDto(localPath, remoteUrl);
return new ArtworkDto(type, ordinal, localPath, remoteUrl);
}
/// <summary>
@@ -1,8 +1,12 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
@@ -27,74 +31,145 @@ public class AlbumMetadataDtoFixture
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="AlbumMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="originalTitle">Optional. The original title of the album.</param>
/// <param name="releaseTitle">Optional. The title of the specific release (edition) of the album.</param>
/// <param name="description">Optional. A brief description or summary of the album.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the album.</param>
/// <param name="releaseInfo">Optional. The release information of the album.</param>
/// <param name="language">Optional. The language of the album.</param>
/// <param name="originalLanguage">Optional. The original language of the album.</param>
/// <param name="tags">Optional. The tags that describe or categorize the album.</param>
/// <param name="genres">Optional. The genres associated with the album.</param>
/// <param name="releaseType">Optional. The type of the release.</param>
/// <param name="script">Optional. The script used by the language of the release of the album.</param>
/// <param name="releaseTypes">Optional. The types of the release.</param>
/// <param name="releaseStatus">Optional. The status of the release.</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="totalDiscs">Optional. The number of discs of the release.</param>
/// <param name="totalTracks">Optional. The number of tracks of the release.</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>
/// <param name="contributors">Optional. The media contributors that performed on the album.</param>
/// <param name="ratings">Optional. The ratings of the album.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseType">Whether the release type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseTypes">Whether the release types should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseStatus">Whether the release status should be included, or forced to <see langword="null"/>.</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="includeTotalDiscs">Whether the total number of discs should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalTracks">Whether the total number of tracks 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="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>
/// <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>
/// <returns>The created <see cref="AlbumMetadataDto"/>.</returns>
public AlbumMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? releaseTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
MusicReleaseType? releaseType = null,
string? script = null,
List<MusicReleaseType>? releaseTypes = null,
MusicReleaseStatus? releaseStatus = null,
MusicMediaFormat? mediaFormat = null,
MusicReleasePackaging? packaging = null,
int? totalDiscs = null,
int? totalTracks = null,
string? barcode = null,
List<string>? catalogNumbers = null,
string? label = null,
string? asin = null,
Guid? musicBrainzReleaseId = null,
Guid? musicBrainzReleaseGroupId = null,
Guid? musicBrainzReleaseArtistId = null,
List<MediaContributorDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeReleaseType = true,
bool includeScript = true,
bool includeReleaseTypes = true,
bool includeReleaseStatus = true,
bool includeMediaFormat = true,
bool includePackaging = true,
bool includeTotalDiscs = true,
bool includeTotalTracks = true)
bool includeTotalTracks = true,
bool includeBarcode = true,
bool includeCatalogNumbers = true,
bool includeLabel = true,
bool includeAsin = true,
bool includeMusicBrainzReleaseId = true,
bool includeMusicBrainzReleaseGroupId = true,
bool includeMusicBrainzReleaseArtistId = true,
bool includeContributors = true,
bool includeRatings = true,
bool includeReleaseTitle = true)
{
return new AlbumMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeReleaseType ? (releaseType ?? _faker.PickRandom<MusicReleaseType>()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeReleaseTypes ? (releaseTypes ?? [_faker.PickRandom<MusicReleaseType>()]) : null,
includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom<MusicReleaseStatus>()) : null,
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
includeTotalDiscs ? (totalDiscs ?? _faker.Random.Int(1, 3)) : null,
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null);
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null,
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.AlphaNumeric(10)]) : null,
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeReleaseTitle ? (releaseTitle ?? _faker.Commerce.ProductName()) : null);
}
/// <summary>
@@ -0,0 +1,62 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="AlbumMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class AlbumMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="AlbumMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the album belongs to.</param>
/// <param name="path">Optional. The file system path of a track of the album.</param>
/// <param name="musicBrainzReleaseGroupId">Optional. The MusicBrainz identifier of the release group of the album.</param>
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release of the album.</param>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="artistName">Optional. The name of the artist of the album.</param>
/// <param name="releaseYear">Optional. The year the album was released.</param>
/// <param name="trackCount">Optional. The number of tracks the local album has.</param>
/// <returns>The created <see cref="AlbumMetadataLookupDto"/>.</returns>
public AlbumMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzReleaseGroupId = null,
Guid? musicBrainzReleaseId = null,
string? title = null,
string? artistName = null,
int? releaseYear = null,
int? trackCount = null)
{
return new AlbumMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzReleaseGroupId,
musicBrainzReleaseId,
title,
artistName,
releaseYear,
trackCount);
}
/// <summary>
/// Creates a list of <see cref="AlbumMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<AlbumMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,159 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="ArtistMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ArtistMetadataDtoFixture
{
private const int MINIMUM_LIFESPAN_YEAR = 1900;
private const int MAXIMUM_LIFESPAN_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new();
private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="ArtistMetadataDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="sortName">Optional. The sort name of the artist.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the artist.</param>
/// <param name="type">Optional. The type of the artist.</param>
/// <param name="gender">Optional. The gender of the artist.</param>
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">Optional. The area the artist is primarily identified with.</param>
/// <param name="beginArea">Optional. The area the artist began in.</param>
/// <param name="endArea">Optional. The area the artist ended in.</param>
/// <param name="lifeSpanBegin">Optional. The date the artist started existing.</param>
/// <param name="lifeSpanEnd">Optional. The date the artist stopped existing.</param>
/// <param name="isEnded">Optional. Whether the artist no longer exists.</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="aliases">Optional. The alternative names of the artist.</param>
/// <param name="genres">Optional. The genres associated with the artist.</param>
/// <param name="tags">Optional. The tags that describe or categorize the artist.</param>
/// <param name="ratings">Optional. The ratings of the artist.</param>
/// <param name="contributors">Optional. The media contributors that make up the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGender">Whether the gender should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginArea">Whether the begin area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndArea">Whether the end area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanBegin">Whether the lifespan begin should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanEnd">Whether the lifespan end should be included, or forced to <see langword="null"/>.</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="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAliases">Whether the aliases 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="includeContributors">Whether the contributors should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="ArtistMetadataDto"/>.</returns>
public ArtistMetadataDto Create(
string? name = null,
string? sortName = null,
string? disambiguation = null,
MusicArtistType? type = null,
MusicArtistGender? gender = null,
string? country = null,
MusicAreaDto? area = null,
MusicAreaDto? beginArea = null,
MusicAreaDto? endArea = null,
DateOnly? lifeSpanBegin = null,
DateOnly? lifeSpanEnd = null,
bool? isEnded = null,
string? website = null,
Guid? musicBrainzArtistId = null,
List<string>? ipis = null,
List<string>? isnis = null,
List<MusicArtistAliasDto>? aliases = null,
List<GenreDto>? genres = null,
List<TagDto>? tags = null,
List<AudioRatingDto>? ratings = null,
List<MediaContributorDto>? contributors = null,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeGender = true,
bool includeCountry = true,
bool includeArea = true,
bool includeBeginArea = true,
bool includeEndArea = true,
bool includeLifeSpanBegin = true,
bool includeLifeSpanEnd = true,
bool includeWebsite = true,
bool includeMusicBrainzArtistId = true,
bool includeIpis = true,
bool includeIsnis = true,
bool includeGenres = true,
bool includeTags = true,
bool includeAliases = true,
bool includeRatings = true,
bool includeContributors = true)
{
int lifeSpanBeginYear = Random.Shared.Next(MINIMUM_LIFESPAN_YEAR, MAXIMUM_LIFESPAN_YEAR);
int lifeSpanEndYear = Random.Shared.Next(lifeSpanBeginYear, Math.Max(lifeSpanBeginYear + 1, MAXIMUM_LIFESPAN_YEAR));
return new ArtistMetadataDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.PickRandom<MusicArtistType>()) : null,
includeGender ? (gender ?? _faker.PickRandom<MusicArtistGender>()) : null,
includeCountry ? (country ?? _faker.Address.CountryCode()) : null,
includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null,
includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null,
includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null,
includeLifeSpanBegin ? (lifeSpanBegin ?? new DateOnly(lifeSpanBeginYear, 1, 1)) : null,
includeLifeSpanEnd ? (lifeSpanEnd ?? new DateOnly(lifeSpanEndYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool(),
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : 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,
includeAliases ? (aliases ?? _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeGenres ? (genres ?? _genreDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeTags ? (tags ?? _tagDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
/// Creates a list of <see cref="ArtistMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ArtistMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,50 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="ArtistMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class ArtistMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="ArtistMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the artist belongs to.</param>
/// <param name="path">Optional. The file system path of a track of the artist.</param>
/// <param name="musicBrainzArtistId">Optional. The MusicBrainz identifier of the artist.</param>
/// <param name="name">Optional. The name of the artist.</param>
/// <returns>The created <see cref="ArtistMetadataLookupDto"/>.</returns>
public ArtistMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzArtistId = null,
string? name = null)
{
return new ArtistMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzArtistId,
name);
}
/// <summary>
/// Creates a list of <see cref="ArtistMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<ArtistMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -1,8 +1,13 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaContributors;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Contracts.Fixtures.Core.DTO.MediaContributors;
using Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
@@ -26,6 +31,11 @@ public class AudioMetadataDtoFixture
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
private readonly MusicWorkDtoFixture _musicWorkDtoFixture = new();
private readonly IsrcDtoFixture _isrcDtoFixture = new();
private readonly MoodDtoFixture _moodDtoFixture = new();
private readonly MediaContributorDtoFixture _mediaContributorDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="AudioMetadataDto"/>.
@@ -33,77 +43,135 @@ public class AudioMetadataDtoFixture
/// <param name="title">Optional. The title of the audio.</param>
/// <param name="originalTitle">Optional. The original title of the audio.</param>
/// <param name="description">Optional. A brief description or summary of the audio.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the audio.</param>
/// <param name="releaseInfo">Optional. The release information of the audio.</param>
/// <param name="language">Optional. The language of the audio.</param>
/// <param name="originalLanguage">Optional. The original language of the audio.</param>
/// <param name="tags">Optional. The tags that describe or categorize the audio.</param>
/// <param name="genres">Optional. The genres associated with the audio.</param>
/// <param name="script">Optional. The script used by the language of the audio.</param>
/// <param name="key">Optional. The musical key of the audio.</param>
/// <param name="bpm">Optional. The tempo of the audio, in beats per minute.</param>
/// <param name="isVideo">Optional. Whether the recording of the audio is a video recording.</param>
/// <param name="work">Optional. The work the audio is a recording of.</param>
/// <param name="isrcs">Optional. The ISRC codes of the audio.</param>
/// <param name="moods">Optional. The moods of the audio.</param>
/// <param name="durationInSeconds">Optional. The duration of the audio, in seconds.</param>
/// <param name="sampleRate">Optional. The sample rate of the audio, in Hz.</param>
/// <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="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>
/// <param name="contributors">Optional. The media contributors that performed on the audio.</param>
/// <param name="ratings">Optional. The ratings of the audio.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeKey">Whether the musical key should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBpm">Whether the tempo should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeWork">Whether the work should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDurationInSeconds">Whether the duration should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSampleRate">Whether the sample rate should be included, or forced to <see langword="null"/>.</param>
/// <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="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>
/// <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>
/// <returns>The created <see cref="AudioMetadataDto"/>.</returns>
public AudioMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
string? script = null,
MusicKey? key = null,
int? bpm = null,
bool? isVideo = null,
MusicWorkDto? work = null,
List<IsrcDto>? isrcs = null,
List<MoodDto>? moods = null,
int? durationInSeconds = null,
int? sampleRate = null,
int? channels = null,
int? bitDepth = null,
string? audioCodec = null,
int? bitrate = null,
Guid? musicBrainzRecordingId = null,
Guid? musicBrainzTrackId = null,
List<MediaContributorDto>? contributors = null,
List<AudioRatingDto>? ratings = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeScript = true,
bool includeKey = true,
bool includeBpm = true,
bool includeWork = true,
bool includeIsrcs = true,
bool includeMoods = true,
bool includeDurationInSeconds = true,
bool includeSampleRate = true,
bool includeChannels = true,
bool includeBitDepth = true,
bool includeAudioCodec = true,
bool includeBitrate = true)
bool includeBitrate = true,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeContributors = true,
bool includeRatings = true)
{
return new AudioMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
includeBpm ? (bpm ?? _faker.Random.Int(40, 220)) : null,
isVideo ?? _faker.Random.Bool(),
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
includeIsrcs ? (isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeMoods ? (moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Int(60, 7200)) : null,
includeSampleRate ? (sampleRate ?? _faker.Random.Int(8000, 192000)) : null,
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,
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null);
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null,
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
includeContributors ? (contributors ?? _mediaContributorDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
@@ -0,0 +1,179 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicAlbumMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicAlbumMetadataDtoFixture
{
private const int MINIMUM_RELEASE_YEAR = 1900;
private const int MAXIMUM_RELEASE_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicAlbumMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the album.</param>
/// <param name="originalTitle">Optional. The original title of the album.</param>
/// <param name="releaseTitle">Optional. The title of the specific release (edition) of the album.</param>
/// <param name="description">Optional. A brief description or summary of the album.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the album.</param>
/// <param name="releaseInfo">Optional. The release information of the album.</param>
/// <param name="language">Optional. The language of the album.</param>
/// <param name="originalLanguage">Optional. The original language of the album.</param>
/// <param name="tags">Optional. The tags that describe or categorize the album.</param>
/// <param name="genres">Optional. The genres associated with the album.</param>
/// <param name="script">Optional. The script used by the language of the release of the album.</param>
/// <param name="releaseTypes">Optional. The types of the release.</param>
/// <param name="releaseStatus">Optional. The status of the release.</param>
/// <param name="totalDiscs">Optional. The number of discs of the release.</param>
/// <param name="totalTracks">Optional. The number of tracks of the release.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeScript">Whether the script should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseTypes">Whether the release types should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseStatus">Whether the release status should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalDiscs">Whether the total number of discs should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTotalTracks">Whether the total number of tracks should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicAlbumMetadataDto"/>.</returns>
public MusicAlbumMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? releaseTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
string? script = null,
List<MusicReleaseType>? releaseTypes = null,
MusicReleaseStatus? releaseStatus = null,
int? totalDiscs = null,
int? totalTracks = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeScript = true,
bool includeReleaseTypes = true,
bool includeReleaseStatus = true,
bool includeTotalDiscs = true,
bool includeTotalTracks = true,
bool includeReleaseTitle = true)
{
return new MusicAlbumMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
includeScript ? (script ?? _faker.Random.String2(4)) : null,
includeReleaseTypes ? (releaseTypes ?? [_faker.PickRandom<MusicReleaseType>()]) : null,
includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom<MusicReleaseStatus>()) : null,
includeTotalDiscs ? (totalDiscs ?? _faker.Random.Int(1, 3)) : null,
includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null,
includeReleaseTitle ? (releaseTitle ?? _faker.Commerce.ProductName()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicAlbumMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicAlbumMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a random valid <see cref="ReleaseInfoDto"/> with consistent dates and years.
/// </summary>
/// <returns>The created <see cref="ReleaseInfoDto"/>.</returns>
private ReleaseInfoDto GenerateReleaseInfo()
{
int originalReleaseYear = Random.Shared.Next(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR);
int reReleaseYear = Random.Shared.Next(originalReleaseYear, MAXIMUM_RELEASE_YEAR);
return _releaseInfoDtoFixture.Create(
originalReleaseDate: new DateOnly(originalReleaseYear, 1, 1),
originalReleaseYear: originalReleaseYear,
reReleaseDate: new DateOnly(reReleaseYear, 1, 1),
reReleaseYear: reReleaseYear,
releaseCountry: _faker.PickRandom<ReleaseCountry>(),
releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50)));
}
/// <summary>
/// Creates two genres with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created genres.</returns>
private List<GenreDto> GenerateDistinctGenres()
{
return
[
_genreDtoFixture.Create(name: CreateUniqueName()),
_genreDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates two tags with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created tags.</returns>
private List<TagDto> GenerateDistinctTags()
{
return
[
_tagDtoFixture.Create(name: CreateUniqueName()),
_tagDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication.
/// </summary>
/// <returns>A unique name of at most 50 characters.</returns>
private string CreateUniqueName()
{
string uniqueSuffix = Guid.NewGuid().ToString("N")[..12];
int maximumWordLength = 50 - uniqueSuffix.Length - 1;
string word = _faker.Lorem.Word();
string truncatedWord = word.Length > maximumWordLength ? word[..maximumWordLength] : word;
return $"{truncatedWord}-{uniqueSuffix}";
}
}
@@ -0,0 +1,68 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicAreaDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicAreaDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="MusicAreaDto"/>.
/// </summary>
/// <param name="musicBrainzAreaId">Optional. The MusicBrainz identifier of the area.</param>
/// <param name="name">Optional. The name of the area.</param>
/// <param name="sortName">Optional. The sort name of the area.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the area.</param>
/// <param name="type">Optional. The MusicBrainz type of the area.</param>
/// <param name="iso3166Code">Optional. The ISO 3166 code of the area.</param>
/// <param name="includeMusicBrainzAreaId">Whether the MusicBrainz area Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIso3166Code">Whether the ISO 3166 code should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicAreaDto"/>.</returns>
public MusicAreaDto Create(
Guid? musicBrainzAreaId = null,
string? name = null,
string? sortName = null,
string? disambiguation = null,
string? type = null,
string? iso3166Code = null,
bool includeMusicBrainzAreaId = true,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeIso3166Code = true)
{
return new MusicAreaDto(
includeMusicBrainzAreaId ? (musicBrainzAreaId ?? _faker.Random.Guid()) : null,
includeName ? (name ?? _faker.Address.Country()) : null,
includeSortName ? (sortName ?? _faker.Address.Country()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Country", "City", "Area"])) : null,
includeIso3166Code ? (iso3166Code ?? _faker.Address.CountryCode()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicAreaDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicAreaDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,79 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicArtistAliasDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicArtistAliasDtoFixture
{
private const int MINIMUM_ALIAS_YEAR = 1900;
private const int MAXIMUM_ALIAS_YEAR = 2026;
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="MusicArtistAliasDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the alias.</param>
/// <param name="sortName">Optional. The sort name of the alias.</param>
/// <param name="type">Optional. The type of the alias.</param>
/// <param name="locale">Optional. The locale the alias is used in.</param>
/// <param name="isPrimary">Optional. Whether this is the primary alias of the artist.</param>
/// <param name="beginDate">Optional. The date the alias began being used.</param>
/// <param name="endDate">Optional. The date the alias stopped being used.</param>
/// <param name="isEnded">Optional. Whether the alias is no longer used.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLocale">Whether the locale should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginDate">Whether the begin date should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndDate">Whether the end date should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicArtistAliasDto"/>.</returns>
public MusicArtistAliasDto Create(
string? name = null,
string? sortName = null,
string? type = null,
string? locale = null,
bool? isPrimary = null,
DateOnly? beginDate = null,
DateOnly? endDate = null,
bool? isEnded = null,
bool includeName = true,
bool includeSortName = true,
bool includeType = true,
bool includeLocale = true,
bool includeBeginDate = true,
bool includeEndDate = true)
{
int beginYear = Random.Shared.Next(MINIMUM_ALIAS_YEAR, MAXIMUM_ALIAS_YEAR);
int endYear = Random.Shared.Next(beginYear, Math.Max(beginYear + 1, MAXIMUM_ALIAS_YEAR));
return new MusicArtistAliasDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Artist name", "Search hint"])) : null,
includeLocale ? (locale ?? _faker.Random.String2(2)) : null,
isPrimary ?? _faker.Random.Bool(),
includeBeginDate ? (beginDate ?? new DateOnly(beginYear, 1, 1)) : null,
includeEndDate ? (endDate ?? new DateOnly(endYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool());
}
/// <summary>
/// Creates a list of <see cref="MusicArtistAliasDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicArtistAliasDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,123 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicArtistMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicArtistMetadataDtoFixture
{
private const int MINIMUM_LIFESPAN_YEAR = 1900;
private const int MAXIMUM_LIFESPAN_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly MusicAreaDtoFixture _musicAreaDtoFixture = new();
private readonly MusicArtistAliasDtoFixture _musicArtistAliasDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicArtistMetadataDto"/>.
/// </summary>
/// <param name="name">Optional. The name of the artist.</param>
/// <param name="sortName">Optional. The sort name of the artist.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the artist.</param>
/// <param name="type">Optional. The type of the artist.</param>
/// <param name="gender">Optional. The gender of the artist.</param>
/// <param name="country">Optional. The ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">Optional. The area the artist is primarily identified with.</param>
/// <param name="beginArea">Optional. The area the artist began in.</param>
/// <param name="endArea">Optional. The area the artist ended in.</param>
/// <param name="lifeSpanBegin">Optional. The date the artist started existing.</param>
/// <param name="lifeSpanEnd">Optional. The date the artist stopped existing.</param>
/// <param name="isEnded">Optional. Whether the artist no longer exists.</param>
/// <param name="genres">Optional. The genres associated with the artist.</param>
/// <param name="tags">Optional. The tags that describe or categorize the artist.</param>
/// <param name="aliases">Optional. The alternative names of the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSortName">Whether the sort name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGender">Whether the gender should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeCountry">Whether the country should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeArea">Whether the area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeBeginArea">Whether the begin area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeEndArea">Whether the end area should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanBegin">Whether the lifespan begin should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLifeSpanEnd">Whether the lifespan end should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAliases">Whether the aliases should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicArtistMetadataDto"/>.</returns>
public MusicArtistMetadataDto Create(
string? name = null,
string? sortName = null,
string? disambiguation = null,
MusicArtistType? type = null,
MusicArtistGender? gender = null,
string? country = null,
MusicAreaDto? area = null,
MusicAreaDto? beginArea = null,
MusicAreaDto? endArea = null,
DateOnly? lifeSpanBegin = null,
DateOnly? lifeSpanEnd = null,
bool? isEnded = null,
List<GenreDto>? genres = null,
List<TagDto>? tags = null,
List<MusicArtistAliasDto>? aliases = null,
bool includeName = true,
bool includeSortName = true,
bool includeDisambiguation = true,
bool includeType = true,
bool includeGender = true,
bool includeCountry = true,
bool includeArea = true,
bool includeBeginArea = true,
bool includeEndArea = true,
bool includeLifeSpanBegin = true,
bool includeLifeSpanEnd = true,
bool includeGenres = true,
bool includeTags = true,
bool includeAliases = true)
{
int lifeSpanBeginYear = Random.Shared.Next(MINIMUM_LIFESPAN_YEAR, MAXIMUM_LIFESPAN_YEAR);
int lifeSpanEndYear = Random.Shared.Next(lifeSpanBeginYear, Math.Max(lifeSpanBeginYear + 1, MAXIMUM_LIFESPAN_YEAR));
return new MusicArtistMetadataDto(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeSortName ? (sortName ?? _faker.Name.FullName()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeType ? (type ?? _faker.PickRandom<MusicArtistType>()) : null,
includeGender ? (gender ?? _faker.PickRandom<MusicArtistGender>()) : null,
includeCountry ? (country ?? _faker.Address.CountryCode()) : null,
includeArea ? (area ?? _musicAreaDtoFixture.Create()) : null,
includeBeginArea ? (beginArea ?? _musicAreaDtoFixture.Create()) : null,
includeEndArea ? (endArea ?? _musicAreaDtoFixture.Create()) : null,
includeLifeSpanBegin ? (lifeSpanBegin ?? new DateOnly(lifeSpanBeginYear, 1, 1)) : null,
includeLifeSpanEnd ? (lifeSpanEnd ?? new DateOnly(lifeSpanEndYear, 1, 1)) : null,
isEnded ?? _faker.Random.Bool(),
includeGenres ? (genres ?? _genreDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeTags ? (tags ?? _tagDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeAliases ? (aliases ?? _musicArtistAliasDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicArtistMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicArtistMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -0,0 +1,182 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicTrackMetadataDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicTrackMetadataDtoFixture
{
private const int MINIMUM_RELEASE_YEAR = 1900;
private const int MAXIMUM_RELEASE_YEAR = 2026;
private readonly Faker _faker = new();
private readonly GenreDtoFixture _genreDtoFixture = new();
private readonly TagDtoFixture _tagDtoFixture = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
private readonly ReleaseInfoDtoFixture _releaseInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicTrackMetadataDto"/>.
/// </summary>
/// <param name="title">Optional. The title of the track.</param>
/// <param name="originalTitle">Optional. The original title of the track.</param>
/// <param name="description">Optional. A brief description or summary of the track.</param>
/// <param name="disambiguation">Optional. The disambiguation comment of the track.</param>
/// <param name="releaseInfo">Optional. The release information of the track.</param>
/// <param name="language">Optional. The language of the track.</param>
/// <param name="originalLanguage">Optional. The original language of the track.</param>
/// <param name="tags">Optional. The tags that describe or categorize the track.</param>
/// <param name="genres">Optional. The genres associated with the track.</param>
/// <param name="isVideo">Optional. Whether the recording of the track is a video recording.</param>
/// <param name="durationInSeconds">Optional. The duration of the track, in seconds.</param>
/// <param name="sampleRate">Optional. The sample rate of the track, in Hz.</param>
/// <param name="channels">Optional. The number of audio channels.</param>
/// <param name="bitDepth">Optional. The bit depth of the track.</param>
/// <param name="audioCodec">Optional. The audio codec used.</param>
/// <param name="bitrate">Optional. The bitrate of the track, in kbps.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalTitle">Whether the original title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDescription">Whether the description should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDisambiguation">Whether the disambiguation should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeReleaseInfo">Whether the release information should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguage">Whether the language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeOriginalLanguage">Whether the original language should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTags">Whether the tags should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeGenres">Whether the genres should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeDurationInSeconds">Whether the duration should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeSampleRate">Whether the sample rate should be included, or forced to <see langword="null"/>.</param>
/// <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="includeBitrate">Whether the bitrate should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicTrackMetadataDto"/>.</returns>
public MusicTrackMetadataDto Create(
string? title = null,
string? originalTitle = null,
string? description = null,
string? disambiguation = null,
ReleaseInfoDto? releaseInfo = null,
LanguageInfoDto? language = null,
LanguageInfoDto? originalLanguage = null,
List<TagDto>? tags = null,
List<GenreDto>? genres = null,
bool? isVideo = null,
int? durationInSeconds = null,
int? sampleRate = null,
int? channels = null,
int? bitDepth = null,
string? audioCodec = null,
int? bitrate = null,
bool includeTitle = true,
bool includeOriginalTitle = true,
bool includeDescription = true,
bool includeDisambiguation = true,
bool includeReleaseInfo = true,
bool includeLanguage = true,
bool includeOriginalLanguage = true,
bool includeTags = true,
bool includeGenres = true,
bool includeDurationInSeconds = true,
bool includeSampleRate = true,
bool includeChannels = true,
bool includeBitDepth = true,
bool includeAudioCodec = true,
bool includeBitrate = true)
{
return new MusicTrackMetadataDto(
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeOriginalTitle ? (originalTitle ?? _faker.Music.Genre()) : null,
includeDescription ? (description ?? _faker.Lorem.Paragraph()) : null,
includeDisambiguation ? (disambiguation ?? _faker.Lorem.Sentence()) : null,
includeReleaseInfo ? (releaseInfo ?? GenerateReleaseInfo()) : null,
includeLanguage ? (language ?? _languageInfoDtoFixture.Create()) : null,
includeOriginalLanguage ? (originalLanguage ?? _languageInfoDtoFixture.Create()) : null,
includeTags ? (tags ?? GenerateDistinctTags()) : null,
includeGenres ? (genres ?? GenerateDistinctGenres()) : null,
isVideo ?? _faker.Random.Bool(),
includeDurationInSeconds ? (durationInSeconds ?? _faker.Random.Int(60, 7200)) : null,
includeSampleRate ? (sampleRate ?? _faker.Random.Int(8000, 192000)) : null,
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,
includeBitrate ? (bitrate ?? _faker.Random.Int(96, 1411)) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicTrackMetadataDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicTrackMetadataDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a random valid <see cref="ReleaseInfoDto"/> with consistent dates and years.
/// </summary>
/// <returns>The created <see cref="ReleaseInfoDto"/>.</returns>
private ReleaseInfoDto GenerateReleaseInfo()
{
int originalReleaseYear = Random.Shared.Next(MINIMUM_RELEASE_YEAR, MAXIMUM_RELEASE_YEAR);
int reReleaseYear = Random.Shared.Next(originalReleaseYear, MAXIMUM_RELEASE_YEAR);
return _releaseInfoDtoFixture.Create(
originalReleaseDate: new DateOnly(originalReleaseYear, 1, 1),
originalReleaseYear: originalReleaseYear,
reReleaseDate: new DateOnly(reReleaseYear, 1, 1),
reReleaseYear: reReleaseYear,
releaseCountry: _faker.PickRandom<ReleaseCountry>(),
releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50)));
}
/// <summary>
/// Creates two genres with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created genres.</returns>
private List<GenreDto> GenerateDistinctGenres()
{
return
[
_genreDtoFixture.Create(name: CreateUniqueName()),
_genreDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates two tags with distinct names, so that the storage deduplication never collapses them into one.
/// </summary>
/// <returns>The created tags.</returns>
private List<TagDto> GenerateDistinctTags()
{
return
[
_tagDtoFixture.Create(name: CreateUniqueName()),
_tagDtoFixture.Create(name: CreateUniqueName())
];
}
/// <summary>
/// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication.
/// </summary>
/// <returns>A unique name of at most 50 characters.</returns>
private string CreateUniqueName()
{
string uniqueSuffix = Guid.NewGuid().ToString("N")[..12];
int maximumWordLength = 50 - uniqueSuffix.Length - 1;
string word = _faker.Lorem.Word();
string truncatedWord = word.Length > maximumWordLength ? word[..maximumWordLength] : word;
return $"{truncatedWord}-{uniqueSuffix}";
}
}
@@ -0,0 +1,75 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.Common;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Contracts.Fixtures.Core.DTO.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="MusicWorkDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class MusicWorkDtoFixture
{
private readonly Faker _faker = new();
private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new();
/// <summary>
/// Creates a random valid <see cref="MusicWorkDto"/>.
/// </summary>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
/// <param name="title">Optional. The title of the work.</param>
/// <param name="type">Optional. The MusicBrainz type of the work.</param>
/// <param name="languages">Optional. The list of languages of the work.</param>
/// <param name="iswcs">Optional. The list of ISWC of the work.</param>
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTitle">Whether the title should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeType">Whether the type should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeLanguages">Whether the languages should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIswcs">Whether the ISWCs should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created <see cref="MusicWorkDto"/>.</returns>
public MusicWorkDto Create(
Guid? musicBrainzWorkId = null,
string? title = null,
string? type = null,
List<LanguageInfoDto>? languages = null,
List<string>? iswcs = null,
bool includeMusicBrainzWorkId = true,
bool includeTitle = true,
bool includeType = true,
bool includeLanguages = true,
bool includeIswcs = true)
{
return new MusicWorkDto(
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
includeTitle ? (title ?? _faker.Music.Genre()) : null,
includeType ? (type ?? _faker.Random.ArrayElement(["Song", "Instrumental"])) : null,
includeLanguages ? (languages ?? _languageInfoDtoFixture.CreateMany(_faker.Random.Int(1, 2))) : null,
includeIswcs ? (iswcs ?? GenerateIswcs()) : null);
}
/// <summary>
/// Creates a list of <see cref="MusicWorkDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<MusicWorkDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
/// <summary>
/// Creates a list of random ISWC codes.
/// </summary>
/// <returns>The generated ISWC codes.</returns>
private List<string> GenerateIswcs()
{
return [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => $"T{_faker.Random.AlphaNumeric(10)}")];
}
}
@@ -0,0 +1,77 @@
#region ========================================================================= USING =====================================================================================
using Bogus;
using Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Fixture class for the <see cref="TrackMetadataLookupDto"/> record.
/// </summary>
[ExcludeFromCodeCoverage]
public class TrackMetadataLookupDtoFixture
{
private readonly Faker _faker = new();
/// <summary>
/// Creates a random valid <see cref="TrackMetadataLookupDto"/>.
/// </summary>
/// <param name="libraryId">Optional. The Id of the media library the track belongs to.</param>
/// <param name="path">Optional. The file system path of the track.</param>
/// <param name="musicBrainzRecordingId">Optional. The MusicBrainz identifier of the recording of the track.</param>
/// <param name="isrc">Optional. The ISRC of the track.</param>
/// <param name="title">Optional. The title of the track.</param>
/// <param name="artistName">Optional. The name of the artist of the track.</param>
/// <param name="releaseName">Optional. The name of the release the track belongs to.</param>
/// <param name="trackNumber">Optional. The number of the track on its disc.</param>
/// <param name="durationInSeconds">Optional. The duration of the track in seconds.</param>
/// <param name="musicBrainzReleaseId">Optional. The MusicBrainz identifier of the release the track belongs to.</param>
/// <param name="discNumber">Optional. The number of the disc the track belongs to.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work the track is a recording of.</param>
/// <param name="workTitle">Optional. The title of the work the track is a recording of.</param>
/// <returns>The created <see cref="TrackMetadataLookupDto"/>.</returns>
public TrackMetadataLookupDto Create(
Guid? libraryId = null,
string? path = null,
Guid? musicBrainzRecordingId = null,
string? isrc = null,
string? title = null,
string? artistName = null,
string? releaseName = null,
int? trackNumber = null,
int? durationInSeconds = null,
Guid? musicBrainzReleaseId = null,
int? discNumber = null,
Guid? musicBrainzWorkId = null,
string? workTitle = null)
{
return new TrackMetadataLookupDto(
libraryId ?? Guid.NewGuid(),
path ?? _faker.System.FilePath(),
musicBrainzRecordingId,
isrc,
title,
artistName,
releaseName,
trackNumber,
durationInSeconds,
musicBrainzReleaseId,
discNumber,
musicBrainzWorkId,
workTitle);
}
/// <summary>
/// Creates a list of <see cref="TrackMetadataLookupDto"/>.
/// </summary>
/// <param name="count">The number of elements to create.</param>
/// <returns>The created list.</returns>
public List<TrackMetadataLookupDto> CreateMany(int count = 3)
{
return [.. Enumerable.Range(0, count).Select(_ => Create())];
}
}
@@ -25,7 +25,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class AddAlbumRequestFixture
{
private readonly Faker _faker = new();
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
private readonly AddTrackRequestFixture _addTrackRequestFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
@@ -35,8 +35,11 @@ public class AddAlbumRequestFixture
/// </summary>
/// <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>
@@ -48,17 +51,23 @@ public class AddAlbumRequestFixture
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeTracks">Whether the tracks list should be included, or forced to <see langword="null"/>.</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>
/// <returns>The created request to add an album.</returns>
public AddAlbumRequest Create(
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,
@@ -70,17 +79,23 @@ public class AddAlbumRequestFixture
bool includeRatings = true,
bool includeTracks = true,
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)
{
return new AddAlbumRequest(
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
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 ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : null,
@@ -23,7 +23,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class UpdateAlbumRequestFixture
{
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();
@@ -32,8 +32,11 @@ public class UpdateAlbumRequestFixture
/// </summary>
/// <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>
@@ -43,17 +46,23 @@ public class UpdateAlbumRequestFixture
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</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>
/// <returns>The created request to update an album.</returns>
public UpdateAlbumRequest Create(
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,
@@ -63,17 +72,23 @@ public class UpdateAlbumRequestFixture
bool includeContributors = true,
bool includeRatings = true,
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)
{
return new UpdateAlbumRequest(
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
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 ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : 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.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
@@ -20,40 +24,57 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class AddArtistRequestFixture
{
private readonly Faker _faker = new();
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
private readonly AddAlbumRequestFixture _addAlbumRequestFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid request to add an artist.
/// </summary>
/// <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 media contributors that make up the artist.</param>
/// <param name="ratings">Optional. The ratings of the artist.</param>
/// <param name="albums">Optional. The albums of the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</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="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbums">Whether the albums list should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created request to add an artist.</returns>
public AddArtistRequest Create(
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<AddAlbumRequest>? albums = null,
bool includeName = true,
bool includeMetadata = true,
bool includeWebsite = true,
bool includeMusicBrainzArtistId = true,
bool includeIpis = true,
bool includeIsnis = true,
bool includeContributors = true,
bool includeRatings = true,
bool includeAlbums = true)
{
return new AddArtistRequest(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : 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,
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeAlbums ? (albums ?? _addAlbumRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
@@ -6,7 +6,6 @@ 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.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
@@ -24,7 +23,7 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class UpdateArtistAlbumRequestFixture
{
private readonly Faker _faker = new();
private readonly AlbumMetadataDtoFixture _albumMetadataDtoFixture = new();
private readonly MusicAlbumMetadataDtoFixture _musicAlbumMetadataDtoFixture = new();
private readonly UpdateArtistTrackRequestFixture _updateArtistTrackRequestFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
@@ -35,8 +34,11 @@ public class UpdateArtistAlbumRequestFixture
/// <param name="albumId">Optional. The Id of the album, when the album already exists.</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>
@@ -46,8 +48,11 @@ public class UpdateArtistAlbumRequestFixture
/// <param name="includeAlbumId">Whether the album Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</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>
@@ -57,10 +62,13 @@ public class UpdateArtistAlbumRequestFixture
/// <returns>The created request to update an album of an artist.</returns>
public UpdateArtistAlbumRequest Create(
Guid? albumId = 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,
@@ -70,8 +78,11 @@ public class UpdateArtistAlbumRequestFixture
bool includeAlbumId = true,
bool includeMetadata = true,
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,
@@ -81,10 +92,13 @@ public class UpdateArtistAlbumRequestFixture
{
return new UpdateArtistAlbumRequest(
includeAlbumId ? (albumId ?? _faker.Random.Guid()) : null,
includeMetadata ? (metadata ?? _albumMetadataDtoFixture.Create()) : null,
includeMetadata ? (metadata ?? _musicAlbumMetadataDtoFixture.Create()) : null,
includeMediaFormat ? (mediaFormat ?? _faker.PickRandom<MusicMediaFormat>()) : null,
includePackaging ? (packaging ?? _faker.PickRandom<MusicReleasePackaging>()) : null,
includeBarcode ? (barcode ?? _faker.Random.String2(13, "0123456789")) : null,
includeCatalogNumber ? (catalogNumber ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
includeCatalogNumbers ? (catalogNumbers ?? [_faker.Random.String2(_faker.Random.Number(1, 50))]) : null,
includeLabel ? (label ?? _faker.Company.CompanyName()) : null,
includeAsin ? (asin ?? _faker.Random.AlphaNumeric(10)) : null,
includeMusicBrainzReleaseId ? (musicBrainzReleaseId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseGroupId ? (musicBrainzReleaseGroupId ?? _faker.Random.Guid()) : null,
includeMusicBrainzReleaseArtistId ? (musicBrainzReleaseArtistId ?? _faker.Random.Guid()) : 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.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
using System;
using System.Collections.Generic;
@@ -18,40 +22,57 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class UpdateArtistRequestFixture
{
private readonly Faker _faker = new();
private readonly MusicArtistMetadataDtoFixture _musicArtistMetadataDtoFixture = new();
private readonly UpdateArtistAlbumRequestFixture _updateArtistAlbumRequestFixture = new();
private readonly MediaContributorReferenceDtoFixture _mediaContributorReferenceDtoFixture = new();
private readonly AudioRatingDtoFixture _audioRatingDtoFixture = new();
/// <summary>
/// Creates a random valid request to update an artist.
/// </summary>
/// <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 media contributors that make up the artist.</param>
/// <param name="ratings">Optional. The ratings of the artist.</param>
/// <param name="albums">Optional. The albums of the artist.</param>
/// <param name="includeName">Whether the name should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMetadata">Whether the metadata should be included, or forced to <see langword="null"/>.</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="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeRatings">Whether the ratings list should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeAlbums">Whether the albums list should be included, or forced to <see langword="null"/>.</param>
/// <returns>The created request to update an artist.</returns>
public UpdateArtistRequest Create(
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<UpdateArtistAlbumRequest>? albums = null,
bool includeName = true,
bool includeMetadata = true,
bool includeWebsite = true,
bool includeMusicBrainzArtistId = true,
bool includeIpis = true,
bool includeIsnis = true,
bool includeContributors = true,
bool includeRatings = true,
bool includeAlbums = true)
{
return new UpdateArtistRequest(
includeName ? (name ?? _faker.Name.FullName()) : null,
includeMetadata ? (metadata ?? _musicArtistMetadataDtoFixture.Create()) : null,
includeWebsite ? (website ?? _faker.Internet.Url()) : null,
includeMusicBrainzArtistId ? (musicBrainzArtistId ?? _faker.Random.Guid()) : 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,
includeContributors ? (contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeRatings ? (ratings ?? _audioRatingDtoFixture.CreateMany(_faker.Random.Int(1, 3))) : null,
includeAlbums ? (albums ?? _updateArtistAlbumRequestFixture.CreateMany(_faker.Random.Int(1, 3))) : null);
}
@@ -26,7 +26,8 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class UpdateArtistTrackRequestFixture
{
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();
@@ -43,10 +44,9 @@ public class UpdateArtistTrackRequestFixture
/// <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 identifier of the recording.</param>
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
/// <param name="moods">Optional. The moods of the track.</param>
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
@@ -62,7 +62,6 @@ public class UpdateArtistTrackRequestFixture
/// <param name="includeWork">Whether the work 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>
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
@@ -71,16 +70,15 @@ public class UpdateArtistTrackRequestFixture
public UpdateArtistTrackRequest Create(
Guid? trackId = 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,
List<MoodDto>? moods = null,
List<IsrcDto>? isrcs = null,
List<MediaContributorReferenceDto>? contributors = null,
@@ -96,7 +94,6 @@ public class UpdateArtistTrackRequestFixture
bool includeWork = true,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeMusicBrainzWorkId = true,
bool includeMoods = true,
bool includeIsrcs = true,
bool includeContributors = true,
@@ -105,16 +102,15 @@ public class UpdateArtistTrackRequestFixture
return new UpdateArtistTrackRequest(
includeTrackId ? (trackId ?? _faker.Random.Guid()) : null,
includePath ? (path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName())) : null,
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 30)) : null,
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
includeScript ? (script ?? _faker.Random.AlphaNumeric(4)) : null,
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
includeBpm ? (bpm ?? _faker.Random.Int(40, 220)) : null,
includeWork ? (work ?? _faker.Lorem.Sentence()) : null,
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
@@ -26,7 +26,8 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class AddTrackRequestFixture
{
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();
@@ -42,10 +43,9 @@ public class AddTrackRequestFixture
/// <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 identifier of the recording.</param>
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
/// <param name="moods">Optional. The list of moods of the track.</param>
/// <param name="isrcs">Optional. The list of ISRC of the track.</param>
/// <param name="contributors">Optional. The list of media contributors that performed on the track.</param>
@@ -60,7 +60,6 @@ public class AddTrackRequestFixture
/// <param name="includeWork">Whether the work 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>
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIsrcs">Whether the ISRC codes 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>
@@ -68,16 +67,15 @@ public class AddTrackRequestFixture
/// <returns>The created request to add a track.</returns>
public AddTrackRequest Create(
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,
List<MoodDto>? moods = null,
List<IsrcDto>? isrcs = null,
List<MediaContributorReferenceDto>? contributors = null,
@@ -92,7 +90,6 @@ public class AddTrackRequestFixture
bool includeWork = true,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeMusicBrainzWorkId = true,
bool includeMoods = true,
bool includeIsrcs = true,
bool includeContributors = true,
@@ -100,16 +97,15 @@ public class AddTrackRequestFixture
{
return new AddTrackRequest(
includePath ? path ?? Path.Combine(Path.GetTempPath(), "lumina-tracks", _faker.System.FileName()) : null,
includeMetadata ? metadata ?? _audioMetadataDtoFixture.Create() : null,
includeMetadata ? metadata ?? _musicTrackMetadataDtoFixture.Create() : null,
includeTrackNumber ? trackNumber ?? _faker.Random.Int(1, 30) : null,
includeDiscNumber ? discNumber ?? _faker.Random.Int(1, 3) : null,
includeScript ? script ?? _faker.Random.AlphaNumeric(4) : null,
includeKey ? key ?? _faker.PickRandom<MusicKey>() : null,
includeBpm ? bpm ?? _faker.Random.Int(40, 220) : null,
includeWork ? work ?? _faker.Lorem.Sentence() : null,
includeWork ? work ?? _musicWorkDtoFixture.Create() : null,
includeMusicBrainzRecordingId ? musicBrainzRecordingId ?? _faker.Random.Guid() : null,
includeMusicBrainzTrackId ? musicBrainzTrackId ?? _faker.Random.Guid() : null,
includeMusicBrainzWorkId ? musicBrainzWorkId ?? _faker.Random.Guid() : null,
includeMoods ? moods ?? _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
includeIsrcs ? isrcs ?? _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
includeContributors ? contributors ?? _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3)) : null,
@@ -25,7 +25,8 @@ namespace Lumina.Contracts.Fixtures.Core.Requests.MediaLibrary.AudioLibrary.Musi
public class UpdateTrackRequestFixture
{
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();
@@ -41,10 +42,9 @@ public class UpdateTrackRequestFixture
/// <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 identifier of the recording.</param>
/// <param name="musicBrainzTrackId">Optional. The MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">Optional. The MusicBrainz identifier of the work.</param>
/// <param name="moods">Optional. The moods of the track.</param>
/// <param name="isrcs">Optional. The ISRC codes of the track.</param>
/// <param name="contributors">Optional. The media contributors that performed on the track.</param>
@@ -56,7 +56,6 @@ public class UpdateTrackRequestFixture
/// <param name="includeWork">Whether the work 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>
/// <param name="includeMusicBrainzWorkId">Whether the MusicBrainz work Id should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeMoods">Whether the moods should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeIsrcs">Whether the ISRC codes should be included, or forced to <see langword="null"/>.</param>
/// <param name="includeContributors">Whether the contributors list should be included, or forced to <see langword="null"/>.</param>
@@ -67,16 +66,15 @@ public class UpdateTrackRequestFixture
/// <returns>The created request to update a track.</returns>
public UpdateTrackRequest Create(
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,
List<MoodDto>? moods = null,
List<IsrcDto>? isrcs = null,
List<MediaContributorReferenceDto>? contributors = null,
@@ -88,7 +86,6 @@ public class UpdateTrackRequestFixture
bool includeWork = true,
bool includeMusicBrainzRecordingId = true,
bool includeMusicBrainzTrackId = true,
bool includeMusicBrainzWorkId = true,
bool includeMoods = true,
bool includeIsrcs = true,
bool includeContributors = true,
@@ -99,16 +96,15 @@ public class UpdateTrackRequestFixture
{
return new UpdateTrackRequest(
includePath ? (path ?? _faker.System.FilePath()) : null,
includeMetadata ? (metadata ?? _audioMetadataDtoFixture.Create()) : null,
includeMetadata ? (metadata ?? _musicTrackMetadataDtoFixture.Create()) : null,
includeTrackNumber ? (trackNumber ?? _faker.Random.Int(1, 20)) : null,
includeDiscNumber ? (discNumber ?? _faker.Random.Int(1, 3)) : null,
includeScript ? (script ?? _faker.Random.String2(_faker.Random.Number(1, 50))) : null,
includeKey ? (key ?? _faker.PickRandom<MusicKey>()) : null,
includeBpm ? (bpm ?? _faker.Random.Int(40, 240)) : null,
includeWork ? (work ?? _faker.Music.Genre()) : null,
includeWork ? (work ?? _musicWorkDtoFixture.Create()) : null,
includeMusicBrainzRecordingId ? (musicBrainzRecordingId ?? _faker.Random.Guid()) : null,
includeMusicBrainzTrackId ? (musicBrainzTrackId ?? _faker.Random.Guid()) : null,
includeMusicBrainzWorkId ? (musicBrainzWorkId ?? _faker.Random.Guid()) : null,
includeMoods ? (moods ?? [.. _moodDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
includeIsrcs ? (isrcs ?? [.. _isrcDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
includeContributors ? (contributors ?? [.. _mediaContributorReferenceDtoFixture.CreateMany(_faker.Random.Int(1, 3))]) : null,
@@ -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),