diff --git a/src/Lumina.Contracts/DTO/Common/ArtworkDto.cs b/src/Lumina.Contracts/DTO/Common/ArtworkDto.cs index 725576a6..55d9cf11 100644 --- a/src/Lumina.Contracts/DTO/Common/ArtworkDto.cs +++ b/src/Lumina.Contracts/DTO/Common/ArtworkDto.cs @@ -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; /// /// Data transfer object for the artwork of a media item, provided by an artwork provider. /// +/// The type of the artwork, like the cover or the back of the media item. +/// The ordinal of the artwork within its type, so that multiple artworks of the same type can be ordered. /// The local file system path of the artwork, when the artwork is a local file. /// The remote URL of the artwork, when the artwork is fetched over the web. -[DebuggerDisplay("LocalPath: {LocalPath}, RemoteUrl: {RemoteUrl}")] +/// Whether a local artwork is a temporary file produced by the provider, which is deleted after the artwork is stored. +[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 ); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDto.cs index 3510ef65..7c77da46 100644 --- a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDto.cs +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDto.cs @@ -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; /// -/// Data transfer object for the metadata of an album. +/// Data transfer object for the metadata of an album, returned by a metadata provider. /// /// The title of the album. Required. /// The original title of the album, if different from the current title. Optional. /// A brief description or summary of the album. Optional. +/// The disambiguation comment of the album, used to distinguish albums with the same title. Optional. /// The release information, including release date and other relevant details. Required. /// The language of the album. Optional. /// The original language of the album, if it has been translated. Optional. /// The list of tags that further describe or categorize the album. Required. /// The list of genres associated with the album. Required. -/// The type of the release. Optional. +/// The script used by the language of the release of the album. Optional. +/// The set of types of the release. Optional. /// The status of the release. Optional. +/// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. /// The number of discs of the release. Optional. /// The number of tracks of the release. Required. +/// The barcode of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. +/// The MusicBrainz identifier of the release. Optional. +/// The MusicBrainz identifier of the release group. Optional. +/// The MusicBrainz identifier of the release artist. Optional. +/// The list of media contributors that performed on the album, each with the role they played. Required. +/// The list of ratings for the album. Required. +/// The title of the specific release (edition) the album files match, if different from the release group title. Optional. [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? Tags, List? Genres, - MusicReleaseType? ReleaseType, + string? Script, + List? ReleaseTypes, MusicReleaseStatus? ReleaseStatus, + MusicMediaFormat? MediaFormat, + MusicReleasePackaging? Packaging, int? TotalDiscs, - int? TotalTracks -); + int? TotalTracks, + string? Barcode, + List? CatalogNumbers, + string? Label, + string? ASIN, + Guid? MusicBrainzReleaseId, + Guid? MusicBrainzReleaseGroupId, + Guid? MusicBrainzReleaseArtistId, + List? Contributors, + List? Ratings, + string? ReleaseTitle = null +) : MetadataDto; diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDto.cs new file mode 100644 index 00000000..d226c02c --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDto.cs @@ -0,0 +1,30 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Contracts.DTO.Common; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for an album metadata lookup. +/// +/// The Id of the media library the album belongs to. +/// The file system path of a track of the album. +/// The MusicBrainz identifier of the release group of the album, if applicable. +/// The MusicBrainz identifier of the release of the album, if applicable. +/// The title of the album, if applicable. +/// The name of the artist of the album, if applicable. +/// The year the album was released, if applicable. +/// The number of tracks the local album has, if applicable. It is used to select a release whose tracklist matches the local files. +[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; diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDto.cs new file mode 100644 index 00000000..cdd1b319 --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDto.cs @@ -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; + +/// +/// Data transfer object for the metadata of a music artist. +/// +/// The name of the artist. +/// The sort name of the artist, a variant of the name used when sorting artists, if applicable. +/// The disambiguation comment of the artist, used to distinguish artists with the same name, if applicable. +/// The type of the artist, if applicable. +/// The gender of the artist, applicable only to artists that are persons or characters, if applicable. +/// The ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable. +/// The area the artist is primarily identified with, if applicable. +/// The area the artist began in, if applicable. +/// The area the artist ended in, if applicable. +/// The date the artist started existing, if applicable. +/// The date the artist stopped existing, if applicable. +/// Whether the artist no longer exists. +/// The website of the artist, if applicable. +/// The MusicBrainz identifier of the artist, if applicable. +/// The list of IPI (Interested Party Information) codes of the artist. +/// The list of ISNI (International Standard Name Identifier) codes of the artist. +/// The list of alternative names of the artist. +/// The list of genres associated with the artist. +/// The list of tags that further describe or categorize the artist. +/// The list of ratings for the artist. +/// The list of media contributors that make up the artist, each with the role they played. +[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? Ipis, + List? Isnis, + List? Aliases, + List? Genres, + List? Tags, + List? Ratings, + List? Contributors +) : MetadataDto; diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDto.cs new file mode 100644 index 00000000..2c8321c6 --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDto.cs @@ -0,0 +1,22 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Contracts.DTO.Common; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a music artist metadata lookup. +/// +/// The Id of the media library the artist belongs to. +/// The file system path of a track of the artist. +/// The MusicBrainz identifier of the artist, if applicable. +/// The name of the artist, if applicable. +[DebuggerDisplay("Name: {Name}")] +public sealed record ArtistMetadataLookupDto( + Guid LibraryId, + string Path, + Guid? MusicBrainzArtistId = null, + string? Name = null +) : MetadataLookupDto; diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDto.cs index 5fa4deee..35114938 100644 --- a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDto.cs +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDto.cs @@ -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; /// -/// 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. /// /// The title of the track. Required. /// The original title of the track, if different from the current title. Optional. /// A brief description or summary of the track. Optional. +/// The disambiguation comment of the track, used to distinguish tracks with the same title. Optional. /// The release information, including release date and other relevant details. Required. /// The language of the track. Optional. /// The original language of the track, if it has been translated. Optional. /// The list of tags that further describe or categorize the track. Required. /// The list of genres associated with the track. Required. +/// The script used by the language of the track. Optional. +/// The musical key of the track. Optional. +/// The tempo of the track in beats per minute. Optional. +/// Whether the recording of the track is a video recording. +/// The work the track is a recording of, if applicable. Optional. +/// The list of ISRC (International Standard Recording Code) of the track. Optional. +/// The list of moods of the track. Optional. /// The duration of the audio of the track in seconds. Required. /// The sample rate of the audio of the track in Hz. Required. /// The number of audio channels of the track. Required. /// The bit depth of the audio of the track. Optional. /// The audio codec used by the track. Optional. /// The bitrate of the audio of the track in kbps. Optional. +/// The MusicBrainz identifier of the recording. Optional. +/// The MusicBrainz identifier of the track. Optional. +/// The list of media contributors that performed on the track, each with the role they played. Required. +/// The list of ratings for the track. Required. [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? Tags, List? Genres, + string? Script, + MusicKey? Key, + int? Bpm, + bool IsVideo, + MusicWorkDto? Work, + List? Isrcs, + List? Moods, int? DurationInSeconds, int? SampleRate, int? Channels, int? BitDepth, string? AudioCodec, - int? Bitrate -); + int? Bitrate, + Guid? MusicBrainzRecordingId, + Guid? MusicBrainzTrackId, + List? Contributors, + List? Ratings +) : MetadataDto; diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs new file mode 100644 index 00000000..40b9e138 --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDto.cs @@ -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; + +/// +/// Data transfer object for the metadata of an album, as used by the API. +/// +/// +/// The identifiers, the contributors and the ratings of the album are kept alongside this object, as siblings, rather than inside it. +/// +/// The title of the album. Required. +/// The original title of the album, if different from the current title. Optional. +/// A brief description or summary of the album. Optional. +/// The disambiguation comment of the album, used to distinguish albums with the same title. Optional. +/// The release information, including release date and other relevant details. Required. +/// The language of the album. Optional. +/// The original language of the album, if it has been translated. Optional. +/// The list of tags that further describe or categorize the album. Required. +/// The list of genres associated with the album. Required. +/// The script used by the language of the release of the album. Optional. +/// The set of types of the release. Optional. +/// The status of the release. Optional. +/// The number of discs of the release. Optional. +/// The number of tracks of the release. Required. +/// The title of the specific release (edition) the album files match, if different from the release group title. Optional. +[DebuggerDisplay("Title: {Title}")] +public record MusicAlbumMetadataDto( + string? Title, + string? OriginalTitle, + string? Description, + string? Disambiguation, + ReleaseInfoDto? ReleaseInfo, + LanguageInfoDto? Language, + LanguageInfoDto? OriginalLanguage, + List? Tags, + List? Genres, + string? Script, + List? ReleaseTypes, + MusicReleaseStatus? ReleaseStatus, + int? TotalDiscs, + int? TotalTracks, + string? ReleaseTitle = null +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDto.cs new file mode 100644 index 00000000..261ce850 --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDto.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a MusicBrainz area, the geographic area a music artist is associated with. +/// +/// The MusicBrainz identifier of the area. +/// The name of the area. +/// The sort name of the area, if applicable. +/// The disambiguation comment of the area, if applicable. +/// The MusicBrainz type of the area, if applicable. +/// The ISO 3166 code of the area, if applicable. +[DebuggerDisplay("Name: {Name}")] +public sealed record MusicAreaDto( + Guid? MusicBrainzAreaId, + string? Name, + string? SortName, + string? Disambiguation, + string? Type, + string? Iso3166Code +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs new file mode 100644 index 00000000..7777686d --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDto.cs @@ -0,0 +1,29 @@ +#region ========================================================================= USING ===================================================================================== +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for an alternative name of a music artist. +/// +/// The name of the alias. +/// The sort name of the alias, if applicable. +/// The type of the alias, if applicable. +/// The locale the alias is used in, if applicable. +/// Whether this is the primary alias of the artist. +/// The date the alias began being used, if applicable. +/// The date the alias stopped being used, if applicable. +/// Whether the alias is no longer used. +[DebuggerDisplay("Name: {Name}")] +public sealed record MusicArtistAliasDto( + string? Name, + string? SortName, + string? Type, + string? Locale, + bool IsPrimary, + DateOnly? BeginDate, + DateOnly? EndDate, + bool IsEnded +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs new file mode 100644 index 00000000..d271094c --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDto.cs @@ -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; + +/// +/// Data transfer object for the metadata of a music artist, as used by the API. +/// +/// +/// The identifiers, the contributors and the ratings of the artist are kept alongside this object, as siblings, rather than inside it. +/// +/// The name of the artist. +/// The sort name of the artist, a variant of the name used when sorting artists, if applicable. +/// The disambiguation comment of the artist, used to distinguish artists with the same name, if applicable. +/// The type of the artist, if applicable. +/// The gender of the artist, applicable only to artists that are persons or characters, if applicable. +/// The ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable. +/// The area the artist is primarily identified with, if applicable. +/// The area the artist began in, if applicable. +/// The area the artist ended in, if applicable. +/// The date the artist started existing, if applicable. +/// The date the artist stopped existing, if applicable. +/// Whether the artist no longer exists. +/// The list of genres associated with the artist. +/// The list of tags that further describe or categorize the artist. +/// The list of alternative names of the artist. +[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? Genres, + List? Tags, + List? Aliases +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs new file mode 100644 index 00000000..cb088a29 --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDto.cs @@ -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; + +/// +/// Data transfer object for the audio metadata of a track, as used by the API. +/// +/// +/// The identifiers, the contributors and the ratings of the track are kept alongside this object, as siblings, rather than inside it. +/// +/// The title of the track. Required. +/// The original title of the track, if different from the current title. Optional. +/// A brief description or summary of the track. Optional. +/// The disambiguation comment of the track, used to distinguish tracks with the same title. Optional. +/// The release information, including release date and other relevant details. Required. +/// The language of the track. Optional. +/// The original language of the track, if it has been translated. Optional. +/// The list of tags that further describe or categorize the track. Required. +/// The list of genres associated with the track. Required. +/// Whether the recording of the track is a video recording. +/// The duration of the audio of the track in seconds. Required. +/// The sample rate of the audio of the track in Hz. Required. +/// The number of audio channels of the track. Required. +/// The bit depth of the audio of the track. Optional. +/// The audio codec used by the track. Optional. +/// The bitrate of the audio of the track in kbps. Optional. +/// The AcoustID fingerprint identifier of the audio file of the track. Optional. +/// The ReplayGain track gain of the track in decibels. Optional. +/// The ReplayGain track peak of the track. Optional. +/// The ReplayGain album gain of the track in decibels. Optional. +/// The ReplayGain album peak of the track. Optional. +[DebuggerDisplay("Title: {Title}")] +public record MusicTrackMetadataDto( + string? Title, + string? OriginalTitle, + string? Description, + string? Disambiguation, + ReleaseInfoDto? ReleaseInfo, + LanguageInfoDto? Language, + LanguageInfoDto? OriginalLanguage, + List? Tags, + List? 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 +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDto.cs new file mode 100644 index 00000000..cf48182b --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDto.cs @@ -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; + +/// +/// Data transfer object for a MusicBrainz work, the musical composition a track is a recording of. +/// +/// +/// The contributors credited on the work are carried by the contributors of the metadata of the track. +/// +/// The MusicBrainz identifier of the work. +/// The title of the work. +/// The MusicBrainz type of the work, if applicable. +/// The list of languages of the work. +/// The list of ISWC (International Standard Musical Work Code) of the work. +[DebuggerDisplay("Title: {Title}")] +public sealed record MusicWorkDto( + Guid? MusicBrainzWorkId, + string? Title, + string? Type, + List? Languages, + List? Iswcs +); diff --git a/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDto.cs b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDto.cs new file mode 100644 index 00000000..f792fb6d --- /dev/null +++ b/src/Lumina.Contracts/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDto.cs @@ -0,0 +1,40 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Contracts.DTO.Common; +using System; +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.DTO.MediaLibrary.AudioLibrary.MusicLibrary; + +/// +/// Data transfer object for a track metadata lookup. +/// +/// The Id of the media library the track belongs to. +/// The file system path of the track. +/// The MusicBrainz identifier of the recording of the track, if applicable. +/// The ISRC (International Standard Recording Code) of the track, if applicable. +/// The title of the track, if applicable. +/// The name of the artist of the track, if applicable. +/// The name of the release the track belongs to, if applicable. +/// The number of the track on its disc, if applicable. +/// The duration of the track in seconds, if applicable. +/// The MusicBrainz identifier of the release the track belongs to, if applicable. +/// The number of the disc the track belongs to, if applicable. +/// 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. +/// 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. +[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; diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequest.cs index e082c21a..cac68de1 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequest.cs @@ -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 /// /// The album metadata of the album. Required. /// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. /// The barcode of the album. Optional. -/// The catalog number of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. /// The MusicBrainz identifier of the release. Optional. /// The MusicBrainz identifier of the release group. Optional. /// The MusicBrainz identifier of the release artist. Optional. @@ -27,10 +29,13 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album /// The list of tracks of the album. Required. [DebuggerDisplay("Title: {Metadata.Title}")] public record AddAlbumRequest( - AlbumMetadataDto? Metadata, + MusicAlbumMetadataDto? Metadata, MusicMediaFormat? MediaFormat, + MusicReleasePackaging? Packaging, string? Barcode, - string? CatalogNumber, + List? CatalogNumbers, + string? Label, + string? ASIN, Guid? MusicBrainzReleaseId, Guid? MusicBrainzReleaseGroupId, Guid? MusicBrainzReleaseArtistId, diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequest.cs index c7c95a70..b79b4816 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequest.cs @@ -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 /// /// The album metadata of the album. Required. /// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. /// The barcode of the album. Optional. -/// The catalog number of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. /// The MusicBrainz identifier of the release. Optional. /// The MusicBrainz identifier of the release group. Optional. /// The MusicBrainz identifier of the release artist. Optional. @@ -25,10 +27,13 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Album /// The list of ratings for this album. Required. [DebuggerDisplay("Title: {Metadata.Title}")] public record UpdateAlbumRequest( - AlbumMetadataDto? Metadata, + MusicAlbumMetadataDto? Metadata, MusicMediaFormat? MediaFormat, + MusicReleasePackaging? Packaging, string? Barcode, - string? CatalogNumber, + List? CatalogNumbers, + string? Label, + string? ASIN, Guid? MusicBrainzReleaseId, Guid? MusicBrainzReleaseGroupId, Guid? MusicBrainzReleaseArtistId, diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequest.cs index 53d76617..a7c32666 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequest.cs @@ -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 /// /// Represents a request to add an artist, together with the albums of the artist and the tracks of those albums. /// -/// The name of the artist. Required. +/// The metadata of the artist. Required. /// The website of the artist. Optional. /// The MusicBrainz identifier of the artist. Optional. +/// The list of IPI (Interested Party Information) codes of the artist. Optional. +/// The list of ISNI (International Standard Name Identifier) codes of the artist. Optional. /// The list of media contributors that make up the artist. Required. +/// The list of ratings for the artist. Required. /// The list of albums of the artist, each with its own list of tracks. Required. -[DebuggerDisplay("Name: {Name}")] +[DebuggerDisplay("Name: {Metadata.Name}")] public record AddArtistRequest( - string? Name, + MusicArtistMetadataDto? Metadata, string? Website, Guid? MusicBrainzArtistId, + List? Ipis, + List? Isnis, List? Contributors, + List? Ratings, List? Albums ); diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequest.cs index 8e3b02ba..6a5cbed3 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequest.cs @@ -16,8 +16,11 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis /// The Id of the album, when the album already exists. Optional. /// The album metadata of the album. Required. /// The physical or digital medium of the album. Optional. +/// The outermost physical packaging of the album. Optional. /// The barcode of the album. Optional. -/// The catalog number of the album. Optional. +/// The catalog numbers of the album. Optional. +/// The name of the label that issued the album. Optional. +/// The ASIN (Amazon Standard Identification Number) of the album. Optional. /// The MusicBrainz identifier of the release. Optional. /// The MusicBrainz identifier of the release group. Optional. /// The MusicBrainz identifier of the release artist. Optional. @@ -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? CatalogNumbers, + string? Label, + string? ASIN, Guid? MusicBrainzReleaseId, Guid? MusicBrainzReleaseGroupId, Guid? MusicBrainzReleaseArtistId, diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequest.cs index a300c302..12c0acf9 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequest.cs @@ -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 /// /// Represents a request to update an existing artist. /// -/// The name of the artist. Required. +/// The metadata of the artist. Required. /// The website of the artist. Optional. /// The MusicBrainz identifier of the artist. Optional. +/// The list of IPI (Interested Party Information) codes of the artist. Optional. +/// The list of ISNI (International Standard Name Identifier) codes of the artist. Optional. /// The list of media contributors that make up the artist. Required. +/// The list of ratings for the artist. Required. /// The list of albums of the artist, each with its own list of tracks. Required. -[DebuggerDisplay("Name: {Name}")] +[DebuggerDisplay("Name: {Metadata.Name}")] public record UpdateArtistRequest( - string? Name, + MusicArtistMetadataDto? Metadata, string? Website, Guid? MusicBrainzArtistId, + List? Ipis, + List? Isnis, List? Contributors, + List? Ratings, List? Albums ); diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequest.cs index 2b7a10a2..6831cdff 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequest.cs @@ -22,10 +22,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Artis /// The script used by the language of the track. Optional. /// The musical key of the track. Optional. /// The tempo of the track in beats per minute. Optional. -/// The title of the work the track is a recording of. Optional. +/// The work the track is a recording of. Optional. /// The MusicBrainz identifier of the recording. Optional. /// The MusicBrainz identifier of the track. Optional. -/// The MusicBrainz identifier of the work. Optional. /// The list of moods of the track. Optional. /// The list of ISRC (International Standard Recording Code) of the track. Optional. /// The list of media contributors that performed on the track. Required. @@ -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? Moods, List? Isrcs, List? Contributors, diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequest.cs index 6652f6a5..328028fd 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequest.cs @@ -21,10 +21,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track /// The script used by the language of the track. Optional. /// The musical key of the track. Optional. /// The tempo of the track in beats per minute. Optional. -/// The title of the work the track is a recording of. Optional. +/// The work the track is a recording of. Optional. /// The MusicBrainz identifier of the recording. Optional. /// The MusicBrainz identifier of the track. Optional. -/// The MusicBrainz identifier of the work. Optional. /// The list of moods of the track. Optional. /// The list of ISRC (International Standard Recording Code) of the track. Optional. /// The list of media contributors that performed on the track. Required. @@ -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? Moods, List? Isrcs, List? Contributors, diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequest.cs index 3a65a285..34cb73d8 100644 --- a/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequest.cs +++ b/src/Lumina.Contracts/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequest.cs @@ -21,10 +21,9 @@ namespace Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Track /// The script used by the language of the track. Optional. /// The musical key of the track. Optional. /// The tempo of the track in beats per minute. Optional. -/// The title of the work the track is a recording of. Optional. +/// The work the track is a recording of. Optional. /// The MusicBrainz identifier of the recording. Optional. /// The MusicBrainz identifier of the track. Optional. -/// The MusicBrainz identifier of the work. Optional. /// The list of moods of the track. Optional. /// The list of ISRC (International Standard Recording Code) of the track. Optional. /// The list of media contributors that performed on the track. Required. @@ -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? Moods, List? Isrcs, List? Contributors, diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs index e71a8bef..84760c8f 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponse.cs @@ -19,8 +19,11 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Albu /// The Id of the media library this album belongs to. /// The album metadata of the album. /// The physical or digital medium of the album, if applicable. +/// The outermost physical packaging of the album, if applicable. /// The barcode of the album, if applicable. -/// The catalog number of the album, if applicable. +/// The catalog numbers of the album, if applicable. +/// The name of the label that issued the album, if applicable. +/// The ASIN (Amazon Standard Identification Number) of the album, if applicable. /// The MusicBrainz identifier of the release, if applicable. /// The MusicBrainz identifier of the release group, if applicable. /// The MusicBrainz identifier of the release artist, if applicable. @@ -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? CatalogNumbers, + string? Label, + string? ASIN, Guid? MusicBrainzReleaseId, Guid? MusicBrainzReleaseGroupId, Guid? MusicBrainzReleaseArtistId, diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs index 6cd9d3d0..ec147700 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponse.cs @@ -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 /// /// The Id of the artist. /// The Id of the media library this artist belongs to. -/// The name of the artist. +/// The metadata of the artist. /// The website of the artist, if applicable. /// The MusicBrainz identifier of the artist, if applicable. -/// The list of references to the media contributors that make up the artist, each with the role they played. -/// The list of albums of the artist, each with its own list of tracks. +/// The list of IPI (Interested Party Information) codes of the artist. +/// The list of ISNI (International Standard Name Identifier) codes of the artist. /// The date and time when the artist was created. /// The optional date and time when the artist was updated. -[DebuggerDisplay("Name: {Name}")] +/// The list of references to the media contributors that make up the artist, each with the role they played. +/// The list of ratings for this artist. +/// The list of albums of the artist, each with its own list of tracks. +[DebuggerDisplay("Name: {Metadata.Name}")] public record ArtistResponse( Guid Id, Guid LibraryId, - string Name, + MusicArtistMetadataDto Metadata, string? Website, Guid? MusicBrainzArtistId, - List? Contributors, - List? Albums, + List? Ipis, + List? Isnis, DateTime CreatedOnUtc, - DateTime? UpdatedOnUtc + DateTime? UpdatedOnUtc, + List? Contributors, + List? Ratings, + List? Albums ); diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponse.cs index 72fd1ddb..b6e64f64 100644 --- a/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponse.cs +++ b/src/Lumina.Contracts/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponse.cs @@ -24,10 +24,9 @@ namespace Lumina.Contracts.Responses.MediaLibrary.AudioLibrary.MusicLibrary.Trac /// The script used by the language of the track, if applicable. /// The musical key of the track, if applicable. /// The tempo of the track in beats per minute, if applicable. -/// The title of the work the track is a recording of, if applicable. +/// The work the track is a recording of, if applicable. /// The MusicBrainz identifier of the recording, if applicable. /// The MusicBrainz identifier of the track, if applicable. -/// The MusicBrainz identifier of the work, if applicable. /// The date and time when the track was created. /// The optional date and time when the track was updated. /// The list of moods of the track. @@ -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? Moods, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ArtworkDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ArtworkDtoFixture.cs index 54f61ead..060ae549 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ArtworkDtoFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/Common/ArtworkDtoFixture.cs @@ -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 /// /// Optional. The local file system path of the artwork. /// Optional. The remote URL of the artwork. + /// Optional. The type of the artwork. + /// Optional. The ordinal of the artwork within its type. /// The created . 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); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDtoFixture.cs index bc52b188..1eb8dc40 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDtoFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataDtoFixture.cs @@ -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(); /// /// Creates a random valid . /// /// Optional. The title of the album. /// Optional. The original title of the album. + /// Optional. The title of the specific release (edition) of the album. /// Optional. A brief description or summary of the album. + /// Optional. The disambiguation comment of the album. /// Optional. The release information of the album. /// Optional. The language of the album. /// Optional. The original language of the album. /// Optional. The tags that describe or categorize the album. /// Optional. The genres associated with the album. - /// Optional. The type of the release. + /// Optional. The script used by the language of the release of the album. + /// Optional. The types of the release. /// Optional. The status of the release. + /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. /// Optional. The number of discs of the release. /// Optional. The number of tracks of the release. + /// Optional. The barcode of the album. + /// Optional. The catalog number of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. + /// Optional. The MusicBrainz identifier of the release. + /// Optional. The MusicBrainz identifier of the release group. + /// Optional. The MusicBrainz identifier of the release artist. + /// Optional. The media contributors that performed on the album. + /// Optional. The ratings of the album. /// Whether the title should be included, or forced to . /// Whether the original title should be included, or forced to . /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . /// Whether the release information should be included, or forced to . /// Whether the language should be included, or forced to . /// Whether the original language should be included, or forced to . /// Whether the tags should be included, or forced to . /// Whether the genres should be included, or forced to . - /// Whether the release type should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the release types should be included, or forced to . /// Whether the release status should be included, or forced to . + /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . /// Whether the total number of discs should be included, or forced to . /// Whether the total number of tracks should be included, or forced to . + /// Whether the barcode should be included, or forced to . + /// Whether the catalog number should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . + /// Whether the MusicBrainz release Id should be included, or forced to . + /// Whether the MusicBrainz release group Id should be included, or forced to . + /// Whether the MusicBrainz release artist Id should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . /// The created . 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? tags = null, List? genres = null, - MusicReleaseType? releaseType = null, + string? script = null, + List? releaseTypes = null, MusicReleaseStatus? releaseStatus = null, + MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, int? totalDiscs = null, int? totalTracks = null, + string? barcode = null, + List? catalogNumbers = null, + string? label = null, + string? asin = null, + Guid? musicBrainzReleaseId = null, + Guid? musicBrainzReleaseGroupId = null, + Guid? musicBrainzReleaseArtistId = null, + List? contributors = null, + List? 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()) : null, + includeScript ? (script ?? _faker.Random.String2(4)) : null, + includeReleaseTypes ? (releaseTypes ?? [_faker.PickRandom()]) : null, includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom()) : null, + includeMediaFormat ? (mediaFormat ?? _faker.PickRandom()) : null, + includePackaging ? (packaging ?? _faker.PickRandom()) : 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); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDtoFixture.cs new file mode 100644 index 00000000..74906561 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AlbumMetadataLookupDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class AlbumMetadataLookupDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The Id of the media library the album belongs to. + /// Optional. The file system path of a track of the album. + /// Optional. The MusicBrainz identifier of the release group of the album. + /// Optional. The MusicBrainz identifier of the release of the album. + /// Optional. The title of the album. + /// Optional. The name of the artist of the album. + /// Optional. The year the album was released. + /// Optional. The number of tracks the local album has. + /// The created . + 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDtoFixture.cs new file mode 100644 index 00000000..edf9c7a0 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[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(); + + /// + /// Creates a random valid . + /// + /// Optional. The name of the artist. + /// Optional. The sort name of the artist. + /// Optional. The disambiguation comment of the artist. + /// Optional. The type of the artist. + /// Optional. The gender of the artist. + /// Optional. The ISO 3166-1 alpha-2 code of the country of the artist. + /// Optional. The area the artist is primarily identified with. + /// Optional. The area the artist began in. + /// Optional. The area the artist ended in. + /// Optional. The date the artist started existing. + /// Optional. The date the artist stopped existing. + /// Optional. Whether the artist no longer exists. + /// Optional. The website of the artist. + /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. + /// Optional. The alternative names of the artist. + /// Optional. The genres associated with the artist. + /// Optional. The tags that describe or categorize the artist. + /// Optional. The ratings of the artist. + /// Optional. The media contributors that make up the artist. + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the gender should be included, or forced to . + /// Whether the country should be included, or forced to . + /// Whether the area should be included, or forced to . + /// Whether the begin area should be included, or forced to . + /// Whether the end area should be included, or forced to . + /// Whether the lifespan begin should be included, or forced to . + /// Whether the lifespan end should be included, or forced to . + /// Whether the website should be included, or forced to . + /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the aliases should be included, or forced to . + /// Whether the ratings should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// The created . + 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? ipis = null, + List? isnis = null, + List? aliases = null, + List? genres = null, + List? tags = null, + List? ratings = null, + List? 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()) : null, + includeGender ? (gender ?? _faker.PickRandom()) : 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDtoFixture.cs new file mode 100644 index 00000000..5d7cc9f7 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/ArtistMetadataLookupDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class ArtistMetadataLookupDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The Id of the media library the artist belongs to. + /// Optional. The file system path of a track of the artist. + /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The name of the artist. + /// The created . + 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDtoFixture.cs index c8eba087..bc191ac6 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDtoFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/AudioMetadataDtoFixture.cs @@ -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(); /// /// Creates a random valid . @@ -33,77 +43,135 @@ public class AudioMetadataDtoFixture /// Optional. The title of the audio. /// Optional. The original title of the audio. /// Optional. A brief description or summary of the audio. + /// Optional. The disambiguation comment of the audio. /// Optional. The release information of the audio. /// Optional. The language of the audio. /// Optional. The original language of the audio. /// Optional. The tags that describe or categorize the audio. /// Optional. The genres associated with the audio. + /// Optional. The script used by the language of the audio. + /// Optional. The musical key of the audio. + /// Optional. The tempo of the audio, in beats per minute. + /// Optional. Whether the recording of the audio is a video recording. + /// Optional. The work the audio is a recording of. + /// Optional. The ISRC codes of the audio. + /// Optional. The moods of the audio. /// Optional. The duration of the audio, in seconds. /// Optional. The sample rate of the audio, in Hz. /// Optional. The number of audio channels. /// Optional. The bit depth of the audio. /// Optional. The audio codec used. /// Optional. The bitrate of the audio, in kbps. + /// Optional. The MusicBrainz identifier of the recording. + /// Optional. The MusicBrainz identifier of the track. + /// Optional. The media contributors that performed on the audio. + /// Optional. The ratings of the audio. /// Whether the title should be included, or forced to . /// Whether the original title should be included, or forced to . /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . /// Whether the release information should be included, or forced to . /// Whether the language should be included, or forced to . /// Whether the original language should be included, or forced to . /// Whether the tags should be included, or forced to . /// Whether the genres should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the musical key should be included, or forced to . + /// Whether the tempo should be included, or forced to . + /// Whether the work should be included, or forced to . + /// Whether the ISRC codes should be included, or forced to . + /// Whether the moods should be included, or forced to . /// Whether the duration should be included, or forced to . /// Whether the sample rate should be included, or forced to . /// Whether the channels should be included, or forced to . /// Whether the bit depth should be included, or forced to . /// Whether the audio codec should be included, or forced to . /// Whether the bitrate should be included, or forced to . + /// Whether the MusicBrainz recording Id should be included, or forced to . + /// Whether the MusicBrainz track Id should be included, or forced to . + /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . /// The created . 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? tags = null, List? genres = null, + string? script = null, + MusicKey? key = null, + int? bpm = null, + bool? isVideo = null, + MusicWorkDto? work = null, + List? isrcs = null, + List? 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? contributors = null, + List? 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()) : 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); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs new file mode 100644 index 00000000..19e4b97b --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAlbumMetadataDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[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(); + + /// + /// Creates a random valid . + /// + /// Optional. The title of the album. + /// Optional. The original title of the album. + /// Optional. The title of the specific release (edition) of the album. + /// Optional. A brief description or summary of the album. + /// Optional. The disambiguation comment of the album. + /// Optional. The release information of the album. + /// Optional. The language of the album. + /// Optional. The original language of the album. + /// Optional. The tags that describe or categorize the album. + /// Optional. The genres associated with the album. + /// Optional. The script used by the language of the release of the album. + /// Optional. The types of the release. + /// Optional. The status of the release. + /// Optional. The number of discs of the release. + /// Optional. The number of tracks of the release. + /// Whether the title should be included, or forced to . + /// Whether the original title should be included, or forced to . + /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the release information should be included, or forced to . + /// Whether the language should be included, or forced to . + /// Whether the original language should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the script should be included, or forced to . + /// Whether the release types should be included, or forced to . + /// Whether the release status should be included, or forced to . + /// Whether the total number of discs should be included, or forced to . + /// Whether the total number of tracks should be included, or forced to . + /// The created . + 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? tags = null, + List? genres = null, + string? script = null, + List? 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()]) : null, + includeReleaseStatus ? (releaseStatus ?? _faker.PickRandom()) : null, + includeTotalDiscs ? (totalDiscs ?? _faker.Random.Int(1, 3)) : null, + includeTotalTracks ? (totalTracks ?? _faker.Random.Int(1, 30)) : null, + includeReleaseTitle ? (releaseTitle ?? _faker.Commerce.ProductName()) : null); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } + + /// + /// Creates a random valid with consistent dates and years. + /// + /// The created . + 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(), + releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50))); + } + + /// + /// Creates two genres with distinct names, so that the storage deduplication never collapses them into one. + /// + /// The created genres. + private List GenerateDistinctGenres() + { + return + [ + _genreDtoFixture.Create(name: CreateUniqueName()), + _genreDtoFixture.Create(name: CreateUniqueName()) + ]; + } + + /// + /// Creates two tags with distinct names, so that the storage deduplication never collapses them into one. + /// + /// The created tags. + private List GenerateDistinctTags() + { + return + [ + _tagDtoFixture.Create(name: CreateUniqueName()), + _tagDtoFixture.Create(name: CreateUniqueName()) + ]; + } + + /// + /// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication. + /// + /// A unique name of at most 50 characters. + 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}"; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs new file mode 100644 index 00000000..2f751b28 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class MusicAreaDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The MusicBrainz identifier of the area. + /// Optional. The name of the area. + /// Optional. The sort name of the area. + /// Optional. The disambiguation comment of the area. + /// Optional. The MusicBrainz type of the area. + /// Optional. The ISO 3166 code of the area. + /// Whether the MusicBrainz area Id should be included, or forced to . + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the ISO 3166 code should be included, or forced to . + /// The created . + 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs new file mode 100644 index 00000000..2b59d2aa --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistAliasDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class MusicArtistAliasDtoFixture +{ + private const int MINIMUM_ALIAS_YEAR = 1900; + private const int MAXIMUM_ALIAS_YEAR = 2026; + + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The name of the alias. + /// Optional. The sort name of the alias. + /// Optional. The type of the alias. + /// Optional. The locale the alias is used in. + /// Optional. Whether this is the primary alias of the artist. + /// Optional. The date the alias began being used. + /// Optional. The date the alias stopped being used. + /// Optional. Whether the alias is no longer used. + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the locale should be included, or forced to . + /// Whether the begin date should be included, or forced to . + /// Whether the end date should be included, or forced to . + /// The created . + 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()); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs new file mode 100644 index 00000000..16e1a77f --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicArtistMetadataDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[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(); + + /// + /// Creates a random valid . + /// + /// Optional. The name of the artist. + /// Optional. The sort name of the artist. + /// Optional. The disambiguation comment of the artist. + /// Optional. The type of the artist. + /// Optional. The gender of the artist. + /// Optional. The ISO 3166-1 alpha-2 code of the country of the artist. + /// Optional. The area the artist is primarily identified with. + /// Optional. The area the artist began in. + /// Optional. The area the artist ended in. + /// Optional. The date the artist started existing. + /// Optional. The date the artist stopped existing. + /// Optional. Whether the artist no longer exists. + /// Optional. The genres associated with the artist. + /// Optional. The tags that describe or categorize the artist. + /// Optional. The alternative names of the artist. + /// Whether the name should be included, or forced to . + /// Whether the sort name should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the gender should be included, or forced to . + /// Whether the country should be included, or forced to . + /// Whether the area should be included, or forced to . + /// Whether the begin area should be included, or forced to . + /// Whether the end area should be included, or forced to . + /// Whether the lifespan begin should be included, or forced to . + /// Whether the lifespan end should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the aliases should be included, or forced to . + /// The created . + 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? genres = null, + List? tags = null, + List? 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()) : null, + includeGender ? (gender ?? _faker.PickRandom()) : 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs new file mode 100644 index 00000000..91e8f0c4 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicTrackMetadataDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[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(); + + /// + /// Creates a random valid . + /// + /// Optional. The title of the track. + /// Optional. The original title of the track. + /// Optional. A brief description or summary of the track. + /// Optional. The disambiguation comment of the track. + /// Optional. The release information of the track. + /// Optional. The language of the track. + /// Optional. The original language of the track. + /// Optional. The tags that describe or categorize the track. + /// Optional. The genres associated with the track. + /// Optional. Whether the recording of the track is a video recording. + /// Optional. The duration of the track, in seconds. + /// Optional. The sample rate of the track, in Hz. + /// Optional. The number of audio channels. + /// Optional. The bit depth of the track. + /// Optional. The audio codec used. + /// Optional. The bitrate of the track, in kbps. + /// Whether the title should be included, or forced to . + /// Whether the original title should be included, or forced to . + /// Whether the description should be included, or forced to . + /// Whether the disambiguation should be included, or forced to . + /// Whether the release information should be included, or forced to . + /// Whether the language should be included, or forced to . + /// Whether the original language should be included, or forced to . + /// Whether the tags should be included, or forced to . + /// Whether the genres should be included, or forced to . + /// Whether the duration should be included, or forced to . + /// Whether the sample rate should be included, or forced to . + /// Whether the channels should be included, or forced to . + /// Whether the bit depth should be included, or forced to . + /// Whether the audio codec should be included, or forced to . + /// Whether the bitrate should be included, or forced to . + /// The created . + 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? tags = null, + List? 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } + + /// + /// Creates a random valid with consistent dates and years. + /// + /// The created . + 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(), + releaseVersion: _faker.Random.String2(_faker.Random.Number(1, 50))); + } + + /// + /// Creates two genres with distinct names, so that the storage deduplication never collapses them into one. + /// + /// The created genres. + private List GenerateDistinctGenres() + { + return + [ + _genreDtoFixture.Create(name: CreateUniqueName()), + _genreDtoFixture.Create(name: CreateUniqueName()) + ]; + } + + /// + /// Creates two tags with distinct names, so that the storage deduplication never collapses them into one. + /// + /// The created tags. + private List GenerateDistinctTags() + { + return + [ + _tagDtoFixture.Create(name: CreateUniqueName()), + _tagDtoFixture.Create(name: CreateUniqueName()) + ]; + } + + /// + /// Creates a unique name, so that the generated genres and tags never collapse into one after storage deduplication. + /// + /// A unique name of at most 50 characters. + 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}"; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs new file mode 100644 index 00000000..65a6b547 --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/MusicWorkDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class MusicWorkDtoFixture +{ + private readonly Faker _faker = new(); + private readonly LanguageInfoDtoFixture _languageInfoDtoFixture = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The MusicBrainz identifier of the work. + /// Optional. The title of the work. + /// Optional. The MusicBrainz type of the work. + /// Optional. The list of languages of the work. + /// Optional. The list of ISWC of the work. + /// Whether the MusicBrainz work Id should be included, or forced to . + /// Whether the title should be included, or forced to . + /// Whether the type should be included, or forced to . + /// Whether the languages should be included, or forced to . + /// Whether the ISWCs should be included, or forced to . + /// The created . + public MusicWorkDto Create( + Guid? musicBrainzWorkId = null, + string? title = null, + string? type = null, + List? languages = null, + List? 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } + + /// + /// Creates a list of random ISWC codes. + /// + /// The generated ISWC codes. + private List GenerateIswcs() + { + return [.. Enumerable.Range(0, _faker.Random.Int(1, 2)).Select(_ => $"T{_faker.Random.AlphaNumeric(10)}")]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDtoFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDtoFixture.cs new file mode 100644 index 00000000..cca0c71d --- /dev/null +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/DTO/MediaLibrary/AudioLibrary/MusicLibrary/TrackMetadataLookupDtoFixture.cs @@ -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; + +/// +/// Fixture class for the record. +/// +[ExcludeFromCodeCoverage] +public class TrackMetadataLookupDtoFixture +{ + private readonly Faker _faker = new(); + + /// + /// Creates a random valid . + /// + /// Optional. The Id of the media library the track belongs to. + /// Optional. The file system path of the track. + /// Optional. The MusicBrainz identifier of the recording of the track. + /// Optional. The ISRC of the track. + /// Optional. The title of the track. + /// Optional. The name of the artist of the track. + /// Optional. The name of the release the track belongs to. + /// Optional. The number of the track on its disc. + /// Optional. The duration of the track in seconds. + /// Optional. The MusicBrainz identifier of the release the track belongs to. + /// Optional. The number of the disc the track belongs to. + /// Optional. The MusicBrainz identifier of the work the track is a recording of. + /// Optional. The title of the work the track is a recording of. + /// The created . + 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); + } + + /// + /// Creates a list of . + /// + /// The number of elements to create. + /// The created list. + public List CreateMany(int count = 3) + { + return [.. Enumerable.Range(0, count).Select(_ => Create())]; + } +} diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequestFixture.cs index 2c5f4520..ffb49b7b 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AddAlbumRequestFixture.cs @@ -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 /// /// Optional. The album metadata of the album. /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. /// Optional. The barcode of the album. /// Optional. The catalog number of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. /// Optional. The MusicBrainz identifier of the release. /// Optional. The MusicBrainz identifier of the release group. /// Optional. The MusicBrainz identifier of the release artist. @@ -48,17 +51,23 @@ public class AddAlbumRequestFixture /// Whether the ratings list should be included, or forced to . /// Whether the tracks list should be included, or forced to . /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . /// Whether the barcode should be included, or forced to . - /// Whether the catalog number should be included, or forced to . + /// Whether the catalog number should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . /// Whether the MusicBrainz release Id should be included, or forced to . /// Whether the MusicBrainz release group Id should be included, or forced to . /// Whether the MusicBrainz release artist Id should be included, or forced to . /// The created request to add an album. public AddAlbumRequest Create( - AlbumMetadataDto? metadata = null, + MusicAlbumMetadataDto? metadata = null, MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, string? barcode = null, - string? catalogNumber = null, + List? 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()) : null, + includePackaging ? (packaging ?? _faker.PickRandom()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequestFixture.cs index cbf07c50..62e7fdf2 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Albums/UpdateAlbumRequestFixture.cs @@ -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 /// /// Optional. The album metadata of the album. /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. /// Optional. The barcode of the album. /// Optional. The catalog number of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. /// Optional. The MusicBrainz identifier of the release. /// Optional. The MusicBrainz identifier of the release group. /// Optional. The MusicBrainz identifier of the release artist. @@ -43,17 +46,23 @@ public class UpdateAlbumRequestFixture /// Whether the contributors list should be included, or forced to . /// Whether the ratings list should be included, or forced to . /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . /// Whether the barcode should be included, or forced to . - /// Whether the catalog number should be included, or forced to . + /// Whether the catalog number should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . /// Whether the MusicBrainz release Id should be included, or forced to . /// Whether the MusicBrainz release group Id should be included, or forced to . /// Whether the MusicBrainz release artist Id should be included, or forced to . /// The created request to update an album. public UpdateAlbumRequest Create( - AlbumMetadataDto? metadata = null, + MusicAlbumMetadataDto? metadata = null, MusicMediaFormat? mediaFormat = null, + MusicReleasePackaging? packaging = null, string? barcode = null, - string? catalogNumber = null, + List? 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()) : null, + includePackaging ? (packaging ?? _faker.PickRandom()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequestFixture.cs index df2aa7a4..c62670b9 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/AddArtistRequestFixture.cs @@ -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(); /// /// Creates a random valid request to add an artist. /// - /// Optional. The name of the artist. + /// Optional. The metadata of the artist. /// Optional. The website of the artist. /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. /// Optional. The media contributors that make up the artist. + /// Optional. The ratings of the artist. /// Optional. The albums of the artist. - /// Whether the name should be included, or forced to . + /// Whether the metadata should be included, or forced to . /// Whether the website should be included, or forced to . /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . /// Whether the contributors list should be included, or forced to . + /// Whether the ratings list should be included, or forced to . /// Whether the albums list should be included, or forced to . /// The created request to add an artist. public AddArtistRequest Create( - string? name = null, + MusicArtistMetadataDto? metadata = null, string? website = null, Guid? musicBrainzArtistId = null, + List? ipis = null, + List? isnis = null, List? contributors = null, + List? ratings = null, List? 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); } diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequestFixture.cs index 89389dba..7da9e9b7 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistAlbumRequestFixture.cs @@ -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 /// Optional. The Id of the album, when the album already exists. /// Optional. The album metadata of the album. /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. /// Optional. The barcode of the album. /// Optional. The catalog number of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. /// Optional. The MusicBrainz identifier of the release. /// Optional. The MusicBrainz identifier of the release group. /// Optional. The MusicBrainz identifier of the release artist. @@ -46,8 +48,11 @@ public class UpdateArtistAlbumRequestFixture /// Whether the album Id should be included, or forced to . /// Whether the metadata should be included, or forced to . /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . /// Whether the barcode should be included, or forced to . - /// Whether the catalog number should be included, or forced to . + /// Whether the catalog number should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . /// Whether the MusicBrainz release Id should be included, or forced to . /// Whether the MusicBrainz release group Id should be included, or forced to . /// Whether the MusicBrainz release artist Id should be included, or forced to . @@ -57,10 +62,13 @@ public class UpdateArtistAlbumRequestFixture /// The created request to update an album of an artist. 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? 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()) : null, + includePackaging ? (packaging ?? _faker.PickRandom()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequestFixture.cs index 111a76e0..356be292 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistRequestFixture.cs @@ -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(); /// /// Creates a random valid request to update an artist. /// - /// Optional. The name of the artist. + /// Optional. The metadata of the artist. /// Optional. The website of the artist. /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. /// Optional. The media contributors that make up the artist. + /// Optional. The ratings of the artist. /// Optional. The albums of the artist. - /// Whether the name should be included, or forced to . + /// Whether the metadata should be included, or forced to . /// Whether the website should be included, or forced to . /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . /// Whether the contributors list should be included, or forced to . + /// Whether the ratings list should be included, or forced to . /// Whether the albums list should be included, or forced to . /// The created request to update an artist. public UpdateArtistRequest Create( - string? name = null, + MusicArtistMetadataDto? metadata = null, string? website = null, Guid? musicBrainzArtistId = null, + List? ipis = null, + List? isnis = null, List? contributors = null, + List? ratings = null, List? 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); } diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequestFixture.cs index 660c83c9..35f39975 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Artists/UpdateArtistTrackRequestFixture.cs @@ -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 /// Optional. The script used by the language of the track. /// Optional. The musical key of the track. /// Optional. The tempo of the track in beats per minute. - /// Optional. The title of the work the track is a recording of. + /// Optional. The work the track is a recording of. /// Optional. The MusicBrainz identifier of the recording. /// Optional. The MusicBrainz identifier of the track. - /// Optional. The MusicBrainz identifier of the work. /// Optional. The moods of the track. /// Optional. The ISRC codes of the track. /// Optional. The media contributors that performed on the track. @@ -62,7 +62,6 @@ public class UpdateArtistTrackRequestFixture /// Whether the work should be included, or forced to . /// Whether the MusicBrainz recording Id should be included, or forced to . /// Whether the MusicBrainz track Id should be included, or forced to . - /// Whether the MusicBrainz work Id should be included, or forced to . /// Whether the moods should be included, or forced to . /// Whether the ISRC codes should be included, or forced to . /// Whether the contributors list should be included, or forced to . @@ -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? moods = null, List? isrcs = null, List? 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()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequestFixture.cs index c45bcafb..c832d920 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/AddTrackRequestFixture.cs @@ -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 /// Optional. The script used by the language of the track. /// Optional. The musical key of the track. /// Optional. The tempo of the track in beats per minute. - /// Optional. The title of the work the track is a recording of. + /// Optional. The work the track is a recording of. /// Optional. The MusicBrainz identifier of the recording. /// Optional. The MusicBrainz identifier of the track. - /// Optional. The MusicBrainz identifier of the work. /// Optional. The list of moods of the track. /// Optional. The list of ISRC of the track. /// Optional. The list of media contributors that performed on the track. @@ -60,7 +60,6 @@ public class AddTrackRequestFixture /// Whether the work should be included, or forced to . /// Whether the MusicBrainz recording Id should be included, or forced to . /// Whether the MusicBrainz track Id should be included, or forced to . - /// Whether the MusicBrainz work Id should be included, or forced to . /// Whether the moods should be included, or forced to . /// Whether the ISRC codes should be included, or forced to . /// Whether the contributors should be included, or forced to . @@ -68,16 +67,15 @@ public class AddTrackRequestFixture /// The created request to add a track. 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? moods = null, List? isrcs = null, List? 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() : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequestFixture.cs index f73927dd..bdf7e052 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/UpdateTrackRequestFixture.cs @@ -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 /// Optional. The script used by the language of the track. /// Optional. The musical key of the track. /// Optional. The tempo of the track in beats per minute. - /// Optional. The title of the work the track is a recording of. + /// Optional. The work the track is a recording of. /// Optional. The MusicBrainz identifier of the recording. /// Optional. The MusicBrainz identifier of the track. - /// Optional. The MusicBrainz identifier of the work. /// Optional. The moods of the track. /// Optional. The ISRC codes of the track. /// Optional. The media contributors that performed on the track. @@ -56,7 +56,6 @@ public class UpdateTrackRequestFixture /// Whether the work should be included, or forced to . /// Whether the MusicBrainz recording Id should be included, or forced to . /// Whether the MusicBrainz track Id should be included, or forced to . - /// Whether the MusicBrainz work Id should be included, or forced to . /// Whether the moods should be included, or forced to . /// Whether the ISRC codes should be included, or forced to . /// Whether the contributors list should be included, or forced to . @@ -67,16 +66,15 @@ public class UpdateTrackRequestFixture /// The created request to update a track. 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? moods = null, List? isrcs = null, List? 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()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs index 22ea8889..653ec988 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Albums/AlbumResponseFixture.cs @@ -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 /// Optional. The Id of the media library the album belongs to. /// Optional. The album metadata of the album. /// Optional. The physical or digital medium of the album. + /// Optional. The outermost physical packaging of the album. /// Optional. The barcode of the album. /// Optional. The catalog number of the album. + /// Optional. The name of the label that issued the album. + /// Optional. The ASIN of the album. /// Optional. The MusicBrainz identifier of the release. /// Optional. The MusicBrainz identifier of the release group. /// Optional. The MusicBrainz identifier of the release artist. @@ -49,8 +52,11 @@ public class AlbumResponseFixture /// Optional. The list of ratings of the album. /// Optional. The list of tracks of the album. /// Whether the media format should be included, or forced to . + /// Whether the packaging should be included, or forced to . /// Whether the barcode should be included, or forced to . - /// Whether the catalog number should be included, or forced to . + /// Whether the catalog number should be included, or forced to . + /// Whether the label should be included, or forced to . + /// Whether the ASIN should be included, or forced to . /// Whether the MusicBrainz release Id should be included, or forced to . /// Whether the MusicBrainz release group Id should be included, or forced to . /// Whether the MusicBrainz release artist Id should be included, or forced to . @@ -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? 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? ratings = null, List? 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()) : null, + includePackaging ? (packaging ?? _faker.PickRandom()) : 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, diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs index c8e4178b..f22f8359 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Artists/ArtistResponseFixture.cs @@ -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(); /// @@ -28,45 +34,60 @@ public class ArtistResponseFixture /// /// Optional. The Id of the artist. /// Optional. The Id of the media library the artist belongs to. - /// Optional. The name of the artist. + /// Optional. The metadata of the artist. /// Optional. The website of the artist. /// Optional. The MusicBrainz identifier of the artist. + /// Optional. The IPI codes of the artist. + /// Optional. The ISNI codes of the artist. /// Optional. The list of contributor references of the artist. + /// Optional. The list of ratings of the artist. /// Optional. The list of albums of the artist. /// Optional. The date and time when the artist was created. /// Optional. The date and time when the artist was updated. /// Whether the website should be included, or forced to . /// Whether the MusicBrainz artist Id should be included, or forced to . + /// Whether the IPI codes should be included, or forced to . + /// Whether the ISNI codes should be included, or forced to . /// Whether the update date should be included, or forced to . /// Whether the contributors should be included, or forced to . + /// Whether the ratings should be included, or forced to . /// Whether the albums should be included, or forced to . /// The created . public ArtistResponse Create( Guid? id = null, Guid? libraryId = null, - string? name = null, + MusicArtistMetadataDto? metadata = null, string? website = null, Guid? musicBrainzArtistId = null, + List? ipis = null, + List? isnis = null, List? contributors = null, + List? ratings = null, List? 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); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponseFixture.cs index 2c009ff5..b79eb390 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/MediaLibrary/AudioLibrary/MusicLibrary/Tracks/TrackResponseFixture.cs @@ -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 /// Optional. The script used by the language of the track. /// Optional. The musical key of the track. /// Optional. The tempo of the track in beats per minute. - /// Optional. The title of the work the track is a recording of. + /// Optional. The work the track is a recording of. /// Optional. The MusicBrainz recording Id of the track. /// Optional. The MusicBrainz track Id of the track. - /// Optional. The MusicBrainz work Id of the track. /// Optional. The date and time when the track was created. /// Optional. The date and time when the track was updated. /// Optional. The list of moods of the track. @@ -56,23 +56,21 @@ public class TrackResponseFixture /// Optional. The list of ratings of the track. /// Whether the MusicBrainz recording Id should be included, or forced to . /// Whether the MusicBrainz track Id should be included, or forced to . - /// Whether the MusicBrainz work Id should be included, or forced to . /// The created . 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? moods = null, @@ -80,24 +78,22 @@ public class TrackResponseFixture List? contributors = null, List? 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() : 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),