diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumCatalogNumberEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumCatalogNumberEntity.cs
new file mode 100644
index 00000000..76234755
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumCatalogNumberEntity.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for a catalog number of a music release. A release can carry more than one catalog number at the same time.
+///
+/// The catalog number assigned by the label.
+[DebuggerDisplay("CatalogNumber: {CatalogNumber}")]
+public record AlbumCatalogNumberEntity(
+ string CatalogNumber
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumEntity.cs
index 2a5c2330..c42bbf90 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumEntity.cs
@@ -2,6 +2,7 @@
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -40,11 +41,21 @@ public class AlbumEntity : IStorageEntity, IAuditableEntity
///
public string? OriginalTitle { get; set; }
+ ///
+ /// Gets or sets the title of the specific release (edition) the album files match, if different from the release group title.
+ ///
+ public string? ReleaseTitle { get; set; }
+
///
/// Gets or sets the description of the album, if applicable.
///
public string? Description { get; set; }
+ ///
+ /// Gets or sets the disambiguation comment of the album, used to distinguish albums with the same title, if applicable.
+ ///
+ public string? Disambiguation { get; set; }
+
///
/// Gets or sets the original release date of the album, if applicable.
///
@@ -106,9 +117,9 @@ public class AlbumEntity : IStorageEntity, IAuditableEntity
public string? OriginalLanguageNativeName { get; set; }
///
- /// Gets or sets the type of the release, if applicable.
+ /// Gets or sets the script used by the language of the release of the album, if applicable.
///
- public MusicReleaseType? ReleaseType { get; set; }
+ public string? Script { get; set; }
///
/// Gets or sets the status of the release, if applicable.
@@ -130,15 +141,30 @@ public class AlbumEntity : IStorageEntity, IAuditableEntity
///
public MusicMediaFormat? MediaFormat { get; set; }
+ ///
+ /// Gets or sets the outermost physical packaging of the album, if applicable.
+ ///
+ public MusicReleasePackaging? Packaging { get; set; }
+
///
/// Gets or sets the barcode of the album, if applicable.
///
public string? Barcode { get; set; }
///
- /// Gets or sets the catalog number of the album, if applicable.
+ /// Gets or sets the catalog numbers of the album.
///
- public string? CatalogNumber { get; set; }
+ public List CatalogNumbers { get; set; } = [];
+
+ ///
+ /// Gets or sets the name of the label that issued the album, if applicable.
+ ///
+ public string? Label { get; set; }
+
+ ///
+ /// Gets or sets the ASIN (Amazon Standard Identification Number) of the album, if applicable.
+ ///
+ public string? ASIN { get; set; }
///
/// Gets or sets the MusicBrainz identifier of the release, if applicable.
@@ -175,6 +201,11 @@ public class AlbumEntity : IStorageEntity, IAuditableEntity
///
public List Contributors { get; set; } = [];
+ ///
+ /// Gets or sets the types of the release. A release can carry more than one type at the same time.
+ ///
+ public List ReleaseTypes { get; set; } = [];
+
///
/// Gets or sets the genres of the album.
///
@@ -185,6 +216,21 @@ public class AlbumEntity : IStorageEntity, IAuditableEntity
///
public HashSet Tags { get; set; } = [];
+ ///
+ /// Gets or sets the status of the metadata enrichment of the album.
+ ///
+ public MetadataStatus MetadataStatus { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the metadata of the album was last enriched.
+ ///
+ public DateTime? LastMetadataUpdateUtc { get; set; }
+
+ ///
+ /// Gets or sets the name of the plugin that enriched the metadata of the album.
+ ///
+ public string? MetadataProvider { get; set; }
+
///
/// Gets or sets the time and date when the entity was added.
///
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumReleaseTypeEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumReleaseTypeEntity.cs
new file mode 100644
index 00000000..c39cc489
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/AlbumReleaseTypeEntity.cs
@@ -0,0 +1,15 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for a type of a music release. A release can carry more than one type at the same time.
+///
+/// The type of the release.
+[DebuggerDisplay("ReleaseType: {ReleaseType}")]
+public record AlbumReleaseTypeEntity(
+ MusicReleaseType ReleaseType
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistAliasEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistAliasEntity.cs
new file mode 100644
index 00000000..c802fd6f
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistAliasEntity.cs
@@ -0,0 +1,29 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity 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 record ArtistAliasEntity(
+ string Name,
+ string? SortName,
+ string? Type,
+ string? Locale,
+ bool IsPrimary,
+ DateOnly? BeginDate,
+ DateOnly? EndDate,
+ bool IsEnded
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistEntity.cs
index 5a01a28b..380683c4 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistEntity.cs
@@ -1,6 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -29,6 +30,46 @@ public class ArtistEntity : IStorageEntity, IAuditableEntity
///
public required string Name { get; set; }
+ ///
+ /// Gets or sets the sort name of the artist, a variant of the name used when sorting artists, if applicable.
+ ///
+ public string? SortName { get; set; }
+
+ ///
+ /// Gets or sets the disambiguation comment of the artist, used to distinguish artists with the same name, if applicable.
+ ///
+ public string? Disambiguation { get; set; }
+
+ ///
+ /// Gets or sets the type of the artist, if applicable.
+ ///
+ public MusicArtistType? Type { get; set; }
+
+ ///
+ /// Gets or sets the gender of the artist, applicable only to artists that are persons or characters, if applicable.
+ ///
+ public MusicArtistGender? Gender { get; set; }
+
+ ///
+ /// Gets or sets the ISO 3166-1 alpha-2 code of the country the artist is associated with, if applicable.
+ ///
+ public string? Country { get; set; }
+
+ ///
+ /// Gets or sets the date the artist started existing, if applicable.
+ ///
+ public DateOnly? LifeSpanBegin { get; set; }
+
+ ///
+ /// Gets or sets the date the artist stopped existing, if applicable.
+ ///
+ public DateOnly? LifeSpanEnd { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether the artist no longer exists.
+ ///
+ public bool IsEnded { get; set; }
+
///
/// Gets or sets the website of the artist, if applicable.
///
@@ -39,6 +80,51 @@ public class ArtistEntity : IStorageEntity, IAuditableEntity
///
public Guid? MusicBrainzArtistId { get; set; }
+ ///
+ /// Gets or sets the area the artist is primarily identified with, if applicable.
+ ///
+ public MusicAreaEntity? Area { get; set; }
+
+ ///
+ /// Gets or sets the area the artist began in, if applicable.
+ ///
+ public MusicAreaEntity? BeginArea { get; set; }
+
+ ///
+ /// Gets or sets the area the artist ended in, if applicable.
+ ///
+ public MusicAreaEntity? EndArea { get; set; }
+
+ ///
+ /// Gets or sets the list of alternative names of the artist.
+ ///
+ public List Aliases { get; set; } = [];
+
+ ///
+ /// Gets or sets the list of IPI (Interested Party Information) codes of the artist.
+ ///
+ public List Ipis { get; set; } = [];
+
+ ///
+ /// Gets or sets the list of ISNI (International Standard Name Identifier) codes of the artist.
+ ///
+ public List Isnis { get; set; } = [];
+
+ ///
+ /// Gets or sets the genres of the artist.
+ ///
+ public HashSet Genres { get; set; } = [];
+
+ ///
+ /// Gets or sets the tags of the artist.
+ ///
+ public HashSet Tags { get; set; } = [];
+
+ ///
+ /// Gets or sets the list of ratings of the artist.
+ ///
+ public List Ratings { get; set; } = [];
+
///
/// Gets or sets the albums of the artist.
///
@@ -49,6 +135,21 @@ public class ArtistEntity : IStorageEntity, IAuditableEntity
///
public List Contributors { get; set; } = [];
+ ///
+ /// Gets or sets the status of the metadata enrichment of the artist.
+ ///
+ public MetadataStatus MetadataStatus { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the metadata of the artist was last enriched.
+ ///
+ public DateTime? LastMetadataUpdateUtc { get; set; }
+
+ ///
+ /// Gets or sets the name of the plugin that enriched the metadata of the artist.
+ ///
+ public string? MetadataProvider { get; set; }
+
///
/// Gets or sets the time and date when the entity was added.
///
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIpiEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIpiEntity.cs
new file mode 100644
index 00000000..1b8644d6
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIpiEntity.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for an IPI (Interested Party Information) code of a music artist.
+///
+/// The value of the IPI code.
+[DebuggerDisplay("Value: {Value}")]
+public record ArtistIpiEntity(
+ string Value
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIsniEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIsniEntity.cs
new file mode 100644
index 00000000..ff3d5d63
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/ArtistIsniEntity.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for an ISNI (International Standard Name Identifier) code of a music artist.
+///
+/// The value of the ISNI code.
+[DebuggerDisplay("Value: {Value}")]
+public record ArtistIsniEntity(
+ string Value
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaEntity.cs
new file mode 100644
index 00000000..4902bf67
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicAreaEntity.cs
@@ -0,0 +1,25 @@
+#region ========================================================================= USING =====================================================================================
+using System;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity 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 record MusicAreaEntity(
+ Guid MusicBrainzAreaId,
+ string Name,
+ string? SortName,
+ string? Disambiguation,
+ string? Type,
+ string? Iso3166Code
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicLibraryScanItemMetadataEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicLibraryScanItemMetadataEntity.cs
new file mode 100644
index 00000000..8b943070
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/MusicLibraryScanItemMetadataEntity.cs
@@ -0,0 +1,171 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.Common;
+using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for the metadata extracted from a discovered music file, staged during a scan, before the artists, albums and tracks are materialized from it.
+///
+[DebuggerDisplay("Path: {Path}")]
+public class MusicLibraryScanItemMetadataEntity : IStorageEntity
+{
+ ///
+ /// Gets the Id of the staged music metadata.
+ ///
+ public required Guid Id { get; init; }
+
+ ///
+ /// Gets the Id of the media library scan that this staged music metadata belongs to.
+ ///
+ public required Guid LibraryScanId { get; init; }
+
+ ///
+ /// Gets the Id of the media library that this staged music metadata belongs to.
+ ///
+ public required Guid LibraryId { get; init; }
+
+ ///
+ /// Gets the file system path of the music file whose metadata was extracted.
+ ///
+ public required string Path { get; init; }
+
+ ///
+ /// Gets the name of the artist, if applicable.
+ ///
+ public string? ArtistName { get; set; }
+
+ ///
+ /// Gets the type of the release, if applicable.
+ ///
+ public MusicReleaseType? ReleaseType { get; set; }
+
+ ///
+ /// Gets the release year, if applicable.
+ ///
+ public int? ReleaseYear { get; set; }
+
+ ///
+ /// Gets the name of the release, if applicable.
+ ///
+ public string? ReleaseName { get; set; }
+
+ ///
+ /// Gets the title of the track, if applicable.
+ ///
+ public string? TrackTitle { get; set; }
+
+ ///
+ /// Gets the number of the track on its disc, if applicable.
+ ///
+ public int? TrackNumber { get; set; }
+
+ ///
+ /// Gets the number of the disc the track belongs to, if applicable.
+ ///
+ public int? DiscNumber { get; set; }
+
+ ///
+ /// Gets the duration of the audio in seconds.
+ ///
+ public int DurationInSeconds { get; set; }
+
+ ///
+ /// Gets the sample rate of the audio in Hz.
+ ///
+ public int SampleRate { get; set; }
+
+ ///
+ /// Gets the number of audio channels.
+ ///
+ public int Channels { get; set; }
+
+ ///
+ /// Gets the bit depth of the audio, if applicable.
+ ///
+ public int? BitDepth { get; set; }
+
+ ///
+ /// Gets the audio codec used, if applicable.
+ ///
+ public string? AudioCodec { get; set; }
+
+ ///
+ /// Gets or sets the bitrate of the audio in kbps, if applicable.
+ ///
+ public int? Bitrate { get; set; }
+
+ ///
+ /// Gets or sets the AcoustID fingerprint identifier of the audio file, if applicable.
+ ///
+ public string? AcoustId { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track gain in decibels, if applicable.
+ ///
+ public decimal? ReplayGainTrackGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track peak, if applicable.
+ ///
+ public decimal? ReplayGainTrackPeak { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album gain in decibels, if applicable.
+ ///
+ public decimal? ReplayGainAlbumGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album peak, if applicable.
+ ///
+ public decimal? ReplayGainAlbumPeak { get; set; }
+
+ ///
+ /// Gets or sets the moods of the track, read from the tags of the file.
+ ///
+ public List Moods { get; set; } = [];
+
+ ///
+ /// Gets the MusicBrainz identifier of the artist, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzArtistId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the release artist, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseArtistId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the release group, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseGroupId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the release, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzReleaseId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the recording, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzRecordingId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the track, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzTrackId { get; set; }
+
+ ///
+ /// Gets the MusicBrainz identifier of the work the track is a recording of, read from the tags of the file, if applicable.
+ ///
+ public Guid? MusicBrainzWorkId { get; set; }
+
+ ///
+ /// Gets the title of the work the track is a recording of, read from the tags of the file, if applicable.
+ ///
+ public string? WorkTitle { get; set; }
+}
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackEntity.cs
index 8ea83524..23a2794e 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackEntity.cs
@@ -2,6 +2,7 @@
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -50,6 +51,11 @@ public class TrackEntity : IStorageEntity, IAuditableEntity
///
public string? Description { get; set; }
+ ///
+ /// Gets or sets the disambiguation comment of the track, used to distinguish tracks with the same title, if applicable.
+ ///
+ public string? Disambiguation { get; set; }
+
///
/// Gets or sets the original release date of the track, if applicable.
///
@@ -140,6 +146,31 @@ public class TrackEntity : IStorageEntity, IAuditableEntity
///
public int? Bitrate { get; set; }
+ ///
+ /// Gets or sets the AcoustID fingerprint identifier of the audio file, if applicable.
+ ///
+ public string? AcoustId { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track gain in decibels, if applicable.
+ ///
+ public decimal? ReplayGainTrackGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain track peak, if applicable.
+ ///
+ public decimal? ReplayGainTrackPeak { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album gain in decibels, if applicable.
+ ///
+ public decimal? ReplayGainAlbumGain { get; set; }
+
+ ///
+ /// Gets or sets the ReplayGain album peak, if applicable.
+ ///
+ public decimal? ReplayGainAlbumPeak { get; set; }
+
///
/// Gets or sets the number of the track on its disc.
///
@@ -165,10 +196,20 @@ public class TrackEntity : IStorageEntity, IAuditableEntity
///
public int? Bpm { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the recording of the track is a video recording.
+ ///
+ public bool IsVideo { get; set; }
+
///
/// Gets or sets the title of the work the track is a recording of, if applicable.
///
- public string? Work { get; set; }
+ public string? WorkTitle { get; set; }
+
+ ///
+ /// Gets or sets the MusicBrainz type of the work the track is a recording of, if applicable.
+ ///
+ public string? WorkType { get; set; }
///
/// Gets or sets the MusicBrainz identifier of the recording, if applicable.
@@ -200,6 +241,16 @@ public class TrackEntity : IStorageEntity, IAuditableEntity
///
public List Isrcs { get; set; } = [];
+ ///
+ /// Gets or sets the list of the languages of the work the track is a recording of.
+ ///
+ public List WorkLanguages { get; set; } = [];
+
+ ///
+ /// Gets or sets the list of ISWC (International Standard Musical Work Code) of the work the track is a recording of.
+ ///
+ public List WorkIswcs { get; set; } = [];
+
///
/// Gets or sets the list of the media contributors of the track.
///
@@ -220,6 +271,21 @@ public class TrackEntity : IStorageEntity, IAuditableEntity
///
public HashSet Tags { get; set; } = [];
+ ///
+ /// Gets or sets the status of the metadata enrichment of the track.
+ ///
+ public MetadataStatus MetadataStatus { get; set; }
+
+ ///
+ /// Gets or sets the date and time when the metadata of the track was last enriched.
+ ///
+ public DateTime? LastMetadataUpdateUtc { get; set; }
+
+ ///
+ /// Gets or sets the name of the plugin that enriched the metadata of the track.
+ ///
+ public string? MetadataProvider { get; set; }
+
///
/// Gets or sets the time and date when the entity was added.
///
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkIswcEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkIswcEntity.cs
new file mode 100644
index 00000000..dbcfae5b
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkIswcEntity.cs
@@ -0,0 +1,14 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for an ISWC (International Standard Musical Work Code) of the work a track is a recording of.
+///
+/// The value of the ISWC.
+[DebuggerDisplay("Value: {Value}")]
+public record TrackWorkIswcEntity(
+ string Value
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkLanguageEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkLanguageEntity.cs
new file mode 100644
index 00000000..ff7197c1
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/AudioLibrary/MusicLibrary/TrackWorkLanguageEntity.cs
@@ -0,0 +1,18 @@
+#region ========================================================================= USING =====================================================================================
+using System.Diagnostics;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+
+///
+/// Repository entity for a language of the work a track is a recording of.
+///
+/// The ISO 639-1 two-letter language code.
+/// The full name of the language in English.
+/// The native name of the language, if applicable.
+[DebuggerDisplay("LanguageCode: {LanguageCode}")]
+public record TrackWorkLanguageEntity(
+ string LanguageCode,
+ string LanguageName,
+ string? NativeName
+);
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs
index 45779d8a..0cd1b059 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/WrittenContentLibrary/BookLibrary/BookEntity.cs
@@ -2,6 +2,7 @@
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs
index 718dc8cb..877e541b 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs
@@ -47,6 +47,11 @@ public class UserSettingsEntity : IStorageEntity, IAuditableEntity
///
public bool ShouldAggregateMetadataWhenMissing { get; set; }
+ ///
+ /// Gets or sets whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not.
+ ///
+ public bool ShouldAggregateArtworkWhenMissing { get; set; }
+
///
/// Gets or sets whether PDF books are rendered as page images for the user, or not. Rendering PDFs as images preserves the
/// original layout, but the pages are not selectable or searchable, unlike their text layer.
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
index 64ddf7cd..56ebf0c6 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/BookLibrary/IBookRepository.cs
@@ -40,6 +40,15 @@ public interface IBookRepository : IRepository,
/// An containing either the stored at the provided path, or an error.
Task> GetByPathAsync(Guid libraryId, string path, CancellationToken cancellationToken);
+ ///
+ /// Gets the subset of that is already used by a book of the library identified by .
+ ///
+ /// The Id of the library whose books are searched.
+ /// The book paths to check.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the paths that are already used, or an error.
+ Task>> GetExistingPathsAsync(Guid libraryId, IReadOnlyCollection paths, CancellationToken cancellationToken);
+
///
/// Gets a page of the books of the media library identified by whose metadata has not been enriched yet,
/// ordered by path, using keyset pagination.
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryScanStagingResultsRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryScanStagingResultsRepository.cs
index 8c042ba8..1174a464 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryScanStagingResultsRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/ILibraryScanStagingResultsRepository.cs
@@ -55,6 +55,15 @@ public interface ILibraryScanStagingResultsRepository : IRepositoryAn containing either the paths of the changed staging results, or an error.
Task>> GetChangedPathsAsync(Guid scanId, CancellationToken cancellationToken);
+ ///
+ /// Gets the paths of the media library scan staging results of the current scan that are new or changed, meaning they need their content hashed
+ /// and their metadata extracted.
+ ///
+ /// The unique identifier of the media library scan whose staging result paths are retrieved.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the paths of the staging results that need rehashing, or an error.
+ Task>> GetPathsNeedingRehashAsync(Guid scanId, CancellationToken cancellationToken);
+
///
/// Updates the content hashes of the provided media library scan staging results.
///
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IAlbumRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IAlbumRepository.cs
index f4103045..4ad209be 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IAlbumRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IAlbumRepository.cs
@@ -20,7 +20,8 @@ public interface IAlbumRepository : IRepository,
IInsertRepositoryAction,
IUpdateRepositoryAction,
IApplyUpdateRepositoryAction,
- IGetByIdRepositoryAction
+ IGetByIdRepositoryAction,
+ IDeleteByIdRepositoryAction
{
///
/// Gets all the albums of the artist identified by .
@@ -38,4 +39,67 @@ public interface IAlbumRepository : IRepository,
/// Cancellation token that can be used to stop the execution.
/// An containing either a paginated result of , or an error.
Task>> GetAlbumsLiteByArtistIdAsync(Guid artistId, PaginationDataDto? paginationData, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the album of the artist identified by that has the provided .
+ ///
+ /// The Id of the artist whose album is retrieved.
+ /// The title of the album to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the with the provided title, or an error.
+ Task> GetByTitleAsync(Guid artistId, string title, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the album of the artist identified by that owns a track stored in the provided .
+ ///
+ /// The Id of the artist whose album is retrieved.
+ /// The file system path of the album directory the album owns.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the owning the directory, or an error.
+ Task> GetByTrackDirectoryAsync(Guid artistId, string directoryPath, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the number of albums of the media library identified by whose metadata has not been enriched yet.
+ ///
+ /// The Id of the media library whose albums are counted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the number of albums needing their metadata enriched, or an error.
+ Task> GetAlbumsNeedingMetadataCountAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the number of albums of the media library identified by whose artwork has not been resolved yet,
+ /// meaning they have no artwork that is either enriched or confirmed as unavailable.
+ ///
+ /// The Id of the media library whose albums are counted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the number of albums needing their artwork resolved, or an error.
+ Task> GetAlbumsNeedingArtworkCountAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a page of the albums of the media library identified by whose artwork has not been resolved yet,
+ /// together with their artist, ordered by Id, excluding the provided albums.
+ ///
+ /// The Id of the media library whose albums are retrieved.
+ /// The Ids of the albums that were already processed in the current run and must not be retrieved again.
+ /// The maximum number of albums to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either a page of albums needing their artwork resolved, or an error.
+ Task>> GetAlbumsNeedingArtworkAsync(Guid libraryId, IReadOnlyCollection excludedAlbumIds, int pageSize, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the file system path of one track of each of the albums identified by , keyed by the Id of the album.
+ ///
+ /// The Ids of the albums whose track path is retrieved.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the file system path of a track of each album, or an error.
+ Task>> GetFirstTrackPathsByAlbumIdsAsync(IReadOnlyCollection albumIds, CancellationToken cancellationToken);
+
+ ///
+ /// Resets the metadata enrichment status of all the albums of the media library identified by ,
+ /// so that they are re-enriched, because the metadata provider configuration of the library changed.
+ ///
+ /// The Id of the media library whose albums are reset.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
index b15e7717..1cc604ac 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IArtistRepository.cs
@@ -3,7 +3,11 @@ using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.Mu
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
+using Lumina.Domain.Common.Primitives;
using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
@@ -19,4 +23,59 @@ public interface IArtistRepository : IRepository,
IGetAllLiteRepositoryAction,
IDeleteByIdRepositoryAction
{
+ ///
+ /// Gets the artist of the library identified by that has the provided .
+ ///
+ /// The Id of the library whose artist is retrieved.
+ /// The name of the artist to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the with the provided name, or an error.
+ Task> GetByNameAsync(Guid libraryId, string name, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a page of the artists of the media library identified by whose metadata has not been enriched yet,
+ /// together with their albums and tracks and the collections needed to enrich them, ordered by name, using keyset pagination.
+ ///
+ /// The Id of the media library whose artists are retrieved.
+ /// The name of the last retrieved artist, used for keyset pagination. Pass to get the first page.
+ /// The maximum number of artists to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either a page of artists needing their metadata enriched, or an error.
+ Task>> GetArtistsNeedingMetadataAsync(Guid libraryId, string? lastName, int pageSize, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the number of artists of the media library identified by whose metadata has not been enriched yet.
+ ///
+ /// The Id of the media library whose artists are counted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the number of artists needing their metadata enriched, or an error.
+ Task> GetArtistsNeedingMetadataCountAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the number of artists of the media library identified by whose artwork has not been resolved yet.
+ ///
+ /// The Id of the media library whose artists are counted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the number of artists needing their artwork resolved, or an error.
+ Task> GetArtistsNeedingArtworkCountAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a page of the artists of the media library identified by whose artwork has not been resolved yet,
+ /// together with their albums and tracks, ordered by name, using keyset pagination.
+ ///
+ /// The Id of the media library whose artists are retrieved.
+ /// The name of the last retrieved artist, used for keyset pagination. Pass to get the first page.
+ /// The maximum number of artists to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either a page of artists needing their artwork resolved, or an error.
+ Task>> GetArtistsNeedingArtworkAsync(Guid libraryId, string? lastName, int pageSize, CancellationToken cancellationToken);
+
+ ///
+ /// Resets the metadata enrichment status of all the artists of the media library identified by ,
+ /// so that they are re-enriched, because the metadata provider configuration of the library changed.
+ ///
+ /// The Id of the media library whose artists are reset.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs
new file mode 100644
index 00000000..488c0d9c
--- /dev/null
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/IMusicLibraryScanItemMetadataRepository.cs
@@ -0,0 +1,35 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
+using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
+using Lumina.Domain.Common.Primitives;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+#endregion
+
+namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
+
+///
+/// Interface for the repository for the music metadata staged during a media library scan.
+///
+public interface IMusicLibraryScanItemMetadataRepository : IRepository,
+ IInsertRangeRepositoryAction
+{
+ ///
+ /// Gets all the staged music metadata items of the media library scan identified by .
+ ///
+ /// The Id of the media library scan whose staged music metadata is retrieved.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either a collection of , or an error.
+ Task>> GetByScanIdAsync(Guid scanId, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes all the staged music metadata items of the media library scan identified by .
+ ///
+ /// The Id of the media library scan whose staged music metadata is deleted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> DeleteByScanIdAsync(Guid scanId, CancellationToken cancellationToken);
+}
diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/ITrackRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/ITrackRepository.cs
index b2720f5f..72f1b185 100644
--- a/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/ITrackRepository.cs
+++ b/src/Lumina.Application/Common/DataAccess/Repositories/MusicLibrary/ITrackRepository.cs
@@ -20,7 +20,8 @@ public interface ITrackRepository : IRepository,
IInsertRepositoryAction,
IUpdateRepositoryAction,
IApplyUpdateRepositoryAction,
- IGetByIdRepositoryAction
+ IGetByIdRepositoryAction,
+ IDeleteByIdRepositoryAction
{
///
/// Gets the subset of that is already used by a track of the library identified by .
@@ -47,4 +48,40 @@ public interface ITrackRepository : IRepository,
/// Cancellation token that can be used to stop the execution.
/// An containing either a paginated result of , or an error.
Task>> GetTracksLiteByAlbumIdAsync(Guid albumId, PaginationDataDto? paginationData, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the track of the library identified by that is stored at the provided .
+ ///
+ /// The Id of the library whose track is retrieved.
+ /// The file system path of the track to retrieve.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the stored at the provided path, or an error.
+ Task> GetByPathAsync(Guid libraryId, string path, CancellationToken cancellationToken);
+
+ ///
+ /// Resets the enrichment state of the tracks stored at the provided in the media library identified by
+ /// , together with their albums and artists, so that they are re-enriched, because their content changed since the last scan.
+ ///
+ /// The Id of the media library whose tracks are reset.
+ /// The file system paths of the tracks whose enrichment state is reset.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> ResetEnrichmentStateForPathsAsync(Guid libraryId, IReadOnlyCollection paths, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the number of tracks of the media library identified by whose metadata has not been enriched yet.
+ ///
+ /// The Id of the media library whose tracks are counted.
+ /// Cancellation token that can be used to stop the execution.
+ /// An containing either the number of tracks needing their metadata enriched, or an error.
+ Task> GetTracksNeedingMetadataCountAsync(Guid libraryId, CancellationToken cancellationToken);
+
+ ///
+ /// Resets the metadata enrichment status of all the tracks of the media library identified by ,
+ /// so that they are re-enriched, because the metadata provider configuration of the library changed.
+ ///
+ /// The Id of the media library whose tracks are reset.
+ /// Cancellation token that can be used to stop the execution.
+ /// An representing either a successful operation, or an error.
+ Task> ResetMetadataStatusForLibraryAsync(Guid libraryId, CancellationToken cancellationToken);
}
diff --git a/src/Lumina.Application/Common/DataAccess/UoW/IUnitOfWork.cs b/src/Lumina.Application/Common/DataAccess/UoW/IUnitOfWork.cs
index f944b9f4..0290d2a0 100644
--- a/src/Lumina.Application/Common/DataAccess/UoW/IUnitOfWork.cs
+++ b/src/Lumina.Application/Common/DataAccess/UoW/IUnitOfWork.cs
@@ -60,6 +60,16 @@ public interface IUnitOfWork
///
ITrackRepository TrackRepository { get; }
+ ///
+ /// Gets the repository for the artwork of the music library items.
+ ///
+ IMusicArtworkRepository MusicArtworkRepository { get; }
+
+ ///
+ /// Gets the repository for the music metadata staged during a media library scan.
+ ///
+ IMusicLibraryScanItemMetadataRepository MusicLibraryScanItemMetadataRepository { get; }
+
///
/// Gets the media contributor repository.
///
diff --git a/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs
index dcfc6aa0..29e95f2f 100644
--- a/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs
+++ b/src/Lumina.DataAccess/Common/Configuration/AlbumConfiguration.cs
@@ -1,6 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
@@ -39,73 +40,96 @@ public class AlbumConfiguration : IEntityTypeConfiguration
builder.Property(album => album.OriginalTitle)
.HasMaxLength(255)
.HasColumnOrder(4);
+ builder.Property(album => album.ReleaseTitle)
+ .HasMaxLength(255)
+ .HasColumnOrder(26);
builder.Property(album => album.Description)
.HasMaxLength(2000)
.HasColumnOrder(5);
- builder.Property(album => album.OriginalReleaseDate)
+ builder.Property(album => album.Disambiguation)
+ .HasMaxLength(255)
.HasColumnOrder(6);
- builder.Property(album => album.OriginalReleaseYear)
+ builder.Property(album => album.OriginalReleaseDate)
.HasColumnOrder(7);
- builder.Property(album => album.ReReleaseDate)
+ builder.Property(album => album.OriginalReleaseYear)
.HasColumnOrder(8);
- builder.Property(album => album.ReReleaseYear)
+ builder.Property(album => album.ReReleaseDate)
.HasColumnOrder(9);
+ builder.Property(album => album.ReReleaseYear)
+ .HasColumnOrder(10);
builder.Property(album => album.ReleaseCountry)
.HasConversion()
.HasMaxLength(2)
- .HasColumnOrder(10);
- builder.Property(album => album.ReleaseVersion)
.HasColumnOrder(11);
- builder.Property(album => album.LanguageCode)
+ builder.Property(album => album.ReleaseVersion)
.HasColumnOrder(12);
- builder.Property(album => album.LanguageName)
+ builder.Property(album => album.LanguageCode)
.HasColumnOrder(13);
- builder.Property(album => album.LanguageNativeName)
+ builder.Property(album => album.LanguageName)
.HasColumnOrder(14);
- builder.Property(album => album.OriginalLanguageCode)
+ builder.Property(album => album.LanguageNativeName)
.HasColumnOrder(15);
- builder.Property(album => album.OriginalLanguageName)
+ builder.Property(album => album.OriginalLanguageCode)
.HasColumnOrder(16);
- builder.Property(album => album.OriginalLanguageNativeName)
+ builder.Property(album => album.OriginalLanguageName)
.HasColumnOrder(17);
- builder.Property(album => album.ReleaseType)
- .HasConversion()
- .HasMaxLength(50)
+ builder.Property(album => album.OriginalLanguageNativeName)
.HasColumnOrder(18);
+ builder.Property(album => album.Script)
+ .HasMaxLength(50)
+ .HasColumnOrder(19);
builder.Property(album => album.ReleaseStatus)
.HasConversion()
.HasMaxLength(50)
- .HasColumnOrder(19);
- builder.Property(album => album.TotalDiscs)
.HasColumnOrder(20);
- builder.Property(album => album.TotalTracks)
+ builder.Property(album => album.TotalDiscs)
.HasColumnOrder(21);
+ builder.Property(album => album.TotalTracks)
+ .HasColumnOrder(22);
builder.Property(album => album.MediaFormat)
.HasConversion()
.HasMaxLength(50)
- .HasColumnOrder(22);
- builder.Property(album => album.Barcode)
- .HasMaxLength(13)
.HasColumnOrder(23);
- builder.Property(album => album.CatalogNumber)
+ builder.Property(album => album.Packaging)
+ .HasConversion()
.HasMaxLength(50)
.HasColumnOrder(24);
- builder.Property(album => album.MusicBrainzReleaseId)
+ builder.Property(album => album.Barcode)
+ .HasMaxLength(13)
.HasColumnOrder(25);
- builder.Property(album => album.MusicBrainzReleaseGroupId)
- .HasColumnOrder(26);
- builder.Property(album => album.MusicBrainzReleaseArtistId)
+ builder.Property(album => album.Label)
+ .HasMaxLength(255)
.HasColumnOrder(27);
+ builder.Property(album => album.ASIN)
+ .HasMaxLength(20)
+ .HasColumnOrder(28);
+ builder.Property(album => album.MusicBrainzReleaseId)
+ .HasColumnOrder(29);
+ builder.Property(album => album.MusicBrainzReleaseGroupId)
+ .HasColumnOrder(30);
+ builder.Property(album => album.MusicBrainzReleaseArtistId)
+ .HasColumnOrder(31);
builder.Property(album => album.CreatedOnUtc)
.IsRequired()
- .HasColumnOrder(28);
+ .HasColumnOrder(32);
builder.Property(album => album.CreatedBy)
.IsRequired()
- .HasColumnOrder(29);
+ .HasColumnOrder(33);
builder.Property(album => album.UpdatedOnUtc)
- .HasColumnOrder(30);
+ .HasColumnOrder(34);
builder.Property(album => album.UpdatedBy)
- .HasColumnOrder(31);
+ .HasColumnOrder(35);
+ builder.Property(album => album.MetadataStatus)
+ .HasConversion()
+ .HasMaxLength(20)
+ .IsRequired()
+ .HasDefaultValue(MetadataStatus.Pending)
+ .HasColumnOrder(36);
+ builder.Property(album => album.LastMetadataUpdateUtc)
+ .HasColumnOrder(37);
+ builder.Property(album => album.MetadataProvider)
+ .HasMaxLength(100)
+ .HasColumnOrder(38);
builder.HasOne(album => album.Artist)
.WithMany(artist => artist.Albums)
@@ -146,6 +170,35 @@ public class AlbumConfiguration : IEntityTypeConfiguration
j.ToTable("AlbumGenres");
});
+ builder.OwnsMany(album => album.ReleaseTypes, releaseTypeBuilder =>
+ {
+ releaseTypeBuilder.ToTable("AlbumReleaseTypes");
+ releaseTypeBuilder.WithOwner()
+ .HasForeignKey("AlbumId");
+ releaseTypeBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ releaseTypeBuilder.HasKey("Id");
+
+ releaseTypeBuilder.Property(releaseType => releaseType.ReleaseType)
+ .HasConversion()
+ .HasMaxLength(50)
+ .IsRequired();
+ });
+
+ builder.OwnsMany(album => album.CatalogNumbers, catalogNumberBuilder =>
+ {
+ catalogNumberBuilder.ToTable("AlbumCatalogNumbers");
+ catalogNumberBuilder.WithOwner()
+ .HasForeignKey("AlbumId");
+ catalogNumberBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ catalogNumberBuilder.HasKey("Id");
+
+ catalogNumberBuilder.Property(catalogNumber => catalogNumber.CatalogNumber)
+ .HasMaxLength(50)
+ .IsRequired();
+ });
+
builder.OwnsMany(album => album.Ratings, ratingBuilder =>
{
ratingBuilder.ToTable("AlbumRatings");
diff --git a/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs
index 530f6917..a4a63eb7 100644
--- a/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs
+++ b/src/Lumina.DataAccess/Common/Configuration/ArtistConfiguration.cs
@@ -1,8 +1,11 @@
#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
+using System.Collections.Generic;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
@@ -31,21 +34,168 @@ public class ArtistConfiguration : IEntityTypeConfiguration
.IsRequired()
.HasMaxLength(255)
.HasColumnOrder(2);
+ builder.Property(artist => artist.SortName)
+ .HasMaxLength(255)
+ .HasColumnOrder(3);
+ builder.Property(artist => artist.Disambiguation)
+ .HasMaxLength(255)
+ .HasColumnOrder(4);
+ builder.Property(artist => artist.Type)
+ .HasConversion()
+ .HasMaxLength(20)
+ .HasColumnOrder(5);
+ builder.Property(artist => artist.Gender)
+ .HasConversion()
+ .HasMaxLength(20)
+ .HasColumnOrder(6);
+ builder.Property(artist => artist.Country)
+ .HasMaxLength(2)
+ .HasColumnOrder(7);
+ builder.Property(artist => artist.LifeSpanBegin)
+ .HasColumnOrder(8);
+ builder.Property(artist => artist.LifeSpanEnd)
+ .HasColumnOrder(9);
+ builder.Property(artist => artist.IsEnded)
+ .HasColumnOrder(10);
builder.Property(artist => artist.Website)
.HasMaxLength(2048)
- .HasColumnOrder(3);
+ .HasColumnOrder(11);
builder.Property(artist => artist.MusicBrainzArtistId)
- .HasColumnOrder(4);
+ .HasColumnOrder(12);
builder.Property(artist => artist.CreatedOnUtc)
.IsRequired()
- .HasColumnOrder(5);
+ .HasColumnOrder(13);
builder.Property(artist => artist.CreatedBy)
.IsRequired()
- .HasColumnOrder(6);
+ .HasColumnOrder(14);
builder.Property(artist => artist.UpdatedOnUtc)
- .HasColumnOrder(7);
+ .HasColumnOrder(15);
builder.Property(artist => artist.UpdatedBy)
- .HasColumnOrder(8);
+ .HasColumnOrder(16);
+ builder.Property(artist => artist.MetadataStatus)
+ .HasConversion()
+ .HasMaxLength(20)
+ .IsRequired()
+ .HasDefaultValue(MetadataStatus.Pending)
+ .HasColumnOrder(17);
+ builder.Property(artist => artist.LastMetadataUpdateUtc)
+ .HasColumnOrder(18);
+ builder.Property(artist => artist.MetadataProvider)
+ .HasMaxLength(100)
+ .HasColumnOrder(19);
+
+ // The areas are owned value objects that are never referenced on their own, so they are stored as JSON documents next to the artist.
+ builder.OwnsOne(artist => artist.Area, areaBuilder => areaBuilder.ToJson());
+ builder.OwnsOne(artist => artist.BeginArea, beginAreaBuilder => beginAreaBuilder.ToJson());
+ builder.OwnsOne(artist => artist.EndArea, endAreaBuilder => endAreaBuilder.ToJson());
+
+ builder.OwnsMany(artist => artist.Aliases, aliasBuilder =>
+ {
+ aliasBuilder.ToTable("ArtistAliases");
+ aliasBuilder.WithOwner()
+ .HasForeignKey("ArtistId");
+ aliasBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ aliasBuilder.HasKey("Id");
+
+ aliasBuilder.Property(alias => alias.Name)
+ .IsRequired()
+ .HasMaxLength(255);
+ aliasBuilder.Property(alias => alias.SortName)
+ .HasMaxLength(255);
+ aliasBuilder.Property(alias => alias.Type)
+ .HasMaxLength(50);
+ aliasBuilder.Property(alias => alias.Locale)
+ .HasMaxLength(20);
+ });
+
+ builder.OwnsMany(artist => artist.Ipis, ipiBuilder =>
+ {
+ ipiBuilder.ToTable("ArtistIpis");
+ ipiBuilder.WithOwner()
+ .HasForeignKey("ArtistId");
+ ipiBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ ipiBuilder.HasKey("Id");
+
+ ipiBuilder.Property(ipi => ipi.Value)
+ .IsRequired()
+ .HasMaxLength(20);
+ });
+
+ builder.OwnsMany(artist => artist.Isnis, isniBuilder =>
+ {
+ isniBuilder.ToTable("ArtistIsnis");
+ isniBuilder.WithOwner()
+ .HasForeignKey("ArtistId");
+ isniBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ isniBuilder.HasKey("Id");
+
+ isniBuilder.Property(isni => isni.Value)
+ .IsRequired()
+ .HasMaxLength(20);
+ });
+
+ // since Tag and Genre are Domain ValueObjects (no identity), but we also don't want to have duplicates,
+ // we need to configure them as many-to-many relationships, where the tag/genre itself is the primary key
+ builder.HasMany(artist => artist.Tags)
+ .WithMany()
+ .UsingEntity>(
+ "ArtistTags",
+ j => j.HasOne()
+ .WithMany()
+ .HasForeignKey("TagId"),
+ j => j.HasOne()
+ .WithMany()
+ .HasForeignKey("ArtistId"),
+ j =>
+ {
+ j.HasKey("ArtistId", "TagId");
+ j.ToTable("ArtistTags");
+ });
+
+ builder.HasMany(artist => artist.Genres)
+ .WithMany()
+ .UsingEntity>(
+ "ArtistGenres",
+ j => j.HasOne()
+ .WithMany()
+ .HasForeignKey("GenreId"),
+ j => j.HasOne()
+ .WithMany()
+ .HasForeignKey("ArtistId"),
+ j =>
+ {
+ j.HasKey("ArtistId", "GenreId");
+ j.ToTable("ArtistGenres");
+ });
+
+ builder.OwnsMany(artist => artist.Ratings, ratingBuilder =>
+ {
+ ratingBuilder.ToTable("ArtistRatings");
+ ratingBuilder.WithOwner()
+ .HasForeignKey("ArtistId");
+ ratingBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ ratingBuilder.HasKey("Id");
+
+ ratingBuilder.Property(rating => rating.Value)
+ .HasColumnType("decimal(3,2)")
+ .IsRequired();
+
+ ratingBuilder.Property(rating => rating.MaxValue)
+ .HasColumnType("decimal(3,2)")
+ .IsRequired();
+
+ ratingBuilder.Property(rating => rating.VoteCount)
+ .IsRequired(false);
+
+ ratingBuilder.Property(rating => rating.Source)
+ .HasConversion()
+ .HasMaxLength(50)
+ .IsRequired(false);
+ });
builder.HasMany(artist => artist.Contributors)
.WithOne()
diff --git a/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs
new file mode 100644
index 00000000..7cc8aa53
--- /dev/null
+++ b/src/Lumina.DataAccess/Common/Configuration/MusicLibraryScanItemMetadataConfiguration.cs
@@ -0,0 +1,105 @@
+#region ========================================================================= USING =====================================================================================
+using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+#endregion
+
+namespace Lumina.DataAccess.Common.Configuration;
+
+///
+/// Configures the entity mapping for the entity.
+///
+public class MusicLibraryScanItemMetadataConfiguration : IEntityTypeConfiguration
+{
+ ///
+ /// Configures the entity.
+ ///
+ /// The builder to be used to configure the entity.
+ public void Configure(EntityTypeBuilder builder)
+ {
+ builder.ToTable("MusicLibraryScanItemMetadata");
+ builder.HasKey(musicMetadata => musicMetadata.Id);
+ builder.Property(musicMetadata => musicMetadata.Id)
+ .ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
+ .HasColumnOrder(0);
+ builder.Property(musicMetadata => musicMetadata.LibraryScanId)
+ .IsRequired()
+ .HasColumnOrder(1);
+ builder.Property(musicMetadata => musicMetadata.LibraryId)
+ .IsRequired()
+ .HasColumnOrder(2);
+ builder.Property(musicMetadata => musicMetadata.Path)
+ .IsRequired()
+ .HasMaxLength(2048)
+ .HasColumnOrder(3);
+ builder.Property(musicMetadata => musicMetadata.ArtistName)
+ .HasMaxLength(255)
+ .HasColumnOrder(4);
+ builder.Property(musicMetadata => musicMetadata.ReleaseType)
+ .HasConversion()
+ .HasMaxLength(50)
+ .HasColumnOrder(5);
+ builder.Property(musicMetadata => musicMetadata.ReleaseYear)
+ .HasColumnOrder(6);
+ builder.Property(musicMetadata => musicMetadata.ReleaseName)
+ .HasMaxLength(255)
+ .HasColumnOrder(7);
+ builder.Property(musicMetadata => musicMetadata.TrackTitle)
+ .HasMaxLength(255)
+ .HasColumnOrder(8);
+ builder.Property(musicMetadata => musicMetadata.TrackNumber)
+ .HasColumnOrder(9);
+ builder.Property(musicMetadata => musicMetadata.DiscNumber)
+ .HasColumnOrder(10);
+ builder.Property(musicMetadata => musicMetadata.DurationInSeconds)
+ .HasColumnOrder(11);
+ builder.Property(musicMetadata => musicMetadata.SampleRate)
+ .HasColumnOrder(12);
+ builder.Property(musicMetadata => musicMetadata.Channels)
+ .HasColumnOrder(13);
+ builder.Property(musicMetadata => musicMetadata.BitDepth)
+ .HasColumnOrder(14);
+ builder.Property(musicMetadata => musicMetadata.AudioCodec)
+ .HasMaxLength(50)
+ .HasColumnOrder(15);
+ builder.Property(musicMetadata => musicMetadata.Bitrate)
+ .HasColumnOrder(16);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzArtistId)
+ .HasColumnOrder(17);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzReleaseArtistId)
+ .HasColumnOrder(18);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzReleaseGroupId)
+ .HasColumnOrder(19);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzReleaseId)
+ .HasColumnOrder(20);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzRecordingId)
+ .HasColumnOrder(21);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzTrackId)
+ .HasColumnOrder(22);
+ builder.Property(musicMetadata => musicMetadata.MusicBrainzWorkId)
+ .HasColumnOrder(23);
+ builder.Property(musicMetadata => musicMetadata.WorkTitle)
+ .HasMaxLength(255)
+ .HasColumnOrder(24);
+ builder.Property(musicMetadata => musicMetadata.AcoustId)
+ .HasMaxLength(64)
+ .HasColumnOrder(25);
+ builder.Property(musicMetadata => musicMetadata.ReplayGainTrackGain)
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(26);
+ builder.Property(musicMetadata => musicMetadata.ReplayGainTrackPeak)
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(27);
+ builder.Property(musicMetadata => musicMetadata.ReplayGainAlbumGain)
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(28);
+ builder.Property(musicMetadata => musicMetadata.ReplayGainAlbumPeak)
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(29);
+ builder.PrimitiveCollection(musicMetadata => musicMetadata.Moods)
+ .HasColumnOrder(30);
+
+ builder.HasIndex(musicMetadata => new { musicMetadata.LibraryScanId, musicMetadata.Path })
+ .IsUnique(); // the metadata of the same physical file cannot be staged twice during the same scan
+ }
+}
diff --git a/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs
index c32b2194..733def1b 100644
--- a/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs
+++ b/src/Lumina.DataAccess/Common/Configuration/TrackConfiguration.cs
@@ -1,6 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
+using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
@@ -46,77 +47,111 @@ public class TrackConfiguration : IEntityTypeConfiguration
builder.Property(track => track.Description)
.HasMaxLength(2000)
.HasColumnOrder(6);
- builder.Property(track => track.OriginalReleaseDate)
+ builder.Property(track => track.Disambiguation)
+ .HasMaxLength(255)
.HasColumnOrder(7);
- builder.Property(track => track.OriginalReleaseYear)
+ builder.Property(track => track.OriginalReleaseDate)
.HasColumnOrder(8);
- builder.Property(track => track.ReReleaseDate)
+ builder.Property(track => track.OriginalReleaseYear)
.HasColumnOrder(9);
- builder.Property(track => track.ReReleaseYear)
+ builder.Property(track => track.ReReleaseDate)
.HasColumnOrder(10);
+ builder.Property(track => track.ReReleaseYear)
+ .HasColumnOrder(11);
builder.Property(track => track.ReleaseCountry)
.HasConversion()
.HasMaxLength(2)
- .HasColumnOrder(11);
- builder.Property(track => track.ReleaseVersion)
.HasColumnOrder(12);
- builder.Property(track => track.LanguageCode)
+ builder.Property(track => track.ReleaseVersion)
.HasColumnOrder(13);
- builder.Property(track => track.LanguageName)
+ builder.Property(track => track.LanguageCode)
.HasColumnOrder(14);
- builder.Property(track => track.LanguageNativeName)
+ builder.Property(track => track.LanguageName)
.HasColumnOrder(15);
- builder.Property(track => track.OriginalLanguageCode)
+ builder.Property(track => track.LanguageNativeName)
.HasColumnOrder(16);
- builder.Property(track => track.OriginalLanguageName)
+ builder.Property(track => track.OriginalLanguageCode)
.HasColumnOrder(17);
- builder.Property(track => track.OriginalLanguageNativeName)
+ builder.Property(track => track.OriginalLanguageName)
.HasColumnOrder(18);
- builder.Property(track => track.DurationInSeconds)
+ builder.Property(track => track.OriginalLanguageNativeName)
.HasColumnOrder(19);
- builder.Property(track => track.SampleRate)
+ builder.Property(track => track.DurationInSeconds)
.HasColumnOrder(20);
- builder.Property(track => track.Channels)
+ builder.Property(track => track.SampleRate)
.HasColumnOrder(21);
- builder.Property(track => track.BitDepth)
+ builder.Property(track => track.Channels)
.HasColumnOrder(22);
+ builder.Property(track => track.BitDepth)
+ .HasColumnOrder(23);
builder.Property(track => track.AudioCodec)
.HasMaxLength(50)
- .HasColumnOrder(23);
- builder.Property(track => track.Bitrate)
.HasColumnOrder(24);
- builder.Property(track => track.TrackNumber)
+ builder.Property(track => track.Bitrate)
.HasColumnOrder(25);
- builder.Property(track => track.DiscNumber)
+ builder.Property(track => track.TrackNumber)
.HasColumnOrder(26);
+ builder.Property(track => track.DiscNumber)
+ .HasColumnOrder(27);
builder.Property(track => track.Script)
.HasMaxLength(50)
- .HasColumnOrder(27);
+ .HasColumnOrder(28);
builder.Property(track => track.Key)
.HasConversion()
.HasMaxLength(50)
- .HasColumnOrder(28);
- builder.Property(track => track.Bpm)
.HasColumnOrder(29);
- builder.Property(track => track.Work)
- .HasMaxLength(255)
+ builder.Property(track => track.Bpm)
.HasColumnOrder(30);
- builder.Property(track => track.MusicBrainzRecordingId)
+ builder.Property(track => track.IsVideo)
.HasColumnOrder(31);
- builder.Property(track => track.MusicBrainzTrackId)
+ builder.Property(track => track.WorkTitle)
+ .HasMaxLength(255)
.HasColumnOrder(32);
- builder.Property(track => track.MusicBrainzWorkId)
+ builder.Property(track => track.WorkType)
+ .HasMaxLength(50)
.HasColumnOrder(33);
+ builder.Property(track => track.MusicBrainzRecordingId)
+ .HasColumnOrder(34);
+ builder.Property(track => track.MusicBrainzTrackId)
+ .HasColumnOrder(35);
+ builder.Property(track => track.MusicBrainzWorkId)
+ .HasColumnOrder(36);
builder.Property(track => track.CreatedOnUtc)
.IsRequired()
- .HasColumnOrder(34);
+ .HasColumnOrder(37);
builder.Property(track => track.CreatedBy)
.IsRequired()
- .HasColumnOrder(35);
+ .HasColumnOrder(38);
builder.Property(track => track.UpdatedOnUtc)
- .HasColumnOrder(36);
+ .HasColumnOrder(39);
builder.Property(track => track.UpdatedBy)
- .HasColumnOrder(37);
+ .HasColumnOrder(40);
+ builder.Property(track => track.MetadataStatus)
+ .HasConversion()
+ .HasMaxLength(20)
+ .IsRequired()
+ .HasDefaultValue(MetadataStatus.Pending)
+ .HasColumnOrder(41);
+ builder.Property(track => track.LastMetadataUpdateUtc)
+ .HasColumnOrder(42);
+ builder.Property(track => track.MetadataProvider)
+ .HasMaxLength(100)
+ .HasColumnOrder(43);
+ builder.Property(track => track.AcoustId)
+ .HasMaxLength(64)
+ .HasColumnOrder(44);
+ builder.Property(track => track.ReplayGainTrackGain)
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(45);
+ builder.Property(track => track.ReplayGainTrackPeak)
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(46);
+ builder.Property(track => track.ReplayGainAlbumGain)
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(47);
+ builder.Property(track => track.ReplayGainAlbumPeak)
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(48);
builder.HasOne(track => track.Album)
.WithMany(album => album.Tracks)
@@ -186,6 +221,39 @@ public class TrackConfiguration : IEntityTypeConfiguration
.IsRequired();
});
+ builder.OwnsMany(track => track.WorkLanguages, workLanguageBuilder =>
+ {
+ workLanguageBuilder.ToTable("TrackWorkLanguages");
+ workLanguageBuilder.WithOwner()
+ .HasForeignKey("TrackId");
+ workLanguageBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ workLanguageBuilder.HasKey("Id");
+
+ workLanguageBuilder.Property(workLanguage => workLanguage.LanguageCode)
+ .IsRequired()
+ .HasMaxLength(5);
+ workLanguageBuilder.Property(workLanguage => workLanguage.LanguageName)
+ .IsRequired()
+ .HasMaxLength(100);
+ workLanguageBuilder.Property(workLanguage => workLanguage.NativeName)
+ .HasMaxLength(100);
+ });
+
+ builder.OwnsMany(track => track.WorkIswcs, workIswcBuilder =>
+ {
+ workIswcBuilder.ToTable("TrackWorkIswcs");
+ workIswcBuilder.WithOwner()
+ .HasForeignKey("TrackId");
+ workIswcBuilder.Property("Id")
+ .ValueGeneratedOnAdd();
+ workIswcBuilder.HasKey("Id");
+
+ workIswcBuilder.Property(workIswc => workIswc.Value)
+ .HasMaxLength(20)
+ .IsRequired();
+ });
+
builder.HasMany(track => track.Contributors)
.WithOne()
.HasForeignKey(contributor => contributor.TrackId)
diff --git a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs
index 3e88f89f..d6713dc8 100644
--- a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs
+++ b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs
@@ -50,6 +50,10 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.ShouldAggregateArtworkWhenMissing)
+ .IsRequired()
+ .HasColumnOrder(13);
+
builder.Property(settings => settings.ShouldRenderPdfAsImages)
.IsRequired()
.HasColumnOrder(11);
diff --git a/src/Lumina.DataAccess/Common/Migrations/20261004113629_AddsMusicLibraryScanningAndMetadata.Designer.cs b/src/Lumina.DataAccess/Common/Migrations/20261004113629_AddsMusicLibraryScanningAndMetadata.Designer.cs
new file mode 100644
index 00000000..6628af98
--- /dev/null
+++ b/src/Lumina.DataAccess/Common/Migrations/20261004113629_AddsMusicLibraryScanningAndMetadata.Designer.cs
@@ -0,0 +1,3381 @@
+//
+using System;
+using Lumina.DataAccess.Core.UoW;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Lumina.DataAccess.Common.Migrations
+{
+ [DbContext(typeof(LuminaDbContext))]
+ [Migration("20261004113629_AddsMusicLibraryScanningAndMetadata")]
+ partial class AddsMusicLibraryScanningAndMetadata
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder.HasAnnotation("ProductVersion", "10.0.11");
+
+ modelBuilder.Entity("AlbumGenres", b =>
+ {
+ b.Property("AlbumId")
+ .HasColumnType("TEXT");
+
+ b.Property("GenreId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("AlbumId", "GenreId");
+
+ b.HasIndex("GenreId");
+
+ b.ToTable("AlbumGenres", (string)null);
+ });
+
+ modelBuilder.Entity("AlbumTags", b =>
+ {
+ b.Property("AlbumId")
+ .HasColumnType("TEXT");
+
+ b.Property("TagId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("AlbumId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("AlbumTags", (string)null);
+ });
+
+ modelBuilder.Entity("ArtistGenres", b =>
+ {
+ b.Property("ArtistId")
+ .HasColumnType("TEXT");
+
+ b.Property("GenreId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ArtistId", "GenreId");
+
+ b.HasIndex("GenreId");
+
+ b.ToTable("ArtistGenres", (string)null);
+ });
+
+ modelBuilder.Entity("ArtistTags", b =>
+ {
+ b.Property("ArtistId")
+ .HasColumnType("TEXT");
+
+ b.Property("TagId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("ArtistId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("ArtistTags", (string)null);
+ });
+
+ modelBuilder.Entity("BookGenres", b =>
+ {
+ b.Property("BookId")
+ .HasColumnType("TEXT");
+
+ b.Property("GenreId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("BookId", "GenreId");
+
+ b.HasIndex("GenreId");
+
+ b.ToTable("BookGenres", (string)null);
+ });
+
+ modelBuilder.Entity("BookTags", b =>
+ {
+ b.Property("BookId")
+ .HasColumnType("TEXT");
+
+ b.Property("TagId")
+ .HasColumnType("TEXT");
+
+ b.HasKey("BookId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("BookTags", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("PermissionName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.HasKey("Id");
+
+ b.ToTable("Permissions", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.HasKey("Id");
+
+ b.ToTable("Roles", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b =>
+ {
+ b.Property("RoleId")
+ .HasColumnType("TEXT");
+
+ b.Property("PermissionId")
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.HasKey("RoleId", "PermissionId");
+
+ b.HasIndex("PermissionId");
+
+ b.HasIndex("RoleId", "PermissionId")
+ .IsUnique();
+
+ b.ToTable("RolePermissions", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("TEXT");
+
+ b.Property("PermissionId")
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.HasKey("UserId", "PermissionId");
+
+ b.HasIndex("PermissionId");
+
+ b.HasIndex("UserId", "PermissionId")
+ .IsUnique();
+
+ b.ToTable("UserPermissions", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("TEXT");
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("RoleId")
+ .HasColumnType("TEXT");
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.HasKey("UserId");
+
+ b.HasIndex("RoleId");
+
+ b.HasIndex("UserId", "RoleId")
+ .IsUnique();
+
+ b.ToTable("UserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("Genres", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", b =>
+ {
+ b.Property("Name")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT");
+
+ b.HasKey("Name");
+
+ b.ToTable("Tags", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaContributors.MediaContributorEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("Biography")
+ .HasMaxLength(2000)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("DateOfBirth")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("DateOfDeath")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1)
+ .UseCollation("NOCASE");
+
+ b.Property("LegalName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(9);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(8);
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisplayName")
+ .IsUnique();
+
+ b.ToTable("MediaContributors", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumContributorEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("AlbumId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("MediaContributorId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("Role")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.HasKey("Id");
+
+ b.HasIndex("MediaContributorId");
+
+ b.HasIndex("AlbumId", "MediaContributorId", "Role")
+ .IsUnique();
+
+ b.ToTable("AlbumContributors", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("ASIN")
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(28);
+
+ b.Property("ArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("Barcode")
+ .HasMaxLength(13)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(25);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(33);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(32);
+
+ b.Property("Description")
+ .HasMaxLength(2000)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("Disambiguation")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("Label")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(27);
+
+ b.Property("LanguageCode")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(13);
+
+ b.Property("LanguageName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(14);
+
+ b.Property("LanguageNativeName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(15);
+
+ b.Property("LastMetadataUpdateUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(37);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("MediaFormat")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(23);
+
+ b.Property("MetadataProvider")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(38);
+
+ b.Property("MetadataStatus")
+ .IsRequired()
+ .ValueGeneratedOnAdd()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Pending")
+ .HasColumnOrder(36);
+
+ b.Property("MusicBrainzReleaseArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(31);
+
+ b.Property("MusicBrainzReleaseGroupId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(30);
+
+ b.Property("MusicBrainzReleaseId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(29);
+
+ b.Property("OriginalLanguageCode")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(16);
+
+ b.Property("OriginalLanguageName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(17);
+
+ b.Property("OriginalLanguageNativeName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(18);
+
+ b.Property("OriginalReleaseDate")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("OriginalReleaseYear")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(8);
+
+ b.Property("OriginalTitle")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("Packaging")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(24);
+
+ b.Property("ReReleaseDate")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(9);
+
+ b.Property("ReReleaseYear")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(10);
+
+ b.Property("ReleaseCountry")
+ .HasMaxLength(2)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(11);
+
+ b.Property("ReleaseStatus")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(20);
+
+ b.Property("ReleaseTitle")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(26);
+
+ b.Property("ReleaseVersion")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(12);
+
+ b.Property("Script")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(19);
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("TotalDiscs")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(21);
+
+ b.Property("TotalTracks")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(22);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(35);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(34);
+
+ b.HasKey("Id");
+
+ b.HasIndex("ArtistId", "Title");
+
+ b.HasIndex("LibraryId", "Title");
+
+ b.ToTable("Albums", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistContributorEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("ArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("MediaContributorId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("Role")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.HasKey("Id");
+
+ b.HasIndex("MediaContributorId");
+
+ b.HasIndex("ArtistId", "MediaContributorId", "Role")
+ .IsUnique();
+
+ b.ToTable("ArtistContributors", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("Country")
+ .HasMaxLength(2)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(14);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(13);
+
+ b.Property("Disambiguation")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("Gender")
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("IsEnded")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(10);
+
+ b.Property("LastMetadataUpdateUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(18);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("LifeSpanBegin")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(8);
+
+ b.Property("LifeSpanEnd")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(9);
+
+ b.Property("MetadataProvider")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(19);
+
+ b.Property("MetadataStatus")
+ .IsRequired()
+ .ValueGeneratedOnAdd()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Pending")
+ .HasColumnOrder(17);
+
+ b.Property("MusicBrainzArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(12);
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("SortName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("Type")
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(16);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(15);
+
+ b.Property("Website")
+ .HasMaxLength(2048)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(11);
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryId", "Name")
+ .IsUnique();
+
+ b.ToTable("Artists", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicArtworkEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("ArtworkType")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("ContentHash")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(6);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(11);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(10);
+
+ b.Property("FileName")
+ .HasMaxLength(2048)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("LastUpdateUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(9);
+
+ b.Property("Ordinal")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(4);
+
+ b.Property("OwnerId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("OwnerType")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("Provider")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(8);
+
+ b.Property("Status")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(13);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(12);
+
+ b.HasKey("Id");
+
+ b.HasIndex("Status");
+
+ b.HasIndex("OwnerType", "OwnerId", "ArtworkType", "Ordinal")
+ .IsUnique();
+
+ b.ToTable("MusicArtwork", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicLibraryScanItemMetadataEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("AcoustId")
+ .HasMaxLength(64)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(25);
+
+ b.Property("ArtistName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("AudioCodec")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(15);
+
+ b.Property("BitDepth")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(14);
+
+ b.Property("Bitrate")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(16);
+
+ b.Property("Channels")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(13);
+
+ b.Property("DiscNumber")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(10);
+
+ b.Property("DurationInSeconds")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(11);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property