diff --git a/docs/technical/api/library/management/Api.Libraries.md b/docs/technical/api/library/management/Api.Libraries.md
index 4963627e..93dc2a0f 100644
--- a/docs/technical/api/library/management/Api.Libraries.md
+++ b/docs/technical/api/library/management/Api.Libraries.md
@@ -65,6 +65,8 @@ POST api/v1/libraries
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": []
}
```
@@ -90,6 +92,8 @@ POST api/v1/libraries
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
@@ -126,6 +130,8 @@ GET api/v1/libraries
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
@@ -163,6 +169,8 @@ GET api/v1/libraries/enabled
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
@@ -199,6 +207,8 @@ GET api/v1/libraries/{id}
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
@@ -228,6 +238,8 @@ PUT api/v1/libraries/{id}
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": []
}
```
@@ -253,6 +265,8 @@ PUT api/v1/libraries/{id}
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
diff --git a/docs/technical/requests/library/management/AddLibrary.http b/docs/technical/requests/library/management/AddLibrary.http
index 0a20c31f..5b09ae1c 100644
--- a/docs/technical/requests/library/management/AddLibrary.http
+++ b/docs/technical/requests/library/management/AddLibrary.http
@@ -14,6 +14,8 @@ Content-Type: application/json
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [
{ "kind": "Artist", "representation": "{0}", "isOptional": false },
{ "kind": "Separator", "representation": "", "isOptional": false }
diff --git a/docs/technical/requests/library/management/UpdateLibrary.http b/docs/technical/requests/library/management/UpdateLibrary.http
index aa82d623..2733e7d1 100644
--- a/docs/technical/requests/library/management/UpdateLibrary.http
+++ b/docs/technical/requests/library/management/UpdateLibrary.http
@@ -16,6 +16,8 @@ Content-Type: application/json
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
+ "shouldTrackConsumptionProgress": true,
+ "completionThresholdPercentage": 100,
"pathTemplateParts": [
{ "kind": "Artist", "representation": "{0}", "isOptional": false },
{ "kind": "Separator", "representation": "", "isOptional": false }
diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs
index 993b48a4..1abed50d 100644
--- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs
+++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs
@@ -80,6 +80,16 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
///
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; }
+ ///
+ /// Gets a value indicating whether the consumption progress of the media library items is tracked.
+ ///
+ public bool ShouldTrackConsumptionProgress { get; init; }
+
+ ///
+ /// Gets the percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.
+ ///
+ public int? CompletionThresholdPercentage { get; init; }
+
///
/// Gets or sets the fingerprint of the metadata provider configuration of the media library, used to detect
/// whether the configuration changed since the last scan, and thus whether the books need re-enrichment.
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs
index e02402e7..0005fa63 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs
@@ -29,6 +29,8 @@ public static class AddMediaLibraryRequestMapping
request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan,
+ request.ShouldTrackConsumptionProgress,
+ request.CompletionThresholdPercentage,
request.PathTemplateParts?.Select(part => new LibraryPathTemplatePartDto(part.Kind, part.Representation, part.IsOptional)).ToArray()
);
}
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs
index 70060f17..85860594 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs
@@ -36,6 +36,8 @@ public static class LibraryEntityMapping
repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
+ repositoryEntity.ShouldTrackConsumptionProgress,
+ repositoryEntity.CompletionThresholdPercentage,
[.. repositoryEntity.PathTemplateParts
.OrderBy(part => part.Position)
.Select(part => new LibraryPathTemplatePartResponse(part.Kind.ToString(), part.Representation, part.IsOptional))],
@@ -57,6 +59,10 @@ public static class LibraryEntityMapping
if (pathTemplateResult.IsFailure)
return pathTemplateResult.Errors;
+ LibraryConsumptionSettings consumptionSettings = LibraryConsumptionSettings.Create(
+ repositoryEntity.ShouldTrackConsumptionProgress,
+ Optional.FromNullable(repositoryEntity.CompletionThresholdPercentage));
+
return Library.Create(
LibraryId.Create(repositoryEntity.Id),
UserId.Create(repositoryEntity.UserId),
@@ -69,6 +75,7 @@ public static class LibraryEntityMapping
repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
+ consumptionSettings,
pathTemplateResult.Value,
[.. repositoryEntity.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id))]
);
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs
index 3d90a2a8..deeb00d9 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs
@@ -39,6 +39,10 @@ public static class LibraryMapping
CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb,
ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories,
ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan,
+ ShouldTrackConsumptionProgress = domainEntity.ConsumptionSettings.ShouldTrackConsumptionProgress,
+ CompletionThresholdPercentage = domainEntity.ConsumptionSettings.CompletionThresholdPercentage.HasValue
+ ? domainEntity.ConsumptionSettings.CompletionThresholdPercentage.Value
+ : null,
LibraryScans = [.. domainEntity.ScanIds.Select(scanId => new LibraryScanEntity()
{
Id = scanId.Value,
diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs
index 529bbc32..dcc62c28 100644
--- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs
+++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs
@@ -31,6 +31,8 @@ public static class UpdateLibraryRequestMapping
request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan,
+ request.ShouldTrackConsumptionProgress,
+ request.CompletionThresholdPercentage,
request.PathTemplateParts?.Select(part => new LibraryPathTemplatePartDto(part.Kind, part.Representation, part.IsOptional)).ToArray()
);
}
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs
index e1ff00bf..98a3a3c6 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs
@@ -18,6 +18,8 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
/// Whether this media library should update the metadata of its elements from the web, or not.
/// Whether this media library should copy the downloaded metadata into the media library content locations, or not.
/// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.
+/// Whether the consumption progress of the media library items should be tracked, or not. When absent, the default of the library type is used.
+/// The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the default of the library type is used on creation.
/// The ordered parts of the template describing the structure of the media library on disk.
[DebuggerDisplay("Title: {Title}")]
public record AddLibraryCommand(
@@ -30,5 +32,7 @@ public record AddLibraryCommand(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
+ bool? ShouldTrackConsumptionProgress,
+ int? CompletionThresholdPercentage,
LibraryPathTemplatePartDto[]? PathTemplateParts
) : ICommand;
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs
index 316a184a..d6c2fb97 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs
@@ -116,6 +116,17 @@ public class AddLibraryCommandHandler : ICommandHandler(command.LibraryType!);
+ // A library created without explicit consumption settings uses the defaults of its type. When progress tracking is on and no threshold is
+ // supplied, the default threshold of the type is used; a type without one keeps no threshold, which means completion is recorded explicitly.
+ LibraryConsumptionSettings defaultConsumptionSettings = LibraryConsumptionSettings.CreateDefault(libraryType);
+ bool shouldTrackConsumptionProgress = command.ShouldTrackConsumptionProgress ?? defaultConsumptionSettings.ShouldTrackConsumptionProgress;
+ Optional completionThresholdPercentage = Optional.FromNullable(command.CompletionThresholdPercentage);
+ if (completionThresholdPercentage.HasValue && !shouldTrackConsumptionProgress)
+ return DomainErrors.Library.CompletionThresholdPercentageMustBeNullWhenProgressTrackingIsOff;
+ if (!completionThresholdPercentage.HasValue && shouldTrackConsumptionProgress)
+ completionThresholdPercentage = defaultConsumptionSettings.CompletionThresholdPercentage;
+ LibraryConsumptionSettings consumptionSettings = LibraryConsumptionSettings.Create(shouldTrackConsumptionProgress, completionThresholdPercentage);
+
// A library always carries a path template: the one provided by the user, or the ideal structure of the library type as its default.
Result> pathTemplatePartsResult = command.PathTemplateParts.ToDomainParts();
if (pathTemplatePartsResult.IsFailure)
@@ -136,6 +147,7 @@ public class AddLibraryCommandHandler : ICommandHandler
.MaximumLength(255)
.WithError(Errors.Library.TitleMustBeMaximum255CharactersLong);
+ RuleFor(command => command.CompletionThresholdPercentage)
+ .Must((command, completionThresholdPercentage) => command.ShouldTrackConsumptionProgress != false || completionThresholdPercentage is null)
+ .WithError(Errors.Library.CompletionThresholdPercentageMustBeNullWhenProgressTrackingIsOff);
+
+ RuleFor(command => command.CompletionThresholdPercentage)
+ .InclusiveBetween(0, 100)
+ .WithError(Errors.Library.CompletionThresholdPercentageMustBeBetweenZeroAndOneHundred);
+
RuleForEach(command => command.PathTemplateParts)
.ChildRules(part =>
{
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommand.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommand.cs
index 27965444..08c31818 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommand.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommand.cs
@@ -21,6 +21,8 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary
/// Whether this media library should update the metadata of its elements from the web, or not.
/// Whether this media library should copy the downloaded metadata into the media library content locations, or not.
/// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.
+/// Whether the consumption progress of the media library items should be tracked, or not. When absent, the stored value is kept.
+/// The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the stored value is kept.
/// The ordered parts of the template describing the structure of the media library on disk.
[DebuggerDisplay("Title: {Title}")]
public record UpdateLibraryCommand(
@@ -35,5 +37,7 @@ public record UpdateLibraryCommand(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
+ bool? ShouldTrackConsumptionProgress,
+ int? CompletionThresholdPercentage,
LibraryPathTemplatePartDto[]? PathTemplateParts
) : ICommand;
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs
index cc961c0b..7ad62473 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs
@@ -130,6 +130,25 @@ public class UpdateLibraryCommandHandler : ICommandHandler(command.LibraryType!);
+ // Keep the stored consumption settings unless the request explicitly changes them. When progress tracking is enabled and
+ // no threshold is supplied, the stored threshold is kept; the value object never retains a threshold while tracking is disabled.
+ LibraryConsumptionSettings existingConsumptionSettings = LibraryConsumptionSettings.Create(
+ getLibraryResult.Value.ShouldTrackConsumptionProgress,
+ Optional.FromNullable(getLibraryResult.Value.CompletionThresholdPercentage));
+ bool shouldTrackConsumptionProgress = command.ShouldTrackConsumptionProgress ?? existingConsumptionSettings.ShouldTrackConsumptionProgress;
+ bool isEnablingConsumptionProgressTracking = shouldTrackConsumptionProgress && !existingConsumptionSettings.ShouldTrackConsumptionProgress;
+ Optional completionThresholdPercentage = Optional.FromNullable(command.CompletionThresholdPercentage);
+ if (completionThresholdPercentage.HasValue && !shouldTrackConsumptionProgress)
+ return DomainErrors.Library.CompletionThresholdPercentageMustBeNullWhenProgressTrackingIsOff;
+ if (!completionThresholdPercentage.HasValue && shouldTrackConsumptionProgress)
+ {
+ completionThresholdPercentage = existingConsumptionSettings.CompletionThresholdPercentage;
+ // Enabling progress tracking on a library that did not track it yet must use the same type default that creating the library would have used.
+ if (!completionThresholdPercentage.HasValue && isEnablingConsumptionProgressTracking)
+ completionThresholdPercentage = LibraryConsumptionSettings.CreateDefault(newLibraryType).CompletionThresholdPercentage;
+ }
+ LibraryConsumptionSettings consumptionSettings = LibraryConsumptionSettings.Create(shouldTrackConsumptionProgress, completionThresholdPercentage);
+
// A library always carries a path template: the one provided by the user, or the ideal structure of the library type as its default.
Result> pathTemplatePartsResult = command.PathTemplateParts.ToDomainParts();
if (pathTemplatePartsResult.IsFailure)
@@ -150,6 +169,7 @@ public class UpdateLibraryCommandHandler : ICommandHandler ScanId.Create(libraryScan.Id))]
);
diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidator.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidator.cs
index febdd879..d0a2c721 100644
--- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidator.cs
+++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandValidator.cs
@@ -54,6 +54,14 @@ public class UpdateLibraryCommandValidator : AbstractValidator command.CompletionThresholdPercentage)
+ .Must((command, completionThresholdPercentage) => command.ShouldTrackConsumptionProgress != false || completionThresholdPercentage is null)
+ .WithError(Errors.Library.CompletionThresholdPercentageMustBeNullWhenProgressTrackingIsOff);
+
+ RuleFor(command => command.CompletionThresholdPercentage)
+ .InclusiveBetween(0, 100)
+ .WithError(Errors.Library.CompletionThresholdPercentageMustBeBetweenZeroAndOneHundred);
+
RuleForEach(command => command.PathTemplateParts)
.ChildRules(part =>
{
diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/Management/AddLibraryRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/Management/AddLibraryRequest.cs
index 8f8e7196..68246693 100644
--- a/src/Lumina.Contracts/Requests/MediaLibrary/Management/AddLibraryRequest.cs
+++ b/src/Lumina.Contracts/Requests/MediaLibrary/Management/AddLibraryRequest.cs
@@ -16,6 +16,8 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// Whether this media library should update the metadata of its elements from the web, or not. Optional.
/// Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional.
/// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.
+/// Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent.
+/// The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent.
/// The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.
[DebuggerDisplay("Title: {Title}")]
public record AddLibraryRequest(
@@ -28,5 +30,7 @@ public record AddLibraryRequest(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
+ bool? ShouldTrackConsumptionProgress,
+ int? CompletionThresholdPercentage,
LibraryPathTemplatePartRequest[]? PathTemplateParts
);
diff --git a/src/Lumina.Contracts/Requests/MediaLibrary/Management/UpdateLibraryRequest.cs b/src/Lumina.Contracts/Requests/MediaLibrary/Management/UpdateLibraryRequest.cs
index ba3b9226..6e967af2 100644
--- a/src/Lumina.Contracts/Requests/MediaLibrary/Management/UpdateLibraryRequest.cs
+++ b/src/Lumina.Contracts/Requests/MediaLibrary/Management/UpdateLibraryRequest.cs
@@ -19,6 +19,8 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// Whether this media library should update the metadata of its elements from the web, or not. Optional.
/// Whether this media library should copy the downloaded metadata into the media library content locations, or not.
/// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.
+/// Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent.
+/// The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent.
/// The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.
[DebuggerDisplay("Title: {Title}")]
public record class UpdateLibraryRequest(
@@ -33,5 +35,7 @@ public record class UpdateLibraryRequest(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
+ bool? ShouldTrackConsumptionProgress,
+ int? CompletionThresholdPercentage,
LibraryPathTemplatePartRequest[]? PathTemplateParts
);
diff --git a/src/Lumina.Contracts/Responses/MediaLibrary/Management/LibraryResponse.cs b/src/Lumina.Contracts/Responses/MediaLibrary/Management/LibraryResponse.cs
index 63e17fb0..2486f5c2 100644
--- a/src/Lumina.Contracts/Responses/MediaLibrary/Management/LibraryResponse.cs
+++ b/src/Lumina.Contracts/Responses/MediaLibrary/Management/LibraryResponse.cs
@@ -21,6 +21,8 @@ namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// Whether the media library should update the metadata of its elements from the web, or not.
/// Whether the media library should copy the downloaded metadata into the media library content locations, or not.
/// Whether the media library should skip the directories whose contents have not changed since the last scan, during the scan.
+/// Whether the consumption progress of the media library items is tracked.
+/// The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.
/// The ordered parts of the template describing the structure of the media library on disk.
/// The date and time when the library was created.
/// The optional date and time when the library was updated.
@@ -37,6 +39,8 @@ public record LibraryResponse(
bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan,
+ bool ShouldTrackConsumptionProgress,
+ int? CompletionThresholdPercentage,
List PathTemplateParts,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
diff --git a/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs
index ae9fcc88..238964f9 100644
--- a/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs
+++ b/src/Lumina.DataAccess/Common/Configuration/LibraryConfiguration.cs
@@ -71,6 +71,14 @@ public class LibraryConfiguration : IEntityTypeConfiguration
.HasDefaultValue(null)
.HasColumnOrder(11);
+ builder.Property(library => library.ShouldTrackConsumptionProgress)
+ .HasDefaultValue(false)
+ .HasColumnOrder(12);
+
+ builder.Property(library => library.CompletionThresholdPercentage)
+ .HasDefaultValue(null)
+ .HasColumnOrder(13);
+
// one user with many libraries
builder.HasOne(library => library.User)
.WithMany(user => user.Libraries)
@@ -130,18 +138,18 @@ public class LibraryConfiguration : IEntityTypeConfiguration
// audit
builder.Property(library => library.CreatedOnUtc)
.IsRequired()
- .HasColumnOrder(12);
+ .HasColumnOrder(14);
builder.Property(library => library.CreatedBy)
.IsRequired()
- .HasColumnOrder(13);
+ .HasColumnOrder(15);
builder.Property(library => library.UpdatedOnUtc)
.HasDefaultValue(null)
- .HasColumnOrder(14);
+ .HasColumnOrder(16);
builder.Property(library => library.UpdatedBy)
.HasDefaultValue(null)
- .HasColumnOrder(15);
+ .HasColumnOrder(17);
}
}
diff --git a/src/Lumina.DataAccess/Common/Migrations/20261024065622_AddsLibraryConsumptionSettings.Designer.cs b/src/Lumina.DataAccess/Common/Migrations/20261024065622_AddsLibraryConsumptionSettings.Designer.cs
new file mode 100644
index 00000000..a0094eaa
--- /dev/null
+++ b/src/Lumina.DataAccess/Common/Migrations/20261024065622_AddsLibraryConsumptionSettings.Designer.cs
@@ -0,0 +1,3776 @@
+//
+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("20261024065622_AddsLibraryConsumptionSettings")]
+ partial class AddsLibraryConsumptionSettings
+ {
+ ///
+ 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.Favorites.FavoriteEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("MediaItemId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("MediaKind")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("UserId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId", "CreatedOnUtc");
+
+ b.HasIndex("UserId", "MediaKind", "CreatedOnUtc");
+
+ b.HasIndex("UserId", "MediaKind", "MediaItemId")
+ .IsUnique();
+
+ b.ToTable("Favorites", (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("Container")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(31);
+
+ b.Property("DiscNumber")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(10);
+
+ b.Property("DurationInSeconds")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(11);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("LibraryScanId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.PrimitiveCollection("Moods")
+ .IsRequired()
+ .HasColumnType("TEXT")
+ .HasColumnOrder(30);
+
+ b.Property("MusicBrainzArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(17);
+
+ b.Property("MusicBrainzRecordingId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(21);
+
+ b.Property("MusicBrainzReleaseArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(18);
+
+ b.Property("MusicBrainzReleaseGroupId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(19);
+
+ b.Property("MusicBrainzReleaseId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(20);
+
+ b.Property("MusicBrainzTrackId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(22);
+
+ b.Property("MusicBrainzWorkId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(23);
+
+ b.Property("Path")
+ .IsRequired()
+ .HasMaxLength(2048)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("ReleaseName")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("ReleaseType")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("ReleaseYear")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(6);
+
+ b.Property("ReplayGainAlbumGain")
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(28);
+
+ b.Property("ReplayGainAlbumPeak")
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(29);
+
+ b.Property("ReplayGainTrackGain")
+ .HasColumnType("decimal(8,2)")
+ .HasColumnOrder(26);
+
+ b.Property("ReplayGainTrackPeak")
+ .HasColumnType("decimal(8,6)")
+ .HasColumnOrder(27);
+
+ b.Property("SampleRate")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(12);
+
+ b.Property("TrackNumber")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(9);
+
+ b.Property("TrackTitle")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(8);
+
+ b.Property("WorkTitle")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(24);
+
+ b.HasKey("Id");
+
+ b.HasIndex("LibraryScanId", "Path")
+ .IsUnique();
+
+ b.ToTable("MusicLibraryScanItemMetadata", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicPlayRecordEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("AlbumId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(4);
+
+ b.Property("ArtistId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(5);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(12);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(11);
+
+ b.Property("EndedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(9);
+
+ b.Property("LastPositionMilliseconds")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(7);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(3);
+
+ b.Property("ListenedDurationMilliseconds")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(8);
+
+ b.Property("Status")
+ .IsRequired()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("TrackId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(14);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(13);
+
+ b.Property("UserId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("Version")
+ .IsConcurrencyToken()
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(10);
+
+ b.HasKey("Id");
+
+ b.HasIndex("TrackId");
+
+ b.HasIndex("UserId", "CreatedOnUtc");
+
+ b.ToTable("MusicPlayRecords", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackContributorEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ 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("TrackId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("UpdatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("UpdatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.HasKey("Id");
+
+ b.HasIndex("MediaContributorId");
+
+ b.HasIndex("TrackId", "MediaContributorId", "Role")
+ .IsUnique();
+
+ b.ToTable("TrackContributors", (string)null);
+ });
+
+ modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(0);
+
+ b.Property("AcoustId")
+ .HasMaxLength(64)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(44);
+
+ b.Property("AlbumId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(1);
+
+ b.Property("AudioCodec")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(24);
+
+ b.Property("BitDepth")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(23);
+
+ b.Property("Bitrate")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(25);
+
+ b.Property("Bpm")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(30);
+
+ b.Property("Channels")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(22);
+
+ b.Property("Container")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(49);
+
+ b.Property("CreatedBy")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(38);
+
+ b.Property("CreatedOnUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(37);
+
+ b.Property("Description")
+ .HasMaxLength(2000)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(6);
+
+ b.Property("Disambiguation")
+ .HasMaxLength(255)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(7);
+
+ b.Property("DiscNumber")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(27);
+
+ b.Property("DurationInSeconds")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(20);
+
+ b.Property("IsVideo")
+ .HasColumnType("INTEGER")
+ .HasColumnOrder(31);
+
+ b.Property("Key")
+ .HasMaxLength(50)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(29);
+
+ b.Property("LanguageCode")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(14);
+
+ b.Property("LanguageName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(15);
+
+ b.Property("LanguageNativeName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(16);
+
+ b.Property("LastMetadataUpdateUtc")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(42);
+
+ b.Property("LibraryId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(2);
+
+ b.Property("MetadataProvider")
+ .HasMaxLength(100)
+ .HasColumnType("TEXT")
+ .HasColumnOrder(43);
+
+ b.Property("MetadataStatus")
+ .IsRequired()
+ .ValueGeneratedOnAdd()
+ .HasMaxLength(20)
+ .HasColumnType("TEXT")
+ .HasDefaultValue("Pending")
+ .HasColumnOrder(41);
+
+ b.Property("MusicBrainzRecordingId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(34);
+
+ b.Property("MusicBrainzTrackId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(35);
+
+ b.Property("MusicBrainzWorkId")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(36);
+
+ b.Property("OriginalLanguageCode")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(17);
+
+ b.Property("OriginalLanguageName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(18);
+
+ b.Property("OriginalLanguageNativeName")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(19);
+
+ b.Property("OriginalReleaseDate")
+ .HasColumnType("TEXT")
+ .HasColumnOrder(8);
+
+ b.Property