Extends the music library aggregates and metadata with the new artist, area, and work details

This commit is contained in:
BinaryAlley committed 2026-10-06 14:52:00 +03:00
1 parent e20e244a04
commit ed96046769
16 files changed
+986 -129

No files matched your search

@@ -34,6 +34,7 @@ public static partial class Errors
public static Error UnknownMusicReleaseType => Error.Validation(description: nameof(UnknownMusicReleaseType));
public static Error UnknownMusicReleaseStatus => Error.Validation(description: nameof(UnknownMusicReleaseStatus));
public static Error UnknownMusicMediaFormat => Error.Validation(description: nameof(UnknownMusicMediaFormat));
public static Error UnknownMusicReleasePackaging => Error.Validation(description: nameof(UnknownMusicReleasePackaging));
public static Error UnknownMusicKey => Error.Validation(description: nameof(UnknownMusicKey));
public static Error CatalogNumberMustBeMaximum50CharactersLong => Error.Validation(description: nameof(CatalogNumberMustBeMaximum50CharactersLong));
public static Error TrackNotFound => Error.NotFound(description: nameof(TrackNotFound));
@@ -52,5 +53,17 @@ public static partial class Errors
public static Error TheArtistDoesNotHaveTheAlbum => Error.Forbidden(description: nameof(TheArtistDoesNotHaveTheAlbum));
public static Error TheTrackIsAlreadyInTheAlbum => Error.Forbidden(description: nameof(TheTrackIsAlreadyInTheAlbum));
public static Error TheTrackIsNotInTheAlbum => Error.Forbidden(description: nameof(TheTrackIsNotInTheAlbum));
public static Error AreaNameCannotBeEmpty => Error.Validation(description: nameof(AreaNameCannotBeEmpty));
public static Error ArtistAliasNameCannotBeEmpty => Error.Validation(description: nameof(ArtistAliasNameCannotBeEmpty));
public static Error ArtistAliasNameMustBeMaximum255CharactersLong => Error.Validation(description: nameof(ArtistAliasNameMustBeMaximum255CharactersLong));
public static Error AreaNameMustBeMaximum255CharactersLong => Error.Validation(description: nameof(AreaNameMustBeMaximum255CharactersLong));
public static Error UnknownMusicArtistType => Error.Validation(description: nameof(UnknownMusicArtistType));
public static Error UnknownMusicArtistGender => Error.Validation(description: nameof(UnknownMusicArtistGender));
public static Error CountryMustBeMaximum2CharactersLong => Error.Validation(description: nameof(CountryMustBeMaximum2CharactersLong));
public static Error IpiValueCannotBeEmpty => Error.Validation(description: nameof(IpiValueCannotBeEmpty));
public static Error IpiValueMustBeMaximum20CharactersLong => Error.Validation(description: nameof(IpiValueMustBeMaximum20CharactersLong));
public static Error IsniValueCannotBeEmpty => Error.Validation(description: nameof(IsniValueCannotBeEmpty));
public static Error IsniValueMustBeMaximum20CharactersLong => Error.Validation(description: nameof(IsniValueMustBeMaximum20CharactersLong));
public static Error WorkTitleCannotBeEmpty => Error.Validation(description: nameof(WorkTitleCannotBeEmpty));
}
}
@@ -43,6 +43,31 @@ public class AudioMetadata : BaseMetadata
/// </summary>
public Optional<int> Bitrate { get; }
/// <summary>
/// Gets the AcoustID fingerprint identifier of the audio file, if applicable.
/// </summary>
public Optional<string> AcoustId { get; }
/// <summary>
/// Gets the ReplayGain track gain in decibels, if applicable.
/// </summary>
public Optional<decimal> ReplayGainTrackGain { get; }
/// <summary>
/// Gets the ReplayGain track peak, if applicable.
/// </summary>
public Optional<decimal> ReplayGainTrackPeak { get; }
/// <summary>
/// Gets the ReplayGain album gain in decibels, if applicable.
/// </summary>
public Optional<decimal> ReplayGainAlbumGain { get; }
/// <summary>
/// Gets the ReplayGain album peak, if applicable.
/// </summary>
public Optional<decimal> ReplayGainAlbumPeak { get; }
/// <summary>
/// Initializes a new instance of the <see cref="AudioMetadata"/> class.
/// </summary>
@@ -60,6 +85,11 @@ public class AudioMetadata : BaseMetadata
/// <param name="genres">The genres of the audio.</param>
/// <param name="tags">The tags associated with the audio.</param>
/// <param name="bitrate">The bitrate of the audio in kbps.</param>
/// <param name="acoustId">The AcoustID fingerprint identifier of the audio file.</param>
/// <param name="replayGainTrackGain">The ReplayGain track gain in decibels.</param>
/// <param name="replayGainTrackPeak">The ReplayGain track peak.</param>
/// <param name="replayGainAlbumGain">The ReplayGain album gain in decibels.</param>
/// <param name="replayGainAlbumPeak">The ReplayGain album peak.</param>
private AudioMetadata(
string title,
Optional<string> originalTitle,
@@ -74,7 +104,12 @@ public class AudioMetadata : BaseMetadata
Optional<LanguageInfo> originalLanguage,
Optional<int> bitDepth,
Optional<string> audioCodec,
Optional<int> bitrate)
Optional<int> bitrate,
Optional<string> acoustId,
Optional<decimal> replayGainTrackGain,
Optional<decimal> replayGainTrackPeak,
Optional<decimal> replayGainAlbumGain,
Optional<decimal> replayGainAlbumPeak)
: base(title, originalTitle, description, releaseInfo, genres, tags, language, originalLanguage)
{
DurationInSeconds = durationInSeconds;
@@ -83,6 +118,11 @@ public class AudioMetadata : BaseMetadata
BitDepth = bitDepth;
AudioCodec = audioCodec;
Bitrate = bitrate;
AcoustId = acoustId;
ReplayGainTrackGain = replayGainTrackGain;
ReplayGainTrackPeak = replayGainTrackPeak;
ReplayGainAlbumGain = replayGainAlbumGain;
ReplayGainAlbumPeak = replayGainAlbumPeak;
}
/// <summary>
@@ -102,6 +142,11 @@ public class AudioMetadata : BaseMetadata
/// <param name="genres">The genres of the audio.</param>
/// <param name="tags">The tags associated with the audio.</param>
/// <param name="bitrate">The bitrate of the audio in kbps.</param>
/// <param name="acoustId">The AcoustID fingerprint identifier of the audio file.</param>
/// <param name="replayGainTrackGain">The ReplayGain track gain in decibels.</param>
/// <param name="replayGainTrackPeak">The ReplayGain track peak.</param>
/// <param name="replayGainAlbumGain">The ReplayGain album gain in decibels.</param>
/// <param name="replayGainAlbumPeak">The ReplayGain album peak.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="AudioMetadata"/>, or an error message.
/// </returns>
@@ -119,7 +164,12 @@ public class AudioMetadata : BaseMetadata
Optional<LanguageInfo> originalLanguage,
Optional<int> bitDepth,
Optional<string> audioCodec,
Optional<int> bitrate)
Optional<int> bitrate,
Optional<string> acoustId,
Optional<decimal> replayGainTrackGain,
Optional<decimal> replayGainTrackPeak,
Optional<decimal> replayGainAlbumGain,
Optional<decimal> replayGainAlbumPeak)
{
return new AudioMetadata(
title,
@@ -135,7 +185,12 @@ public class AudioMetadata : BaseMetadata
originalLanguage,
bitDepth,
audioCodec,
bitrate);
bitrate,
acoustId,
replayGainTrackGain,
replayGainTrackPeak,
replayGainAlbumGain,
replayGainAlbumPeak);
}
/// <summary>
@@ -152,5 +207,10 @@ public class AudioMetadata : BaseMetadata
yield return BitDepth;
yield return AudioCodec;
yield return Bitrate;
yield return AcoustId;
yield return ReplayGainTrackGain;
yield return ReplayGainTrackPeak;
yield return ReplayGainAlbumGain;
yield return ReplayGainAlbumPeak;
}
}
@@ -30,6 +30,12 @@ namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLib
public sealed class Artist : AggregateRoot<ArtistId>
{
private readonly HashSet<MusicMediaContributor> _contributors;
private readonly List<MusicArtistAlias> _aliases;
private readonly List<string> _ipis;
private readonly List<string> _isnis;
private readonly List<Genre> _genres;
private readonly List<Tag> _tags;
private readonly List<AudioRating> _ratings;
private readonly List<Album> _albums;
/// <summary>
@@ -42,6 +48,61 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Gets the sort name of the artist, a variant of the name used when sorting artists, if applicable.
/// </summary>
public Optional<string> SortName { get; private set; }
/// <summary>
/// Gets the disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.
/// </summary>
public Optional<string> Disambiguation { get; private set; }
/// <summary>
/// Gets the type of the artist, describing whether it is a person, a group, or something else, if applicable.
/// </summary>
public Optional<MusicArtistType> Type { get; private set; }
/// <summary>
/// Gets the gender of the artist, applicable only to artists that are persons or characters, if applicable.
/// </summary>
public Optional<MusicArtistGender> Gender { get; private set; }
/// <summary>
/// Gets the ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.
/// </summary>
public Optional<string> Country { get; private set; }
/// <summary>
/// Gets the area the artist is primarily identified with, if applicable.
/// </summary>
public Optional<MusicArea> Area { get; private set; }
/// <summary>
/// Gets the area the artist began in, if applicable.
/// </summary>
public Optional<MusicArea> BeginArea { get; private set; }
/// <summary>
/// Gets the area the artist ended in, if applicable.
/// </summary>
public Optional<MusicArea> EndArea { get; private set; }
/// <summary>
/// Gets the date the artist started existing, if applicable.
/// </summary>
public Optional<DateOnly> LifeSpanBegin { get; private set; }
/// <summary>
/// Gets the date the artist stopped existing, if applicable.
/// </summary>
public Optional<DateOnly> LifeSpanEnd { get; private set; }
/// <summary>
/// Gets a value indicating whether the artist no longer exists.
/// </summary>
public bool IsEnded { get; private set; }
/// <summary>
/// Gets the website of the artist, if applicable.
/// </summary>
@@ -52,6 +113,36 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// </summary>
public Optional<MusicBrainzId> MusicBrainzArtistId { get; private set; }
/// <summary>
/// Gets the list of IPI (Interested Party Information) codes of the artist.
/// </summary>
public IReadOnlyCollection<string> Ipis => _ipis.AsReadOnly();
/// <summary>
/// Gets the list of ISNI (International Standard Name Identifier) codes of the artist.
/// </summary>
public IReadOnlyCollection<string> Isnis => _isnis.AsReadOnly();
/// <summary>
/// Gets the list of alternative names of the artist.
/// </summary>
public IReadOnlyCollection<MusicArtistAlias> Aliases => _aliases.AsReadOnly();
/// <summary>
/// Gets the list of genres associated with the artist.
/// </summary>
public IReadOnlyCollection<Genre> Genres => _genres.AsReadOnly();
/// <summary>
/// Gets the list of tags associated with the artist.
/// </summary>
public IReadOnlyCollection<Tag> Tags => _tags.AsReadOnly();
/// <summary>
/// Gets the list of ratings of the artist.
/// </summary>
public IReadOnlyCollection<AudioRating> Ratings => _ratings.AsReadOnly();
/// <summary>
/// Gets the list of the media contributors that make up the artist.
/// </summary>
@@ -68,8 +159,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// <param name="id">The object representing the unique identifier of the artist.</param>
/// <param name="libraryId">The Id of the media library this artist belongs to.</param>
/// <param name="name">The name of the artist.</param>
/// <param name="sortName">The optional sort name of the artist.</param>
/// <param name="disambiguation">The optional disambiguation comment of the artist.</param>
/// <param name="type">The optional type of the artist.</param>
/// <param name="gender">The optional gender of the artist.</param>
/// <param name="country">The optional ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">The optional area the artist is primarily identified with.</param>
/// <param name="beginArea">The optional area the artist began in.</param>
/// <param name="endArea">The optional area the artist ended in.</param>
/// <param name="lifeSpanBegin">The optional date the artist started existing.</param>
/// <param name="lifeSpanEnd">The optional date the artist stopped existing.</param>
/// <param name="isEnded">Whether the artist no longer exists.</param>
/// <param name="website">The optional website of the artist.</param>
/// <param name="musicBrainzArtistId">The optional MusicBrainz identifier of the artist.</param>
/// <param name="ipis">The list of IPI codes of the artist.</param>
/// <param name="isnis">The list of ISNI codes of the artist.</param>
/// <param name="aliases">The list of alternative names of the artist.</param>
/// <param name="genres">The list of genres associated with the artist.</param>
/// <param name="tags">The list of tags associated with the artist.</param>
/// <param name="ratings">The list of ratings of the artist.</param>
/// <param name="contributors">The list of the media contributors that make up the artist.</param>
/// <param name="albums">The list of albums of the artist.</param>
/// <param name="createdOnUtc">The date and time when the entity was created.</param>
@@ -78,8 +186,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
ArtistId id,
LibraryId libraryId,
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<MusicArtistType> type,
Optional<MusicArtistGender> gender,
Optional<string> country,
Optional<MusicArea> area,
Optional<MusicArea> beginArea,
Optional<MusicArea> endArea,
Optional<DateOnly> lifeSpanBegin,
Optional<DateOnly> lifeSpanEnd,
bool isEnded,
Optional<string> website,
Optional<MusicBrainzId> musicBrainzArtistId,
List<string> ipis,
List<string> isnis,
List<MusicArtistAlias> aliases,
List<Genre> genres,
List<Tag> tags,
List<AudioRating> ratings,
List<MusicMediaContributor> contributors,
List<Album> albums,
DateTime createdOnUtc,
@@ -88,8 +213,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
Id = id;
LibraryId = libraryId;
Name = name;
SortName = sortName;
Disambiguation = disambiguation;
Type = type;
Gender = gender;
Country = country;
Area = area;
BeginArea = beginArea;
EndArea = endArea;
LifeSpanBegin = lifeSpanBegin;
LifeSpanEnd = lifeSpanEnd;
IsEnded = isEnded;
Website = website;
MusicBrainzArtistId = musicBrainzArtistId;
_ipis = ipis;
_isnis = isnis;
_aliases = aliases;
_genres = genres;
_tags = tags;
_ratings = ratings;
_contributors = [.. contributors];
_albums = albums;
CreatedOnUtc = createdOnUtc;
@@ -101,8 +243,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// </summary>
/// <param name="libraryId">The Id of the media library this artist belongs to.</param>
/// <param name="name">The name of the artist.</param>
/// <param name="sortName">The optional sort name of the artist.</param>
/// <param name="disambiguation">The optional disambiguation comment of the artist.</param>
/// <param name="type">The optional type of the artist.</param>
/// <param name="gender">The optional gender of the artist.</param>
/// <param name="country">The optional ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">The optional area the artist is primarily identified with.</param>
/// <param name="beginArea">The optional area the artist began in.</param>
/// <param name="endArea">The optional area the artist ended in.</param>
/// <param name="lifeSpanBegin">The optional date the artist started existing.</param>
/// <param name="lifeSpanEnd">The optional date the artist stopped existing.</param>
/// <param name="isEnded">Whether the artist no longer exists.</param>
/// <param name="website">The optional website of the artist.</param>
/// <param name="musicBrainzArtistId">The optional MusicBrainz identifier of the artist.</param>
/// <param name="ipis">The list of IPI codes of the artist.</param>
/// <param name="isnis">The list of ISNI codes of the artist.</param>
/// <param name="aliases">The list of alternative names of the artist.</param>
/// <param name="genres">The list of genres associated with the artist.</param>
/// <param name="tags">The list of tags associated with the artist.</param>
/// <param name="ratings">The list of ratings of the artist.</param>
/// <param name="contributors">The list of the media contributors that make up the artist.</param>
/// <param name="albums">The list of albums of the artist.</param>
/// <returns>
@@ -111,8 +270,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
public static Result<Artist> Create(
LibraryId libraryId,
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<MusicArtistType> type,
Optional<MusicArtistGender> gender,
Optional<string> country,
Optional<MusicArea> area,
Optional<MusicArea> beginArea,
Optional<MusicArea> endArea,
Optional<DateOnly> lifeSpanBegin,
Optional<DateOnly> lifeSpanEnd,
bool isEnded,
Optional<string> website,
Optional<MusicBrainzId> musicBrainzArtistId,
List<string> ipis,
List<string> isnis,
List<MusicArtistAlias> aliases,
List<Genre> genres,
List<Tag> tags,
List<AudioRating> ratings,
List<MusicMediaContributor> contributors,
List<Album> albums)
{
@@ -125,8 +301,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
ArtistId.CreateUnique(),
libraryId,
name,
sortName,
disambiguation,
type,
gender,
country,
area,
beginArea,
endArea,
lifeSpanBegin,
lifeSpanEnd,
isEnded,
website,
musicBrainzArtistId,
ipis,
isnis,
aliases,
genres,
tags,
ratings,
contributors,
albums,
DateTime.UtcNow, // TODO: should be IDateTimeProvider.
@@ -139,8 +332,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// <param name="id">The object representing the unique identifier of the artist.</param>
/// <param name="libraryId">The Id of the media library this artist belongs to.</param>
/// <param name="name">The name of the artist.</param>
/// <param name="sortName">The optional sort name of the artist.</param>
/// <param name="disambiguation">The optional disambiguation comment of the artist.</param>
/// <param name="type">The optional type of the artist.</param>
/// <param name="gender">The optional gender of the artist.</param>
/// <param name="country">The optional ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">The optional area the artist is primarily identified with.</param>
/// <param name="beginArea">The optional area the artist began in.</param>
/// <param name="endArea">The optional area the artist ended in.</param>
/// <param name="lifeSpanBegin">The optional date the artist started existing.</param>
/// <param name="lifeSpanEnd">The optional date the artist stopped existing.</param>
/// <param name="isEnded">Whether the artist no longer exists.</param>
/// <param name="website">The optional website of the artist.</param>
/// <param name="musicBrainzArtistId">The optional MusicBrainz identifier of the artist.</param>
/// <param name="ipis">The list of IPI codes of the artist.</param>
/// <param name="isnis">The list of ISNI codes of the artist.</param>
/// <param name="aliases">The list of alternative names of the artist.</param>
/// <param name="genres">The list of genres associated with the artist.</param>
/// <param name="tags">The list of tags associated with the artist.</param>
/// <param name="ratings">The list of ratings of the artist.</param>
/// <param name="contributors">The list of the media contributors that make up the artist.</param>
/// <param name="albums">The list of albums of the artist.</param>
/// <param name="createdOnUtc">The date and time when the entity was created.</param>
@@ -152,8 +362,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
ArtistId id,
LibraryId libraryId,
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<MusicArtistType> type,
Optional<MusicArtistGender> gender,
Optional<string> country,
Optional<MusicArea> area,
Optional<MusicArea> beginArea,
Optional<MusicArea> endArea,
Optional<DateOnly> lifeSpanBegin,
Optional<DateOnly> lifeSpanEnd,
bool isEnded,
Optional<string> website,
Optional<MusicBrainzId> musicBrainzArtistId,
List<string> ipis,
List<string> isnis,
List<MusicArtistAlias> aliases,
List<Genre> genres,
List<Tag> tags,
List<AudioRating> ratings,
List<MusicMediaContributor> contributors,
List<Album> albums,
DateTime createdOnUtc,
@@ -168,8 +395,25 @@ public sealed class Artist : AggregateRoot<ArtistId>
id,
libraryId,
name,
sortName,
disambiguation,
type,
gender,
country,
area,
beginArea,
endArea,
lifeSpanBegin,
lifeSpanEnd,
isEnded,
website,
musicBrainzArtistId,
ipis,
isnis,
aliases,
genres,
tags,
ratings,
contributors,
albums,
createdOnUtc,
@@ -216,14 +460,102 @@ public sealed class Artist : AggregateRoot<ArtistId>
}
/// <summary>
/// Updates the details of the artist, without touching the albums and the media contributors.
/// Replaces the aliases of the artist with the provided <paramref name="aliases"/>.
/// </summary>
/// <param name="aliases">The alternative names of the artist.</param>
public void UpdateAliases(IReadOnlyCollection<MusicArtistAlias> aliases)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_aliases.Clear();
_aliases.AddRange(aliases);
}
/// <summary>
/// Replaces the IPI codes of the artist with the provided <paramref name="ipis"/>.
/// </summary>
/// <param name="ipis">The IPI codes of the artist.</param>
public void UpdateIpis(IReadOnlyCollection<string> ipis)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_ipis.Clear();
_ipis.AddRange(ipis);
}
/// <summary>
/// Replaces the ISNI codes of the artist with the provided <paramref name="isnis"/>.
/// </summary>
/// <param name="isnis">The ISNI codes of the artist.</param>
public void UpdateIsnis(IReadOnlyCollection<string> isnis)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_isnis.Clear();
_isnis.AddRange(isnis);
}
/// <summary>
/// Replaces the genres of the artist with the provided <paramref name="genres"/>.
/// </summary>
/// <param name="genres">The genres of the artist.</param>
public void UpdateGenres(IReadOnlyCollection<Genre> genres)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_genres.Clear();
_genres.AddRange(genres);
}
/// <summary>
/// Replaces the tags of the artist with the provided <paramref name="tags"/>.
/// </summary>
/// <param name="tags">The tags of the artist.</param>
public void UpdateTags(IReadOnlyCollection<Tag> tags)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_tags.Clear();
_tags.AddRange(tags);
}
/// <summary>
/// Replaces the ratings of the artist with the provided <paramref name="ratings"/>.
/// </summary>
/// <param name="ratings">The ratings of the artist.</param>
public void UpdateRatings(IReadOnlyCollection<AudioRating> ratings)
{
// Replace the contents of the collection in place, preserving the readonly reference invariants of the aggregate.
_ratings.Clear();
_ratings.AddRange(ratings);
}
/// <summary>
/// Updates the details of the artist, without touching the albums, the contributors, and the media library metadata collections.
/// </summary>
/// <param name="name">The name of the artist.</param>
/// <param name="sortName">The optional sort name of the artist.</param>
/// <param name="disambiguation">The optional disambiguation comment of the artist.</param>
/// <param name="type">The optional type of the artist.</param>
/// <param name="gender">The optional gender of the artist.</param>
/// <param name="country">The optional ISO 3166-1 alpha-2 code of the country of the artist.</param>
/// <param name="area">The optional area the artist is primarily identified with.</param>
/// <param name="beginArea">The optional area the artist began in.</param>
/// <param name="endArea">The optional area the artist ended in.</param>
/// <param name="lifeSpanBegin">The optional date the artist started existing.</param>
/// <param name="lifeSpanEnd">The optional date the artist stopped existing.</param>
/// <param name="isEnded">Whether the artist no longer exists.</param>
/// <param name="website">The optional website of the artist.</param>
/// <param name="musicBrainzArtistId">The optional MusicBrainz identifier of the artist.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
public Result<Updated> UpdateDetails(
string name,
Optional<string> sortName,
Optional<string> disambiguation,
Optional<MusicArtistType> type,
Optional<MusicArtistGender> gender,
Optional<string> country,
Optional<MusicArea> area,
Optional<MusicArea> beginArea,
Optional<MusicArea> endArea,
Optional<DateOnly> lifeSpanBegin,
Optional<DateOnly> lifeSpanEnd,
bool isEnded,
Optional<string> website,
Optional<MusicBrainzId> musicBrainzArtistId)
{
@@ -231,6 +563,17 @@ public sealed class Artist : AggregateRoot<ArtistId>
return Errors.Music.ArtistNameCannotBeEmpty;
Name = name;
SortName = sortName;
Disambiguation = disambiguation;
Type = type;
Gender = gender;
Country = country;
Area = area;
BeginArea = beginArea;
EndArea = endArea;
LifeSpanBegin = lifeSpanBegin;
LifeSpanEnd = lifeSpanEnd;
IsEnded = isEnded;
Website = website;
MusicBrainzArtistId = musicBrainzArtistId;
UpdatedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
@@ -247,9 +590,14 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// </remarks>
/// <param name="album">The album to update.</param>
/// <param name="metadata">The album metadata of the album.</param>
/// <param name="disambiguation">The optional disambiguation comment of the album.</param>
/// <param name="mediaFormat">The optional physical or digital medium of the album.</param>
/// <param name="packaging">The optional outermost physical packaging of the album.</param>
/// <param name="script">The optional script used by the language of the release of the album.</param>
/// <param name="barcode">The optional barcode of the album.</param>
/// <param name="catalogNumber">The optional catalog number of the album.</param>
/// <param name="catalogNumbers">The catalog numbers of the album.</param>
/// <param name="label">The optional name of the label that issued the album.</param>
/// <param name="asin">The optional ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">The optional MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">The optional MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">The optional MusicBrainz identifier of the release artist.</param>
@@ -259,9 +607,14 @@ public sealed class Artist : AggregateRoot<ArtistId>
public Result<Updated> UpdateAlbum(
Album album,
AlbumMetadata metadata,
Optional<string> disambiguation,
Optional<MusicMediaFormat> mediaFormat,
Optional<MusicReleasePackaging> packaging,
Optional<string> script,
Optional<Barcode> barcode,
Optional<string> catalogNumber,
List<string> catalogNumbers,
Optional<string> label,
Optional<string> asin,
Optional<MusicBrainzId> musicBrainzReleaseId,
Optional<MusicBrainzId> musicBrainzReleaseGroupId,
Optional<MusicBrainzId> musicBrainzReleaseArtistId,
@@ -272,7 +625,7 @@ public sealed class Artist : AggregateRoot<ArtistId>
if (!_albums.Contains(album))
return Errors.Music.AlbumNotFound;
album.UpdateDetails(metadata, mediaFormat, barcode, catalogNumber, musicBrainzReleaseId, musicBrainzReleaseGroupId, musicBrainzReleaseArtistId);
album.UpdateDetails(metadata, disambiguation, mediaFormat, packaging, script, barcode, catalogNumbers, label, asin, musicBrainzReleaseId, musicBrainzReleaseGroupId, musicBrainzReleaseArtistId);
album.UpdateContributors(contributors);
album.UpdateRatings(ratings);
UpdatedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
@@ -296,10 +649,10 @@ public sealed class Artist : AggregateRoot<ArtistId>
/// <param name="script">The optional script used by the language of the track.</param>
/// <param name="key">The optional musical key of the track.</param>
/// <param name="bpm">The optional tempo of the track in beats per minute.</param>
/// <param name="work">The optional title of the work the track is a recording of.</param>
/// <param name="isVideo">Whether the recording of the track is a video recording.</param>
/// <param name="work">The optional work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">The optional MusicBrainz identifier of the recording.</param>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">The optional MusicBrainz identifier of the work.</param>
/// <param name="moods">The moods of the track.</param>
/// <param name="isrcs">The ISRCs of the track.</param>
/// <param name="contributors">The media contributors of the track.</param>
@@ -315,10 +668,10 @@ public sealed class Artist : AggregateRoot<ArtistId>
Optional<string> script,
Optional<MusicKey> key,
Optional<int> bpm,
Optional<string> work,
bool isVideo,
Optional<MusicWork> work,
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId,
Optional<MusicBrainzId> musicBrainzWorkId,
IReadOnlyCollection<Mood> moods,
IReadOnlyCollection<Isrc> isrcs,
IReadOnlyCollection<MusicMediaContributor> contributors,
@@ -338,10 +691,10 @@ public sealed class Artist : AggregateRoot<ArtistId>
script,
key,
bpm,
isVideo,
work,
musicBrainzRecordingId,
musicBrainzTrackId,
musicBrainzWorkId);
musicBrainzTrackId);
track.UpdateMoods(moods);
track.UpdateIsrcs(isrcs);
track.UpdateContributors(contributors);
@@ -21,26 +21,52 @@ public sealed class Album : Entity<AlbumId>
private readonly List<MusicMediaContributor> _contributors;
private readonly List<AudioRating> _ratings;
private readonly List<Track> _tracks;
private readonly List<string> _catalogNumbers;
/// <summary>
/// Gets the album metadata of the album.
/// </summary>
public AlbumMetadata Metadata { get; private set; }
/// <summary>
/// Gets the disambiguation comment of the album, used to distinguish albums with the same title, if applicable.
/// </summary>
public Optional<string> Disambiguation { get; private set; }
/// <summary>
/// Gets the physical or digital medium of the album, if applicable.
/// </summary>
public Optional<MusicMediaFormat> MediaFormat { get; private set; }
/// <summary>
/// Gets the outermost physical packaging of the album, if applicable.
/// </summary>
public Optional<MusicReleasePackaging> Packaging { get; private set; }
/// <summary>
/// Gets the script used by the language of the release of the album, if applicable.
/// </summary>
public Optional<string> Script { get; private set; }
/// <summary>
/// Gets the barcode of the album, if applicable.
/// </summary>
public Optional<Barcode> Barcode { get; private set; }
/// <summary>
/// Gets the catalog number of the album, if applicable.
/// Gets the catalog numbers of the album.
/// </summary>
public Optional<string> CatalogNumber { get; private set; }
public IReadOnlyCollection<string> CatalogNumbers => _catalogNumbers.AsReadOnly();
/// <summary>
/// Gets the name of the label that issued the album, if applicable.
/// </summary>
public Optional<string> Label { get; private set; }
/// <summary>
/// Gets the ASIN (Amazon Standard Identification Number) of the album, if applicable.
/// </summary>
public Optional<string> ASIN { get; private set; }
/// <summary>
/// Gets the MusicBrainz identifier of the release, if applicable.
@@ -77,9 +103,14 @@ public sealed class Album : Entity<AlbumId>
/// </summary>
/// <param name="id">The object representing the unique identifier of the album.</param>
/// <param name="metadata">The album metadata of the album.</param>
/// <param name="disambiguation">The optional disambiguation comment of the album.</param>
/// <param name="mediaFormat">The optional physical or digital medium of the album.</param>
/// <param name="packaging">The optional outermost physical packaging of the album.</param>
/// <param name="script">The optional script used by the language of the release of the album.</param>
/// <param name="barcode">The optional barcode of the album.</param>
/// <param name="catalogNumber">The optional catalog number of the album.</param>
/// <param name="catalogNumbers">The catalog numbers of the album.</param>
/// <param name="label">The optional name of the label that issued the album.</param>
/// <param name="asin">The optional ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">The optional MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">The optional MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">The optional MusicBrainz identifier of the release artist.</param>
@@ -91,9 +122,14 @@ public sealed class Album : Entity<AlbumId>
private Album(
AlbumId id,
AlbumMetadata metadata,
Optional<string> disambiguation,
Optional<MusicMediaFormat> mediaFormat,
Optional<MusicReleasePackaging> packaging,
Optional<string> script,
Optional<Barcode> barcode,
Optional<string> catalogNumber,
List<string> catalogNumbers,
Optional<string> label,
Optional<string> asin,
Optional<MusicBrainzId> musicBrainzReleaseId,
Optional<MusicBrainzId> musicBrainzReleaseGroupId,
Optional<MusicBrainzId> musicBrainzReleaseArtistId,
@@ -105,9 +141,14 @@ public sealed class Album : Entity<AlbumId>
{
Id = id;
Metadata = metadata;
Disambiguation = disambiguation;
MediaFormat = mediaFormat;
Packaging = packaging;
Script = script;
Barcode = barcode;
CatalogNumber = catalogNumber;
_catalogNumbers = catalogNumbers;
Label = label;
ASIN = asin;
MusicBrainzReleaseId = musicBrainzReleaseId;
MusicBrainzReleaseGroupId = musicBrainzReleaseGroupId;
MusicBrainzReleaseArtistId = musicBrainzReleaseArtistId;
@@ -122,9 +163,14 @@ public sealed class Album : Entity<AlbumId>
/// Creates a new instance of the <see cref="Album"/> class.
/// </summary>
/// <param name="metadata">The album metadata of the album.</param>
/// <param name="disambiguation">The optional disambiguation comment of the album.</param>
/// <param name="mediaFormat">The optional physical or digital medium of the album.</param>
/// <param name="packaging">The optional outermost physical packaging of the album.</param>
/// <param name="script">The optional script used by the language of the release of the album.</param>
/// <param name="barcode">The optional barcode of the album.</param>
/// <param name="catalogNumber">The optional catalog number of the album.</param>
/// <param name="catalogNumbers">The catalog numbers of the album.</param>
/// <param name="label">The optional name of the label that issued the album.</param>
/// <param name="asin">The optional ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">The optional MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">The optional MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">The optional MusicBrainz identifier of the release artist.</param>
@@ -136,9 +182,14 @@ public sealed class Album : Entity<AlbumId>
/// </returns>
public static Result<Album> Create(
AlbumMetadata metadata,
Optional<string> disambiguation,
Optional<MusicMediaFormat> mediaFormat,
Optional<MusicReleasePackaging> packaging,
Optional<string> script,
Optional<Barcode> barcode,
Optional<string> catalogNumber,
List<string> catalogNumbers,
Optional<string> label,
Optional<string> asin,
Optional<MusicBrainzId> musicBrainzReleaseId,
Optional<MusicBrainzId> musicBrainzReleaseGroupId,
Optional<MusicBrainzId> musicBrainzReleaseArtistId,
@@ -149,9 +200,14 @@ public sealed class Album : Entity<AlbumId>
return new Album(
AlbumId.CreateUnique(),
metadata,
disambiguation,
mediaFormat,
packaging,
script,
barcode,
catalogNumber,
catalogNumbers,
label,
asin,
musicBrainzReleaseId,
musicBrainzReleaseGroupId,
musicBrainzReleaseArtistId,
@@ -167,9 +223,14 @@ public sealed class Album : Entity<AlbumId>
/// </summary>
/// <param name="id">The object representing the unique identifier of the album.</param>
/// <param name="metadata">The album metadata of the album.</param>
/// <param name="disambiguation">The optional disambiguation comment of the album.</param>
/// <param name="mediaFormat">The optional physical or digital medium of the album.</param>
/// <param name="packaging">The optional outermost physical packaging of the album.</param>
/// <param name="script">The optional script used by the language of the release of the album.</param>
/// <param name="barcode">The optional barcode of the album.</param>
/// <param name="catalogNumber">The optional catalog number of the album.</param>
/// <param name="catalogNumbers">The catalog numbers of the album.</param>
/// <param name="label">The optional name of the label that issued the album.</param>
/// <param name="asin">The optional ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">The optional MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">The optional MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">The optional MusicBrainz identifier of the release artist.</param>
@@ -184,9 +245,14 @@ public sealed class Album : Entity<AlbumId>
public static Result<Album> Create(
AlbumId id,
AlbumMetadata metadata,
Optional<string> disambiguation,
Optional<MusicMediaFormat> mediaFormat,
Optional<MusicReleasePackaging> packaging,
Optional<string> script,
Optional<Barcode> barcode,
Optional<string> catalogNumber,
List<string> catalogNumbers,
Optional<string> label,
Optional<string> asin,
Optional<MusicBrainzId> musicBrainzReleaseId,
Optional<MusicBrainzId> musicBrainzReleaseGroupId,
Optional<MusicBrainzId> musicBrainzReleaseArtistId,
@@ -199,9 +265,14 @@ public sealed class Album : Entity<AlbumId>
return new Album(
id,
metadata,
disambiguation,
mediaFormat,
packaging,
script,
barcode,
catalogNumber,
catalogNumbers,
label,
asin,
musicBrainzReleaseId,
musicBrainzReleaseGroupId,
musicBrainzReleaseArtistId,
@@ -264,26 +335,42 @@ public sealed class Album : Entity<AlbumId>
/// Updates the details of the album, without touching the ratings, the media contributors, and the tracks.
/// </summary>
/// <param name="metadata">The album metadata of the album.</param>
/// <param name="disambiguation">The optional disambiguation comment of the album.</param>
/// <param name="mediaFormat">The optional physical or digital medium of the album.</param>
/// <param name="packaging">The optional outermost physical packaging of the album.</param>
/// <param name="script">The optional script used by the language of the release of the album.</param>
/// <param name="barcode">The optional barcode of the album.</param>
/// <param name="catalogNumber">The optional catalog number of the album.</param>
/// <param name="catalogNumbers">The catalog numbers of the album.</param>
/// <param name="label">The optional name of the label that issued the album.</param>
/// <param name="asin">The optional ASIN of the album.</param>
/// <param name="musicBrainzReleaseId">The optional MusicBrainz identifier of the release.</param>
/// <param name="musicBrainzReleaseGroupId">The optional MusicBrainz identifier of the release group.</param>
/// <param name="musicBrainzReleaseArtistId">The optional MusicBrainz identifier of the release artist.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
internal Result<Updated> UpdateDetails(
AlbumMetadata metadata,
Optional<string> disambiguation,
Optional<MusicMediaFormat> mediaFormat,
Optional<MusicReleasePackaging> packaging,
Optional<string> script,
Optional<Barcode> barcode,
Optional<string> catalogNumber,
List<string> catalogNumbers,
Optional<string> label,
Optional<string> asin,
Optional<MusicBrainzId> musicBrainzReleaseId,
Optional<MusicBrainzId> musicBrainzReleaseGroupId,
Optional<MusicBrainzId> musicBrainzReleaseArtistId)
{
Metadata = metadata;
Disambiguation = disambiguation;
MediaFormat = mediaFormat;
Packaging = packaging;
Script = script;
Barcode = barcode;
CatalogNumber = catalogNumber;
_catalogNumbers.Clear();
_catalogNumbers.AddRange(catalogNumbers);
Label = label;
ASIN = asin;
MusicBrainzReleaseId = musicBrainzReleaseId;
MusicBrainzReleaseGroupId = musicBrainzReleaseGroupId;
MusicBrainzReleaseArtistId = musicBrainzReleaseArtistId;
@@ -34,6 +34,11 @@ public sealed class Track : Entity<TrackId>
/// </summary>
public AudioMetadata Metadata { get; private set; }
/// <summary>
/// Gets the disambiguation comment of the track, used to distinguish tracks with the same title, if applicable.
/// </summary>
public Optional<string> Disambiguation { get; private set; }
/// <summary>
/// Gets the number of the track on its disc.
/// </summary>
@@ -60,9 +65,14 @@ public sealed class Track : Entity<TrackId>
public Optional<int> Bpm { get; private set; }
/// <summary>
/// Gets the title of the work the track is a recording of, if applicable.
/// Gets a value indicating whether the recording of the track is a video recording.
/// </summary>
public Optional<string> Work { get; private set; }
public bool IsVideo { get; private set; }
/// <summary>
/// Gets the work the track is a recording of, if applicable.
/// </summary>
public Optional<MusicWork> Work { get; private set; }
/// <summary>
/// Gets the MusicBrainz identifier of the recording, if applicable.
@@ -74,11 +84,6 @@ public sealed class Track : Entity<TrackId>
/// </summary>
public Optional<MusicBrainzId> MusicBrainzTrackId { get; private set; }
/// <summary>
/// Gets the MusicBrainz identifier of the work, if applicable.
/// </summary>
public Optional<MusicBrainzId> MusicBrainzWorkId { get; private set; }
/// <summary>
/// Gets the list of moods of the track.
/// </summary>
@@ -105,36 +110,38 @@ public sealed class Track : Entity<TrackId>
/// <param name="id">The object representing the unique identifier of the track.</param>
/// <param name="path">The file system path of the track.</param>
/// <param name="metadata">The audio metadata of the track.</param>
/// <param name="disambiguation">The optional disambiguation comment of the track.</param>
/// <param name="trackNumber">The number of the track on its disc.</param>
/// <param name="discNumber">The optional number of the disc the track belongs to.</param>
/// <param name="moods">The list of moods of the track.</param>
/// <param name="script">The optional script used by the language of the track.</param>
/// <param name="key">The optional musical key of the track.</param>
/// <param name="bpm">The optional tempo of the track in beats per minute.</param>
/// <param name="isVideo">Whether the recording of the track is a video recording.</param>
/// <param name="isrcs">The list of ISRC of the track.</param>
/// <param name="work">The optional title of the work the track is a recording of.</param>
/// <param name="work">The optional work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">The optional MusicBrainz identifier of the recording.</param>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">The optional MusicBrainz identifier of the work.</param>
/// <param name="contributors">The list of the media contributors of the track.</param>
/// <param name="ratings">The list of ratings for the track.</param>
/// <param name="ratings">The list of ratings of the track.</param>
/// <param name="createdOnUtc">The date and time when the entity was created.</param>
/// <param name="updatedOnUtc">The date and time when the entity was last updated.</param>
private Track(
TrackId id,
string path,
AudioMetadata metadata,
Optional<string> disambiguation,
int trackNumber,
Optional<int> discNumber,
List<Mood> moods,
Optional<string> script,
Optional<MusicKey> key,
Optional<int> bpm,
bool isVideo,
List<Isrc> isrcs,
Optional<string> work,
Optional<MusicWork> work,
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId,
Optional<MusicBrainzId> musicBrainzWorkId,
List<MusicMediaContributor> contributors,
List<AudioRating> ratings,
DateTime createdOnUtc,
@@ -143,6 +150,7 @@ public sealed class Track : Entity<TrackId>
Id = id;
Path = path;
Metadata = metadata;
Disambiguation = disambiguation;
TrackNumber = trackNumber;
DiscNumber = discNumber;
_moods = moods;
@@ -150,10 +158,10 @@ public sealed class Track : Entity<TrackId>
Script = script;
Key = key;
Bpm = bpm;
IsVideo = isVideo;
Work = work;
MusicBrainzRecordingId = musicBrainzRecordingId;
MusicBrainzTrackId = musicBrainzTrackId;
MusicBrainzWorkId = musicBrainzWorkId;
_contributors = contributors;
_ratings = ratings;
CreatedOnUtc = createdOnUtc;
@@ -165,36 +173,38 @@ public sealed class Track : Entity<TrackId>
/// </summary>
/// <param name="path">The file system path of the track.</param>
/// <param name="metadata">The audio metadata of the track.</param>
/// <param name="disambiguation">The optional disambiguation comment of the track.</param>
/// <param name="trackNumber">The number of the track on its disc.</param>
/// <param name="discNumber">The optional number of the disc the track belongs to.</param>
/// <param name="moods">The list of moods of the track.</param>
/// <param name="script">The optional script used by the language of the track.</param>
/// <param name="key">The optional musical key of the track.</param>
/// <param name="bpm">The optional tempo of the track in beats per minute.</param>
/// <param name="isVideo">Whether the recording of the track is a video recording.</param>
/// <param name="isrcs">The list of ISRC of the track.</param>
/// <param name="work">The optional title of the work the track is a recording of.</param>
/// <param name="work">The optional work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">The optional MusicBrainz identifier of the recording.</param>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">The optional MusicBrainz identifier of the work.</param>
/// <param name="contributors">The list of the media contributors of the track.</param>
/// <param name="ratings">The list of ratings for the track.</param>
/// <param name="ratings">The list of ratings of the track.</param>
/// <returns>
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="Track"/>, or an error message.
/// </returns>
public static Result<Track> Create(
string path,
AudioMetadata metadata,
Optional<string> disambiguation,
int trackNumber,
Optional<int> discNumber,
List<Mood> moods,
Optional<string> script,
Optional<MusicKey> key,
Optional<int> bpm,
bool isVideo,
List<Isrc> isrcs,
Optional<string> work,
Optional<MusicWork> work,
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId,
Optional<MusicBrainzId> musicBrainzWorkId,
List<MusicMediaContributor> contributors,
List<AudioRating> ratings)
{
@@ -202,17 +212,18 @@ public sealed class Track : Entity<TrackId>
TrackId.CreateUnique(),
path,
metadata,
disambiguation,
trackNumber,
discNumber,
moods,
script,
key,
bpm,
isVideo,
isrcs,
work,
musicBrainzRecordingId,
musicBrainzTrackId,
musicBrainzWorkId,
contributors,
ratings,
DateTime.UtcNow, // TODO: should be IDateTimeProvider
@@ -225,19 +236,20 @@ public sealed class Track : Entity<TrackId>
/// <param name="id">The object representing the unique identifier of the track.</param>
/// <param name="path">The file system path of the track.</param>
/// <param name="metadata">The audio metadata of the track.</param>
/// <param name="disambiguation">The optional disambiguation comment of the track.</param>
/// <param name="trackNumber">The number of the track on its disc.</param>
/// <param name="discNumber">The optional number of the disc the track belongs to.</param>
/// <param name="moods">The list of moods of the track.</param>
/// <param name="script">The optional script used by the language of the track.</param>
/// <param name="key">The optional musical key of the track.</param>
/// <param name="bpm">The optional tempo of the track in beats per minute.</param>
/// <param name="isVideo">Whether the recording of the track is a video recording.</param>
/// <param name="isrcs">The list of ISRC of the track.</param>
/// <param name="work">The optional title of the work the track is a recording of.</param>
/// <param name="work">The optional work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">The optional MusicBrainz identifier of the recording.</param>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">The optional MusicBrainz identifier of the work.</param>
/// <param name="contributors">The list of the media contributors of the track.</param>
/// <param name="ratings">The list of ratings for the track.</param>
/// <param name="ratings">The list of ratings of the track.</param>
/// <param name="createdOnUtc">The date and time when the entity was created.</param>
/// <param name="updatedOnUtc">The date and time when the entity was last updated.</param>
/// <returns>
@@ -247,17 +259,18 @@ public sealed class Track : Entity<TrackId>
TrackId id,
string path,
AudioMetadata metadata,
Optional<string> disambiguation,
int trackNumber,
Optional<int> discNumber,
List<Mood> moods,
Optional<string> script,
Optional<MusicKey> key,
Optional<int> bpm,
bool isVideo,
List<Isrc> isrcs,
Optional<string> work,
Optional<MusicWork> work,
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId,
Optional<MusicBrainzId> musicBrainzWorkId,
List<MusicMediaContributor> contributors,
List<AudioRating> ratings,
DateTime createdOnUtc,
@@ -267,17 +280,18 @@ public sealed class Track : Entity<TrackId>
id,
path,
metadata,
disambiguation,
trackNumber,
discNumber,
moods,
script,
key,
bpm,
isVideo,
isrcs,
work,
musicBrainzRecordingId,
musicBrainzTrackId,
musicBrainzWorkId,
contributors,
ratings,
createdOnUtc,
@@ -338,10 +352,10 @@ public sealed class Track : Entity<TrackId>
/// <param name="script">The optional script used by the language of the track.</param>
/// <param name="key">The optional musical key of the track.</param>
/// <param name="bpm">The optional tempo of the track in beats per minute.</param>
/// <param name="work">The optional title of the work the track is a recording of.</param>
/// <param name="isVideo">Whether the recording of the track is a video recording.</param>
/// <param name="work">The optional work the track is a recording of.</param>
/// <param name="musicBrainzRecordingId">The optional MusicBrainz identifier of the recording.</param>
/// <param name="musicBrainzTrackId">The optional MusicBrainz identifier of the track.</param>
/// <param name="musicBrainzWorkId">The optional MusicBrainz identifier of the work.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
internal Result<Updated> UpdateDetails(
string path,
@@ -351,10 +365,10 @@ public sealed class Track : Entity<TrackId>
Optional<string> script,
Optional<MusicKey> key,
Optional<int> bpm,
Optional<string> work,
bool isVideo,
Optional<MusicWork> work,
Optional<MusicBrainzId> musicBrainzRecordingId,
Optional<MusicBrainzId> musicBrainzTrackId,
Optional<MusicBrainzId> musicBrainzWorkId)
Optional<MusicBrainzId> musicBrainzTrackId)
{
Path = path;
Metadata = metadata;
@@ -363,10 +377,10 @@ public sealed class Track : Entity<TrackId>
Script = script;
Key = key;
Bpm = bpm;
IsVideo = isVideo;
Work = work;
MusicBrainzRecordingId = musicBrainzRecordingId;
MusicBrainzTrackId = musicBrainzTrackId;
MusicBrainzWorkId = musicBrainzWorkId;
UpdatedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
return Result.Updated;
}
@@ -14,10 +14,18 @@ namespace Lumina.Domain.Core.BoundedContexts.AudioLibraryBoundedContext.MusicLib
[DebuggerDisplay("{Title}")]
public class AlbumMetadata : BaseMetadata
{
private readonly List<MusicReleaseType> _releaseTypes;
/// <summary>
/// Gets the type of the release, if applicable.
/// Gets the title of the specific release (edition) the album files match, if different from the release group title.
/// </summary>
public Optional<MusicReleaseType> ReleaseType { get; }
public Optional<string> ReleaseTitle { get; }
/// <summary>
/// Gets the set of types of the release, if applicable.
/// A MusicBrainz release group can carry more than one type at the same time, for example an album that is also a compilation.
/// </summary>
public IReadOnlyCollection<MusicReleaseType> ReleaseTypes => _releaseTypes.AsReadOnly();
/// <summary>
/// Gets the status of the release, if applicable.
@@ -39,32 +47,35 @@ public class AlbumMetadata : BaseMetadata
/// </summary>
/// <param name="title">The title of the album.</param>
/// <param name="originalTitle">The optional original title of the album, if applicable.</param>
/// <param name="releaseTitle">The optional title of the specific release (edition) of the album.</param>
/// <param name="description">The description of the album, if applicable.</param>
/// <param name="releaseInfo">The release information of the album.</param>
/// <param name="genres">The genres of the album.</param>
/// <param name="tags">The tags associated with the album.</param>
/// <param name="language">The language of the album, if applicable.</param>
/// <param name="originalLanguage">The optional original language of the album, if applicable.</param>
/// <param name="releaseType">The optional type of the release.</param>
/// <param name="releaseTypes">The set of types of the release, if applicable.</param>
/// <param name="releaseStatus">The optional status of the release.</param>
/// <param name="totalDiscs">The optional number of discs of the release.</param>
/// <param name="totalTracks">The number of tracks of the release.</param>
private AlbumMetadata(
string title,
Optional<string> originalTitle,
Optional<string> releaseTitle,
Optional<string> description,
ReleaseInfo releaseInfo,
List<Genre> genres,
List<Tag> tags,
Optional<LanguageInfo> language,
Optional<LanguageInfo> originalLanguage,
Optional<MusicReleaseType> releaseType,
List<MusicReleaseType> releaseTypes,
Optional<MusicReleaseStatus> releaseStatus,
Optional<int> totalDiscs,
int totalTracks)
: base(title, originalTitle, description, releaseInfo, genres, tags, language, originalLanguage)
{
ReleaseType = releaseType;
ReleaseTitle = releaseTitle;
_releaseTypes = releaseTypes;
ReleaseStatus = releaseStatus;
TotalDiscs = totalDiscs;
TotalTracks = totalTracks;
@@ -75,13 +86,14 @@ public class AlbumMetadata : BaseMetadata
/// </summary>
/// <param name="title">The title of the album.</param>
/// <param name="originalTitle">The optional original title of the album, if applicable.</param>
/// <param name="releaseTitle">The optional title of the specific release (edition) of the album.</param>
/// <param name="description">The description of the album, if applicable.</param>
/// <param name="releaseInfo">The release information of the album.</param>
/// <param name="genres">The genres of the album.</param>
/// <param name="tags">The tags associated with the album.</param>
/// <param name="language">The language of the album, if applicable.</param>
/// <param name="originalLanguage">The optional original language of the album, if applicable.</param>
/// <param name="releaseType">The optional type of the release.</param>
/// <param name="releaseTypes">The set of types of the release, if applicable.</param>
/// <param name="releaseStatus">The optional status of the release.</param>
/// <param name="totalDiscs">The optional number of discs of the release.</param>
/// <param name="totalTracks">The number of tracks of the release.</param>
@@ -91,13 +103,14 @@ public class AlbumMetadata : BaseMetadata
public static Result<AlbumMetadata> Create(
string title,
Optional<string> originalTitle,
Optional<string> releaseTitle,
Optional<string> description,
ReleaseInfo releaseInfo,
List<Genre> genres,
List<Tag> tags,
Optional<LanguageInfo> language,
Optional<LanguageInfo> originalLanguage,
Optional<MusicReleaseType> releaseType,
List<MusicReleaseType> releaseTypes,
Optional<MusicReleaseStatus> releaseStatus,
Optional<int> totalDiscs,
int totalTracks)
@@ -105,13 +118,14 @@ public class AlbumMetadata : BaseMetadata
return new AlbumMetadata(
title,
originalTitle,
releaseTitle,
description,
releaseInfo,
genres,
tags,
language,
originalLanguage,
releaseType,
releaseTypes,
releaseStatus,
totalDiscs,
totalTracks);
@@ -125,7 +139,9 @@ public class AlbumMetadata : BaseMetadata
{
foreach (object component in base.GetEqualityComponents())
yield return component;
yield return ReleaseType;
yield return ReleaseTitle;
foreach (MusicReleaseType releaseType in _releaseTypes)
yield return releaseType;
yield return ReleaseStatus;
yield return TotalDiscs;
yield return TotalTracks;