From dd76309ded31fef39561c30f71dc2918dc76974c Mon Sep 17 00:00:00 2001 From: Binary Alley Date: Thu, 15 Oct 2026 21:09:38 +0300 Subject: [PATCH] Adds playback preferences and auto-persisted playback state to user settings --- docs/manual/using-lumina/index.md | 2 +- .../api/users-management/Api.Settings.md | 70 +- .../settings/GetPlaybackState.http | 2 + .../settings/UpdatePlaybackState.http | 8 + .../settings/UpdateUserSettings.http | 9 +- .../UsersManagement/UserSettingsEntity.cs | 36 + .../UpdatePlaybackStateRequestMapping.cs | 25 + .../Users/UpdateUserSettingsRequestMapping.cs | 7 +- .../Users/UserSettingsEntityMapping.cs | 16 +- .../Users/UserSettingsMapping.cs | 16 +- .../UpdatePlaybackStateCommand.cs | 15 + .../UpdatePlaybackStateCommandHandler.cs | 104 + .../UpdatePlaybackStateCommandValidator.cs | 31 + .../UpdateUserSettingsCommand.cs | 13 +- .../UpdateUserSettingsCommandHandler.cs | 52 +- .../UpdateUserSettingsCommandValidator.cs | 30 + .../GetPlaybackState/GetPlaybackStateQuery.cs | 10 + .../GetPlaybackStateQueryHandler.cs | 68 + .../GetUserSettingsQueryHandler.cs | 6 +- .../Settings/UpdatePlaybackStateRequest.cs | 16 + .../Settings/UpdateUserSettingsRequest.cs | 13 +- .../Settings/PlaybackStateResponse.cs | 16 + .../Settings/UserSettingsResponse.cs | 13 +- .../UserSettingsConfiguration.cs | 28 + ...ferencesAndStateToUserSettings.Designer.cs | 3463 +++++++++++++++++ ...aybackPreferencesAndStateToUserSettings.cs | 102 + .../LuminaDbContextModelSnapshot.cs | 28 + .../Playback/PlaybackStreamingQuality.cs | 30 + .../Common/Enums/Playback/ReplayGainMode.cs | 23 + .../Common/Errors/Errors.UserSettings.cs | 10 + .../UserSettingsAggregate/UserSettings.cs | 195 +- .../Routes/UsersManagement/ApiRoutes.Users.cs | 2 + .../GetPlaybackStateEndpoint.cs | 55 + .../GetPlaybackStateEndpointSummary.cs | 59 + .../GetUserSettingsEndpointSummary.cs | 8 +- .../UpdatePlaybackStateEndpoint.cs | 56 + .../UpdatePlaybackStateEndpointSummary.cs | 87 + .../UpdateUserSettingsEndpointSummary.cs | 22 +- .../DTO/UsersManagement/PlaybackStateDto.cs | 22 + .../DTO/UsersManagement/UserSettingsDto.cs | 26 + .../AudioLibrary/PlaybackStreamingQuality.cs | 35 + .../Enums/AudioLibrary/ReplayGainMode.cs | 28 + .../Common/Routes/ApiRoutes.Users.cs | 2 + .../Common/Routes/WebRoutes.Settings.cs | 2 + .../GetPlaybackStateEndpoint.cs | 53 + .../GetPlaybackStateEndpointSummary.cs | 26 + .../UpdatePlaybackStateEndpoint.cs | 54 + .../UpdatePlaybackStateEndpointSummary.cs | 30 + .../ExceptionHandlingMiddleware.ar-SA.resx | 30 + .../ExceptionHandlingMiddleware.de-DE.resx | 30 + .../ExceptionHandlingMiddleware.en-US.resx | 30 + .../ExceptionHandlingMiddleware.es-ES.resx | 30 + .../ExceptionHandlingMiddleware.fr-FR.resx | 30 + .../ExceptionHandlingMiddleware.it-IT.resx | 30 + .../ExceptionHandlingMiddleware.ja-JP.resx | 30 + .../ExceptionHandlingMiddleware.resx | 30 + .../ExceptionHandlingMiddleware.ro-RO.resx | 30 + .../ExceptionHandlingMiddleware.uk-UA.resx | 30 + .../ExceptionHandlingMiddleware.zh-CN.resx | 30 + .../Resources/Views/Tools/Settings.ar-SA.resx | 54 + .../Resources/Views/Tools/Settings.de-DE.resx | 54 + .../Resources/Views/Tools/Settings.en-US.resx | 54 + .../Resources/Views/Tools/Settings.es-ES.resx | 54 + .../Resources/Views/Tools/Settings.fr-FR.resx | 54 + .../Resources/Views/Tools/Settings.it-IT.resx | 54 + .../Resources/Views/Tools/Settings.ja-JP.resx | 54 + .../Core/Resources/Views/Tools/Settings.resx | 54 + .../Resources/Views/Tools/Settings.ro-RO.resx | 54 + .../Resources/Views/Tools/Settings.uk-UA.resx | 54 + .../Resources/Views/Tools/Settings.zh-CN.resx | 54 + .../Core/Views/Tools/Settings.cshtml | 89 +- src/Lumina.sln | 2 + .../UserSettingsEntityFixture.cs | 26 +- .../UpdateUserSettingsCommandFixture.cs | 20 +- .../UpdateUserSettingsRequestFixture.cs | 20 +- .../Settings/UserSettingsResponseFixture.cs | 20 +- .../UserSettingsFixture.cs | 26 +- .../UsersManagement/UserSettingsDtoFixture.cs | 20 +- .../UpdateUserSettingsCommandHandlerTests.cs | 37 - .../Common/Errors/ErrorsTests.cs | 12 +- .../UserSettingsTests.cs | 55 +- 81 files changed, 6102 insertions(+), 173 deletions(-) create mode 100644 docs/technical/requests/users-management/settings/GetPlaybackState.http create mode 100644 docs/technical/requests/users-management/settings/UpdatePlaybackState.http create mode 100644 src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMapping.cs create mode 100644 src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommand.cs create mode 100644 src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandler.cs create mode 100644 src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs create mode 100644 src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQuery.cs create mode 100644 src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQueryHandler.cs create mode 100644 src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdatePlaybackStateRequest.cs create mode 100644 src/Lumina.Contracts/Responses/UsersManagement/Settings/PlaybackStateResponse.cs create mode 100644 src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.Designer.cs create mode 100644 src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.cs create mode 100644 src/Lumina.Domain.SharedKernel/Common/Enums/Playback/PlaybackStreamingQuality.cs create mode 100644 src/Lumina.Domain.SharedKernel/Common/Enums/Playback/ReplayGainMode.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpoint.cs create mode 100644 src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Common/DTO/UsersManagement/PlaybackStateDto.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/PlaybackStreamingQuality.cs create mode 100644 src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/ReplayGainMode.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpoint.cs create mode 100644 src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs diff --git a/docs/manual/using-lumina/index.md b/docs/manual/using-lumina/index.md index 62a45c37..a5496021 100644 --- a/docs/manual/using-lumina/index.md +++ b/docs/manual/using-lumina/index.md @@ -87,6 +87,6 @@ Wherever Lumina needs a folder or a file from the server, it opens the file syst The tools section holds your settings and the language picker. -Your **settings** decide how lists and books behave for you. Enable pagination and the number of items per page control how browsing is split. The alpha picker option decides whether titles beginning with "The" are filed under the next word. Theme caching decides whether the theme is fetched fresh each time. Rendering PDFs as images and preserving book styles shape how books are shown, and the metadata and artwork aggregation options decide whether missing fields are completed from your other providers. The ones that touch libraries are described in more detail in [Managing Libraries](../managing-libraries/index.md). +Your **settings** decide how lists and books behave for you. Enable pagination and the number of items per page control how browsing is split. The alpha picker option decides whether titles beginning with "The" are filed under the next word. Theme caching decides whether the theme is fetched fresh each time. Rendering PDFs as images and preserving book styles shape how books are shown, and the metadata and artwork aggregation options decide whether missing fields are completed from your other providers. A final group of options shapes playback: whether the player keeps downloading while it is paused, whether it continues automatically at the end of an album or artist, whether consecutive tracks play without a gap, how ReplayGain normalizes loudness, and the quality cap used when the server has to normalize a track. The ones that touch libraries are described in more detail in [Managing Libraries](../managing-libraries/index.md). The **language** picker switches the interface between the languages Lumina ships with, and remembers your choice. diff --git a/docs/technical/api/users-management/Api.Settings.md b/docs/technical/api/users-management/Api.Settings.md index 53993dee..0808961a 100644 --- a/docs/technical/api/users-management/Api.Settings.md +++ b/docs/technical/api/users-management/Api.Settings.md @@ -8,6 +8,12 @@ - [Update User Settings](#update-user-settings) - [Update User Settings Request](#update-user-settings-request) - [Update User Settings Response](#update-user-settings-response) + - [Get Playback State](#get-playback-state) + - [Get Playback State Request](#get-playback-state-request) + - [Get Playback State Response](#get-playback-state-response) + - [Update Playback State](#update-playback-state) + - [Update Playback State Request](#update-playback-state-request) + - [Update Playback State Response](#update-playback-state-response) ## Settings @@ -32,11 +38,16 @@ Returns the settings of the currently authenticated user. "userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f", "isPaginationEnabled": true, "itemsPerPage": 50, - "ignoreThePrefixForAlphaPicker": true, + "shouldIgnoreThePrefixForAlphaPicker": true, "isThemeCachingEnabled": true, "shouldAggregateMetadataWhenMissing": true, "shouldRenderPdfAsImages": false, - "shouldPreserveBookStyles": true + "shouldPreserveBookStyles": true, + "shouldKeepDownloadingWhilePaused": true, + "shouldAutoplay": true, + "isGaplessPlaybackEnabled": true, + "replayGainMode": "Off", + "streamingQuality": "Auto" } ``` @@ -54,11 +65,16 @@ Updates the settings of the currently authenticated user. { "isPaginationEnabled": true, "itemsPerPage": 50, - "ignoreThePrefixForAlphaPicker": true, + "shouldIgnoreThePrefixForAlphaPicker": true, "isThemeCachingEnabled": true, "shouldAggregateMetadataWhenMissing": true, "shouldRenderPdfAsImages": false, - "shouldPreserveBookStyles": true + "shouldPreserveBookStyles": true, + "shouldKeepDownloadingWhilePaused": true, + "shouldAutoplay": true, + "isGaplessPlaybackEnabled": true, + "replayGainMode": "Off", + "streamingQuality": "Auto" } ``` @@ -67,3 +83,49 @@ Updates the settings of the currently authenticated user. ```js 200 Ok ``` + +### Get Playback State + +#### Get Playback State Request + +```js +GET api/v1/users/me/settings/playback-state +``` + +Returns the playback state (the last volume and mute state) the player reported for the currently authenticated user. The values are written automatically by the player and are never surfaced as settings fields. + +#### Get Playback State Response + +```js +200 Ok +``` + +```json +{ + "volume": 0.75, + "isMuted": false +} +``` + +### Update Playback State + +#### Update Playback State Request + +```js +PUT api/v1/users/me/settings/playback-state +``` + +Updates the playback state the player reported for the currently authenticated user. Both fields are required: the volume is a value between 0 and 1, and the mute state is a boolean. A request that omits either field, or sends a volume outside that range, is rejected with a `422 Unprocessable Entity`. + +```json +{ + "volume": 0.75, + "isMuted": false +} +``` + +#### Update Playback State Response + +```js +200 Ok +``` diff --git a/docs/technical/requests/users-management/settings/GetPlaybackState.http b/docs/technical/requests/users-management/settings/GetPlaybackState.http new file mode 100644 index 00000000..12b6f7cb --- /dev/null +++ b/docs/technical/requests/users-management/settings/GetPlaybackState.http @@ -0,0 +1,2 @@ +GET {{host}}/api/v1/users/me/settings/playback-state +Authorization: Bearer {{ACCESS_TOKEN}} diff --git a/docs/technical/requests/users-management/settings/UpdatePlaybackState.http b/docs/technical/requests/users-management/settings/UpdatePlaybackState.http new file mode 100644 index 00000000..0b712520 --- /dev/null +++ b/docs/technical/requests/users-management/settings/UpdatePlaybackState.http @@ -0,0 +1,8 @@ +PUT {{host}}/api/v1/users/me/settings/playback-state +Authorization: Bearer {{ACCESS_TOKEN}} +Content-Type: application/json + +{ + "volume": 0.75, + "isMuted": false +} diff --git a/docs/technical/requests/users-management/settings/UpdateUserSettings.http b/docs/technical/requests/users-management/settings/UpdateUserSettings.http index 58cb8c67..c65e30c9 100644 --- a/docs/technical/requests/users-management/settings/UpdateUserSettings.http +++ b/docs/technical/requests/users-management/settings/UpdateUserSettings.http @@ -5,9 +5,14 @@ Content-Type: application/json { "isPaginationEnabled": true, "itemsPerPage": 50, - "ignoreThePrefixForAlphaPicker": true, + "shouldIgnoreThePrefixForAlphaPicker": true, "isThemeCachingEnabled": true, "shouldAggregateMetadataWhenMissing": true, "shouldRenderPdfAsImages": false, - "shouldPreserveBookStyles": true + "shouldPreserveBookStyles": true, + "shouldKeepDownloadingWhilePaused": true, + "shouldAutoplay": true, + "isGaplessPlaybackEnabled": true, + "replayGainMode": "Off", + "streamingQuality": "Auto" } diff --git a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs index 877e541b..cf6ed5a2 100644 --- a/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs +++ b/src/Lumina.Application/Common/DataAccess/Entities/UsersManagement/UserSettingsEntity.cs @@ -1,5 +1,6 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.DataAccess.Entities.Common; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Diagnostics; #endregion @@ -65,6 +66,41 @@ public class UserSettingsEntity : IStorageEntity, IAuditableEntity /// public bool ShouldPreserveBookStyles { get; set; } + /// + /// Gets or sets whether the player keeps downloading a track while playback is paused, or not, up to the entire file. + /// + public bool ShouldKeepDownloadingWhilePaused { get; set; } = true; + + /// + /// Gets or sets whether the player continues playback at the end of an album or artist, or not. + /// + public bool ShouldAutoplay { get; set; } = true; + + /// + /// Gets or sets whether the player transitions between consecutive tracks without a gap, or not. + /// + public bool IsGaplessPlaybackEnabled { get; set; } = true; + + /// + /// Gets or sets the way ReplayGain normalization is applied to the tracks the user plays. + /// + public ReplayGainMode ReplayGainMode { get; set; } + + /// + /// Gets or sets the quality cap applied to the audio the server normalizes for the user. + /// + public PlaybackStreamingQuality StreamingQuality { get; set; } + + /// + /// Gets or sets the last volume the player reported for the user. Written automatically by the player, and not part of the settings the user edits. + /// + public double Volume { get; set; } = 1.0; + + /// + /// Gets or sets the last mute state the player reported for the user. Written automatically by the player, and not part of the settings the user edits. + /// + public bool IsMuted { get; set; } + /// /// Gets or sets the time and date when the entity was added. /// diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMapping.cs new file mode 100644 index 00000000..31e45f8a --- /dev/null +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdatePlaybackStateRequestMapping.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; +using Lumina.Contracts.Requests.UsersManagement.Settings; +#endregion + +namespace Lumina.Application.Common.Mapping.UsersManagement.Users; + +/// +/// Extension methods for converting . +/// +public static class UpdatePlaybackStateRequestMapping +{ + /// + /// Converts to . + /// + /// The request to be converted. + /// The converted command. + public static UpdatePlaybackStateCommand ToCommand(this UpdatePlaybackStateRequest request) + { + return new UpdatePlaybackStateCommand( + request.Volume, + request.IsMuted + ); + } +} diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs index a936d1b2..6f6060af 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UpdateUserSettingsRequestMapping.cs @@ -25,7 +25,12 @@ public static class UpdateUserSettingsRequestMapping request.ShouldAggregateMetadataWhenMissing, request.ShouldAggregateArtworkWhenMissing, request.ShouldRenderPdfAsImages, - request.ShouldPreserveBookStyles + request.ShouldPreserveBookStyles, + request.ShouldKeepDownloadingWhilePaused, + request.ShouldAutoplay, + request.IsGaplessPlaybackEnabled, + request.ReplayGainMode, + request.StreamingQuality ); } } diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs index 4da52a6f..d5e9da55 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsEntityMapping.cs @@ -33,7 +33,14 @@ public static class UserSettingsEntityMapping repositoryEntity.ShouldAggregateMetadataWhenMissing, repositoryEntity.ShouldAggregateArtworkWhenMissing, repositoryEntity.ShouldRenderPdfAsImages, - repositoryEntity.ShouldPreserveBookStyles + repositoryEntity.ShouldPreserveBookStyles, + repositoryEntity.ShouldKeepDownloadingWhilePaused, + repositoryEntity.ShouldAutoplay, + repositoryEntity.IsGaplessPlaybackEnabled, + repositoryEntity.ReplayGainMode, + repositoryEntity.StreamingQuality, + repositoryEntity.Volume, + repositoryEntity.IsMuted ); } @@ -53,7 +60,12 @@ public static class UserSettingsEntityMapping repositoryEntity.ShouldAggregateMetadataWhenMissing, repositoryEntity.ShouldAggregateArtworkWhenMissing, repositoryEntity.ShouldRenderPdfAsImages, - repositoryEntity.ShouldPreserveBookStyles + repositoryEntity.ShouldPreserveBookStyles, + repositoryEntity.ShouldKeepDownloadingWhilePaused, + repositoryEntity.ShouldAutoplay, + repositoryEntity.IsGaplessPlaybackEnabled, + repositoryEntity.ReplayGainMode, + repositoryEntity.StreamingQuality ); } } diff --git a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs index aabba107..edef94fc 100644 --- a/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs +++ b/src/Lumina.Application/Common/Mapping/UsersManagement/Users/UserSettingsMapping.cs @@ -29,7 +29,14 @@ public static class UserSettingsMapping ShouldAggregateMetadataWhenMissing = domainEntity.ShouldAggregateMetadataWhenMissing, ShouldAggregateArtworkWhenMissing = domainEntity.ShouldAggregateArtworkWhenMissing, ShouldRenderPdfAsImages = domainEntity.ShouldRenderPdfAsImages, - ShouldPreserveBookStyles = domainEntity.ShouldPreserveBookStyles + ShouldPreserveBookStyles = domainEntity.ShouldPreserveBookStyles, + ShouldKeepDownloadingWhilePaused = domainEntity.ShouldKeepDownloadingWhilePaused, + ShouldAutoplay = domainEntity.ShouldAutoplay, + IsGaplessPlaybackEnabled = domainEntity.IsGaplessPlaybackEnabled, + ReplayGainMode = domainEntity.ReplayGainMode, + StreamingQuality = domainEntity.StreamingQuality, + Volume = domainEntity.Volume, + IsMuted = domainEntity.IsMuted }; } @@ -49,7 +56,12 @@ public static class UserSettingsMapping domainEntity.ShouldAggregateMetadataWhenMissing, domainEntity.ShouldAggregateArtworkWhenMissing, domainEntity.ShouldRenderPdfAsImages, - domainEntity.ShouldPreserveBookStyles + domainEntity.ShouldPreserveBookStyles, + domainEntity.ShouldKeepDownloadingWhilePaused, + domainEntity.ShouldAutoplay, + domainEntity.IsGaplessPlaybackEnabled, + domainEntity.ReplayGainMode, + domainEntity.StreamingQuality ); } } diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommand.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommand.cs new file mode 100644 index 00000000..285eb67b --- /dev/null +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommand.cs @@ -0,0 +1,15 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +#endregion + +namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; + +/// +/// Command for updating the playback state the player reports for the current user automatically. These values are not part of the settings the user edits. +/// +/// The last volume the player reported, as a value between 0 and 1. +/// The last mute state the player reported. +public record UpdatePlaybackStateCommand( + double? Volume, + bool? IsMuted +) : ICommand; diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandler.cs new file mode 100644 index 00000000..d9b429bd --- /dev/null +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandHandler.cs @@ -0,0 +1,104 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.DataAccess.Entities.UsersManagement; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Errors; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Common.Mapping.UsersManagement.Users; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects; +using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate; +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; + +/// +/// Handler for the command to update the playback state the player reports for the current user automatically. +/// +public class UpdatePlaybackStateCommandHandler : ICommandHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly ICurrentUserService _currentUserService; + private readonly IValidator _validator; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service to retrieve the current user information. + /// Injected unit of work for interacting with the data access layer repositories. + /// Injected validator for application validation rules. + public UpdatePlaybackStateCommandHandler(ICurrentUserService currentUserService, IUnitOfWork unitOfWork, IValidator validator) + { + _currentUserService = currentUserService; + _unitOfWork = unitOfWork; + _validator = validator; + } + + /// + /// Handles the command to update the playback state the player reports for the current user automatically. + /// + /// The command to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An representing either a successful update, or an error message. + /// + public async Task> HandleAsync(UpdatePlaybackStateCommand command, CancellationToken cancellationToken) + { + List validationResult = _validator.Validate(command); + if (validationResult.Count > 0) + return validationResult; + + // An authenticated request must always carry a user identity. + Guid? currentUserId = _currentUserService.UserId; + if (currentUserId is null) + return Errors.Authorization.NotAuthorized; + Guid userId = currentUserId.Value; + + // Get the existing settings of the current user, if any. + Result getSettingsResult = await _unitOfWork.UserSettingsRepository.GetByUserIdAsync(userId, cancellationToken).ConfigureAwait(false); + if (getSettingsResult.IsFailure) + return getSettingsResult.Errors; + + if (getSettingsResult.Value is null) + { + // Create the settings of the current user, since they are not stored yet, keeping the settings the user edits by hand at their default. + Result createSettingsResult = UserSettings.Create(UserId.Create(userId)); + if (createSettingsResult.IsFailure) + return createSettingsResult.Errors; + + Result applyResult = createSettingsResult.Value.UpdatePlaybackState(command.Volume!.Value, command.IsMuted!.Value); + if (applyResult.IsFailure) + return applyResult.Errors; + + Result insertResult = await _unitOfWork.UserSettingsRepository.InsertAsync(createSettingsResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false); + if (insertResult.IsFailure) + return insertResult.Errors; + } + else + { + // Update the stored settings of the current user. + Result toDomainEntityResult = getSettingsResult.Value.ToDomainEntity(); + if (toDomainEntityResult.IsFailure) + return toDomainEntityResult.Errors; + + Result applyResult = toDomainEntityResult.Value.UpdatePlaybackState(command.Volume!.Value, command.IsMuted!.Value); + if (applyResult.IsFailure) + return applyResult.Errors; + + Result updateResult = await _unitOfWork.UserSettingsRepository.UpdateAsync(toDomainEntityResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false); + if (updateResult.IsFailure) + return updateResult.Errors; + } + + Result saveChangesResult = await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false); + if (saveChangesResult.IsFailure) + return saveChangesResult.Errors; + + return Result.Updated; + } +} diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs new file mode 100644 index 00000000..43edb206 --- /dev/null +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdatePlaybackState/UpdatePlaybackStateCommandValidator.cs @@ -0,0 +1,31 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.Infrastructure.Validation; +using Lumina.Application.Common.Utilities; +using Lumina.Domain.Common.Errors; +#endregion + +namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdatePlaybackState; + +/// +/// Validates the needed validation rules for . +/// +public class UpdatePlaybackStateCommandValidator : AbstractValidator +{ + /// + /// Initializes a new instance of the class. + /// + public UpdatePlaybackStateCommandValidator() + { + RuleFor(command => command.Volume) + .NotNull() + .WithError(Errors.UserSettings.VolumeCannotBeNull); + + RuleFor(command => command.Volume) + .Must(volume => volume is null || (volume.Value >= 0.0 && volume.Value <= 1.0)) + .WithError(Errors.UserSettings.VolumeMustBeBetweenZeroAndOne); + + RuleFor(command => command.IsMuted) + .NotNull() + .WithError(Errors.UserSettings.IsMutedCannotBeNull); + } +} diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs index 7dbaa12e..8fccc1a4 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommand.cs @@ -1,5 +1,6 @@ #region ========================================================================= USING ===================================================================================== using Lumina.Application.Common.CQRS; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; #endregion namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSettings; @@ -15,6 +16,11 @@ namespace Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSe /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. +/// Whether the player keeps downloading a track while playback is paused, or not. +/// Whether the player continues playback at the end of an album or artist, or not. +/// Whether the player transitions between consecutive tracks without a gap, or not. +/// The way ReplayGain normalization is applied to the tracks the user plays. +/// The quality cap applied to the audio the server normalizes for the user. public record UpdateUserSettingsCommand( bool IsPaginationEnabled, int ItemsPerPage, @@ -23,5 +29,10 @@ public record UpdateUserSettingsCommand( bool ShouldAggregateMetadataWhenMissing, bool ShouldAggregateArtworkWhenMissing, bool ShouldRenderPdfAsImages, - bool ShouldPreserveBookStyles + bool ShouldPreserveBookStyles, + bool? ShouldKeepDownloadingWhilePaused, + bool? ShouldAutoplay, + bool? IsGaplessPlaybackEnabled, + ReplayGainMode? ReplayGainMode, + PlaybackStreamingQuality? StreamingQuality ) : ICommand; diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs index 73317f73..9298f87a 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandler.cs @@ -66,20 +66,16 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler createSettingsResult = UserSettings.Create( - UserId.Create(userId), - command.IsPaginationEnabled, - command.ItemsPerPage, - command.ShouldIgnoreThePrefixForAlphaPicker, - command.IsThemeCachingEnabled, - command.ShouldAggregateMetadataWhenMissing, - command.ShouldAggregateArtworkWhenMissing, - command.ShouldRenderPdfAsImages, - command.ShouldPreserveBookStyles); + // Create the settings of the current user, since they are not stored yet. The playback state the player reports automatically is left + // at its default, because this command only carries the settings the user edits by hand. + Result createSettingsResult = UserSettings.Create(UserId.Create(userId)); if (createSettingsResult.IsFailure) return createSettingsResult.Errors; + Result applySettingsResult = ApplySettings(createSettingsResult.Value, command); + if (applySettingsResult.IsFailure) + return applySettingsResult.Errors; + Result insertResult = await _unitOfWork.UserSettingsRepository.InsertAsync(createSettingsResult.Value.ToRepositoryEntity(), cancellationToken).ConfigureAwait(false); if (insertResult.IsFailure) return insertResult.Errors; @@ -91,15 +87,7 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler updateSettingsResult = toDomainEntityResult.Value.UpdateSettings( - command.IsPaginationEnabled, - command.ItemsPerPage, - command.ShouldIgnoreThePrefixForAlphaPicker, - command.IsThemeCachingEnabled, - command.ShouldAggregateMetadataWhenMissing, - command.ShouldAggregateArtworkWhenMissing, - command.ShouldRenderPdfAsImages, - command.ShouldPreserveBookStyles); + Result updateSettingsResult = ApplySettings(toDomainEntityResult.Value, command); if (updateSettingsResult.IsFailure) return updateSettingsResult.Errors; @@ -114,4 +102,28 @@ public class UpdateUserSettingsCommandHandler : ICommandHandler + /// Applies the values carried by to the settings of the current user. + /// + /// The settings of the current user to update. + /// The command carrying the new values of the settings. + /// An representing either a successful update, or an error. + private static Result ApplySettings(UserSettings settings, UpdateUserSettingsCommand command) + { + return settings.UpdateSettings( + command.IsPaginationEnabled, + command.ItemsPerPage, + command.ShouldIgnoreThePrefixForAlphaPicker, + command.IsThemeCachingEnabled, + command.ShouldAggregateMetadataWhenMissing, + command.ShouldAggregateArtworkWhenMissing, + command.ShouldRenderPdfAsImages, + command.ShouldPreserveBookStyles, + command.ShouldKeepDownloadingWhilePaused!.Value, + command.ShouldAutoplay!.Value, + command.IsGaplessPlaybackEnabled!.Value, + command.ReplayGainMode!.Value, + command.StreamingQuality!.Value); + } } diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs index ba8ff630..86608f8b 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandValidator.cs @@ -19,5 +19,35 @@ public class UpdateUserSettingsCommandValidator : AbstractValidator command.ItemsPerPage) .GreaterThan(0) .WithError(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero); + + RuleFor(command => command.ShouldKeepDownloadingWhilePaused) + .NotNull() + .WithError(Errors.UserSettings.ShouldKeepDownloadingWhilePausedCannotBeNull); + + RuleFor(command => command.ShouldAutoplay) + .NotNull() + .WithError(Errors.UserSettings.ShouldAutoplayCannotBeNull); + + RuleFor(command => command.IsGaplessPlaybackEnabled) + .NotNull() + .WithError(Errors.UserSettings.IsGaplessPlaybackEnabledCannotBeNull); + + RuleFor(command => command.ReplayGainMode) + .NotNull() + .WithError(Errors.UserSettings.ReplayGainModeCannotBeNull); + + RuleFor(command => command.ReplayGainMode) + .IsInEnum() + .WithError(Errors.UserSettings.InvalidReplayGainMode) + .When(command => command.ReplayGainMode is not null); + + RuleFor(command => command.StreamingQuality) + .NotNull() + .WithError(Errors.UserSettings.StreamingQualityCannotBeNull); + + RuleFor(command => command.StreamingQuality) + .IsInEnum() + .WithError(Errors.UserSettings.InvalidStreamingQuality) + .When(command => command.StreamingQuality is not null); } } diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQuery.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQuery.cs new file mode 100644 index 00000000..d18d4f83 --- /dev/null +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQuery.cs @@ -0,0 +1,10 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +#endregion + +namespace Lumina.Application.Core.UsersManagement.Settings.Queries.GetPlaybackState; + +/// +/// Query for getting the playback state the player reported for the current user automatically. These values are not part of the settings the user edits. +/// +public record GetPlaybackStateQuery : IQuery; diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQueryHandler.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQueryHandler.cs new file mode 100644 index 00000000..2039eb5b --- /dev/null +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetPlaybackState/GetPlaybackStateQueryHandler.cs @@ -0,0 +1,68 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Application.Common.CQRS; +using Lumina.Application.Common.DataAccess.Entities.UsersManagement; +using Lumina.Application.Common.DataAccess.UoW; +using Lumina.Application.Common.Errors; +using Lumina.Application.Common.Infrastructure.Authentication; +using Lumina.Contracts.Responses.UsersManagement.Settings; +using Lumina.Domain.Common.Primitives; +using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate; +using System; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Application.Core.UsersManagement.Settings.Queries.GetPlaybackState; + +/// +/// Handler for the query to get the playback state the player reported for the current user automatically. +/// +public class GetPlaybackStateQueryHandler : IQueryHandler> +{ + private readonly IUnitOfWork _unitOfWork; + private readonly ICurrentUserService _currentUserService; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service to retrieve the current user information. + /// Injected unit of work for interacting with the data access layer repositories. + public GetPlaybackStateQueryHandler(ICurrentUserService currentUserService, IUnitOfWork unitOfWork) + { + _currentUserService = currentUserService; + _unitOfWork = unitOfWork; + } + + /// + /// Handles the query to get the playback state the player reported for the current user automatically. + /// + /// The query to be handled. + /// Cancellation token that can be used to stop the execution. + /// + /// An containing either a successfully retrieved , or an error message. + /// + public async Task> HandleAsync(GetPlaybackStateQuery query, CancellationToken cancellationToken) + { + // An authenticated request must always carry a user identity. + Guid? currentUserId = _currentUserService.UserId; + if (currentUserId is null) + return Errors.Authorization.NotAuthorized; + Guid userId = currentUserId.Value; + + // Get the settings of the current user from the repository. + Result getSettingsResult = await _unitOfWork.UserSettingsRepository.GetByUserIdAsync(userId, cancellationToken).ConfigureAwait(false); + if (getSettingsResult.IsFailure) + return getSettingsResult.Errors; + + // When no settings are stored for the current user yet, return the default playback state. + if (getSettingsResult.Value is null) + { + Result defaultSettingsResult = UserSettings.Create(); + if (defaultSettingsResult.IsFailure) + return defaultSettingsResult.Errors; + return new PlaybackStateResponse(defaultSettingsResult.Value.Volume, defaultSettingsResult.Value.IsMuted); + } + + return new PlaybackStateResponse(getSettingsResult.Value.Volume, getSettingsResult.Value.IsMuted); + } +} diff --git a/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetUserSettings/GetUserSettingsQueryHandler.cs b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetUserSettings/GetUserSettingsQueryHandler.cs index 0d40b9df..94b1d97c 100644 --- a/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetUserSettings/GetUserSettingsQueryHandler.cs +++ b/src/Lumina.Application/Core/UsersManagement/Settings/Queries/GetUserSettings/GetUserSettingsQueryHandler.cs @@ -46,18 +46,18 @@ public class GetUserSettingsQueryHandler : IQueryHandler public async Task> HandleAsync(GetUserSettingsQuery query, CancellationToken cancellationToken) { - // an authenticated request must always carry a user identity + // An authenticated request must always carry a user identity. Guid? currentUserId = _currentUserService.UserId; if (currentUserId is null) return Errors.Authorization.NotAuthorized; Guid userId = currentUserId.Value; - // get the settings of the current user from the repository + // Get the settings of the current user from the repository. Result getSettingsResult = await _unitOfWork.UserSettingsRepository.GetByUserIdAsync(userId, cancellationToken).ConfigureAwait(false); if (getSettingsResult.IsFailure) return getSettingsResult.Errors; - // when no settings are stored for the current user yet, return the default settings + // When no settings are stored for the current user yet, return the default settings. if (getSettingsResult.Value is null) { Result defaultSettingsResult = UserSettings.Create(); diff --git a/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdatePlaybackStateRequest.cs b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdatePlaybackStateRequest.cs new file mode 100644 index 00000000..bfd0de94 --- /dev/null +++ b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdatePlaybackStateRequest.cs @@ -0,0 +1,16 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.Requests.UsersManagement.Settings; + +/// +/// Represents a request to report the playback state of the current user. The player sends this automatically, and these values are not part of the settings the user edits. +/// +/// The last volume the player reported, as a value between 0 and 1. Required. +/// The last mute state the player reported. Required. +[DebuggerDisplay("Volume: {Volume}; IsMuted: {IsMuted}")] +public sealed record UpdatePlaybackStateRequest( + double? Volume, + bool? IsMuted +); diff --git a/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs index f42474fa..53c5ec79 100644 --- a/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs +++ b/src/Lumina.Contracts/Requests/UsersManagement/Settings/UpdateUserSettingsRequest.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Diagnostics; #endregion @@ -15,6 +16,11 @@ namespace Lumina.Contracts.Requests.UsersManagement.Settings; /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. Required. /// Whether PDF books are rendered as page images for the user, or not. Required. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. Required. +/// Whether the player keeps downloading a track while playback is paused, or not. Required. +/// Whether the player continues playback at the end of an album or artist, or not. Required. +/// Whether the player transitions between consecutive tracks without a gap, or not. Required. +/// The way ReplayGain normalization is applied to the tracks the user plays. Required. +/// The quality cap applied to the audio the server normalizes for the user. Required. [DebuggerDisplay("IsPaginationEnabled: {IsPaginationEnabled}; ItemsPerPage: {ItemsPerPage}")] public sealed record UpdateUserSettingsRequest( bool IsPaginationEnabled, @@ -24,5 +30,10 @@ public sealed record UpdateUserSettingsRequest( bool ShouldAggregateMetadataWhenMissing, bool ShouldAggregateArtworkWhenMissing, bool ShouldRenderPdfAsImages, - bool ShouldPreserveBookStyles + bool ShouldPreserveBookStyles, + bool? ShouldKeepDownloadingWhilePaused, + bool? ShouldAutoplay, + bool? IsGaplessPlaybackEnabled, + ReplayGainMode? ReplayGainMode, + PlaybackStreamingQuality? StreamingQuality ); diff --git a/src/Lumina.Contracts/Responses/UsersManagement/Settings/PlaybackStateResponse.cs b/src/Lumina.Contracts/Responses/UsersManagement/Settings/PlaybackStateResponse.cs new file mode 100644 index 00000000..2884c7a7 --- /dev/null +++ b/src/Lumina.Contracts/Responses/UsersManagement/Settings/PlaybackStateResponse.cs @@ -0,0 +1,16 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Contracts.Responses.UsersManagement.Settings; + +/// +/// Represents the playback state of a user, as last reported by the player. The player writes these values automatically, and they are not part of the settings the user edits. +/// +/// The last volume the player reported, as a value between 0 and 1. +/// The last mute state the player reported. +[DebuggerDisplay("Volume: {Volume}; IsMuted: {IsMuted}")] +public sealed record PlaybackStateResponse( + double Volume, + bool IsMuted +); diff --git a/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs b/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs index 11bdbf60..c4ea9fad 100644 --- a/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs +++ b/src/Lumina.Contracts/Responses/UsersManagement/Settings/UserSettingsResponse.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Diagnostics; #endregion @@ -17,6 +18,11 @@ namespace Lumina.Contracts.Responses.UsersManagement.Settings; /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. +/// Whether the player keeps downloading a track while playback is paused, or not. +/// Whether the player continues playback at the end of an album or artist, or not. +/// Whether the player transitions between consecutive tracks without a gap, or not. +/// The way ReplayGain normalization is applied to the tracks the user plays. +/// The quality cap applied to the audio the server normalizes for the user. [DebuggerDisplay("UserId: {UserId}")] public sealed record UserSettingsResponse( Guid UserId, @@ -27,5 +33,10 @@ public sealed record UserSettingsResponse( bool ShouldAggregateMetadataWhenMissing, bool ShouldAggregateArtworkWhenMissing, bool ShouldRenderPdfAsImages, - bool ShouldPreserveBookStyles + bool ShouldPreserveBookStyles, + bool ShouldKeepDownloadingWhilePaused, + bool ShouldAutoplay, + bool IsGaplessPlaybackEnabled, + ReplayGainMode ReplayGainMode, + PlaybackStreamingQuality StreamingQuality ); diff --git a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs index d6713dc8..c60b07e8 100644 --- a/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs +++ b/src/Lumina.DataAccess/Common/Configuration/UserSettingsConfiguration.cs @@ -66,6 +66,34 @@ public class UserSettingsConfiguration : IEntityTypeConfiguration settings.ShouldKeepDownloadingWhilePaused) + .IsRequired() + .HasColumnOrder(14); + + builder.Property(settings => settings.ShouldAutoplay) + .IsRequired() + .HasColumnOrder(15); + + builder.Property(settings => settings.IsGaplessPlaybackEnabled) + .IsRequired() + .HasColumnOrder(16); + + builder.Property(settings => settings.ReplayGainMode) + .IsRequired() + .HasColumnOrder(17); + + builder.Property(settings => settings.StreamingQuality) + .IsRequired() + .HasColumnOrder(18); + + builder.Property(settings => settings.Volume) + .IsRequired() + .HasColumnOrder(19); + + builder.Property(settings => settings.IsMuted) + .IsRequired() + .HasColumnOrder(20); + // audit builder.Property(settings => settings.CreatedOnUtc) .IsRequired() diff --git a/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.Designer.cs b/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.Designer.cs new file mode 100644 index 00000000..3188be44 --- /dev/null +++ b/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.Designer.cs @@ -0,0 +1,3463 @@ +// +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("20261015160422_AddsPlaybackPreferencesAndStateToUserSettings")] + partial class AddsPlaybackPreferencesAndStateToUserSettings + { + /// + 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("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.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("OriginalReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(9); + + b.Property("OriginalTitle") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("Path") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("ReReleaseDate") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("ReReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(11); + + b.Property("ReleaseCountry") + .HasMaxLength(2) + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("ReleaseVersion") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("ReplayGainAlbumGain") + .HasColumnType("decimal(8,2)") + .HasColumnOrder(47); + + b.Property("ReplayGainAlbumPeak") + .HasColumnType("decimal(8,6)") + .HasColumnOrder(48); + + b.Property("ReplayGainTrackGain") + .HasColumnType("decimal(8,2)") + .HasColumnOrder(45); + + b.Property("ReplayGainTrackPeak") + .HasColumnType("decimal(8,6)") + .HasColumnOrder(46); + + b.Property("SampleRate") + .HasColumnType("INTEGER") + .HasColumnOrder(21); + + b.Property("Script") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(28); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("TrackNumber") + .HasColumnType("INTEGER") + .HasColumnOrder(26); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(40); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(39); + + b.Property("WorkTitle") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(32); + + b.Property("WorkType") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(33); + + b.HasKey("Id"); + + b.HasIndex("AlbumId", "TrackNumber"); + + b.HasIndex("LibraryId", "Path") + .IsUnique(); + + b.ToTable("Tracks", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.DirectoryScanFingerprintEntity", b => + { + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("LastWriteTimeUtc") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.HasKey("LibraryId", "Path"); + + b.HasIndex("LibraryId"); + + b.ToTable("DirectoryScanFingerprints", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("ArtworkProvidersConfigurationFingerprint") + .HasMaxLength(64) + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("CanDownloadMetadataFromWeb") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true) + .HasColumnOrder(6); + + b.Property("CoverImage") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("IsEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(true) + .HasColumnOrder(4); + + b.Property("IsLocked") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("LibraryType") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("MetadataProvidersConfigurationFingerprint") + .HasMaxLength(64) + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("PathTemplateFingerprint") + .HasMaxLength(64) + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("ShouldSaveMetadataInMediaDirectories") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("ShouldSkipUnchangedDirectoriesDuringScan") + .HasColumnType("INTEGER") + .HasColumnOrder(8); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(15); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Libraries", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("LibraryId", "Status", "CreatedOnUtc") + .IsDescending(true, false, true); + + b.ToTable("LibraryScans", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanResultEntity", b => + { + b.Property("LibraryScanId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasMaxLength(24) + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("FileSize") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Status") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.HasKey("LibraryScanId", "Path"); + + b.HasIndex("Path"); + + b.HasIndex("ContentHash", "FileSize", "Path"); + + b.ToTable("LibraryScanResults", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanSnapshotEntity", b => + { + b.Property("LibraryId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("FileSize") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.HasKey("LibraryId", "Path"); + + b.HasIndex("LibraryId"); + + b.ToTable("LibraryScanSnapshots", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanStagingResultsEntity", b => + { + b.Property("LibraryScanId") + .HasColumnType("TEXT"); + + b.Property("Path") + .HasMaxLength(1024) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("IsNew") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("NeedsRehash") + .HasColumnType("INTEGER") + .HasColumnOrder(6); + + b.Property("PreviousContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("Size") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("Ticks") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.HasKey("LibraryScanId", "Path"); + + b.HasIndex("LibraryScanId", "NeedsRehash"); + + b.ToTable("LibraryScanStagingResults", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookArtworkEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("ArtworkType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("BookId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("ContentHash") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("FileName") + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("LastUpdateUtc") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("Ordinal") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("Provider") + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("Status") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.HasKey("Id"); + + b.HasIndex("Status"); + + b.HasIndex("BookId", "ArtworkType", "Ordinal") + .IsUnique(); + + b.ToTable("BookArtwork", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookContributorEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("BookId") + .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("BookId", "MediaContributorId", "Role") + .IsUnique(); + + b.ToTable("BookContributors", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("ASIN") + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(21); + + b.Property("AppleBooksId") + .HasColumnType("TEXT") + .HasColumnOrder(29); + + b.Property("BarnesAndNobleId") + .HasMaxLength(10) + .HasColumnType("TEXT") + .HasColumnOrder(28); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(33); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(32); + + b.Property("Description") + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("Edition") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(19); + + b.Property("Format") + .HasColumnType("TEXT") + .HasColumnOrder(18); + + b.Property("GoodreadsId") + .HasColumnType("TEXT") + .HasColumnOrder(22); + + b.Property("GoogleBooksId") + .HasMaxLength(12) + .HasColumnType("TEXT") + .HasColumnOrder(27); + + b.Property("LCCN") + .HasColumnType("TEXT") + .HasColumnOrder(23); + + b.Property("LanguageCode") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("LanguageName") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("LanguageNativeName") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("LastMetadataUpdateUtc") + .HasColumnType("TEXT") + .HasColumnOrder(39); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(36); + + b.Property("LibraryThingId") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(26); + + b.Property("MetadataProvider") + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(40); + + b.Property("MetadataStatus") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnOrder(38); + + b.Property("OCLCNumber") + .HasColumnType("TEXT") + .HasColumnOrder(24); + + b.Property("OpenLibraryId") + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(25); + + b.Property("OriginalLanguageCode") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("OriginalLanguageName") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("OriginalLanguageNativeName") + .HasColumnType("TEXT") + .HasColumnOrder(15); + + b.Property("OriginalReleaseDate") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("OriginalReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("OriginalTitle") + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("PageCount") + .HasColumnType("INTEGER") + .HasColumnOrder(17); + + b.Property("Path") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("TEXT") + .HasColumnOrder(37); + + b.Property("Publisher") + .HasMaxLength(100) + .HasColumnType("TEXT") + .HasColumnOrder(16); + + b.Property("ReReleaseDate") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("ReReleaseYear") + .HasColumnType("INTEGER") + .HasColumnOrder(7); + + b.Property("ReleaseCountry") + .HasMaxLength(2) + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("ReleaseVersion") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(35); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(34); + + b.Property("VolumeNumber") + .HasColumnType("REAL") + .HasColumnOrder(20); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "MetadataStatus"); + + b.HasIndex("LibraryId", "Path") + .IsUnique(); + + b.ToTable("Books", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryArtworkProviderConfigurationEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("IsEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("PluginId") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("Rank") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "PluginId"); + + b.ToTable("LibraryArtworkProviderConfigurations", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryBookReaderConfigurationEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("IsEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("PluginId") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "PluginId") + .IsUnique(); + + b.ToTable("LibraryBookReaderConfigurations", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.LibraryMetadataProviderConfigurationEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("IsEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("LibraryId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("PluginId") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("Rank") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.HasKey("Id"); + + b.HasIndex("LibraryId", "PluginId"); + + b.ToTable("LibraryMetadataProviderConfigurations", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Plugins.PluginEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Author") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("LoadError") + .HasMaxLength(2000) + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("LoadStatus") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("SettingsJson") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("Version") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.HasKey("Id"); + + b.ToTable("Plugins", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Scheduling.ScheduledJobEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("Hour") + .HasColumnType("INTEGER") + .HasColumnOrder(5); + + b.Property("IntervalMinutes") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("LastCompletedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("LastStartedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("Minute") + .HasColumnType("INTEGER") + .HasColumnOrder(6); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("OwnerUserId") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("ScheduleType") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("TaskType") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.HasKey("Id"); + + b.HasIndex("Status"); + + b.ToTable("ScheduledJobs", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Scheduling.ScheduledJobExecutionEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CompletedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("IsCycleRun") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("ScheduledJobId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("StartedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("TaskType") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("WasCycleActive") + .HasColumnType("INTEGER") + .HasColumnOrder(6); + + b.HasKey("Id"); + + b.HasIndex("ScheduledJobId"); + + b.HasIndex("StartedOnUtc", "ScheduledJobId"); + + b.ToTable("ScheduledJobExecutions", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Scheduling.SchedulerDisplayPreferencesEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("DisplayTimeSpan") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("DisplayTimeUnit") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("JobTypeFilter") + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UserId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("SchedulerDisplayPreferences", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Themes.ThemeEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("Author") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(12); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(11); + + b.Property("Description") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("InstallSource") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("InstalledAtUtc") + .HasColumnType("TEXT") + .HasColumnOrder(10); + + b.Property("IsCurrent") + .HasColumnType("INTEGER") + .HasColumnOrder(8); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER") + .HasDefaultValue(false) + .HasColumnOrder(9); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("PreviewPath") + .HasMaxLength(240) + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("ThemeId") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(14); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(13); + + b.Property("Version") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.HasKey("Id"); + + b.HasIndex("IsCurrent") + .IsUnique() + .HasFilter("IsCurrent = 1"); + + b.HasIndex("ThemeId") + .IsUnique(); + + b.ToTable("Themes", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT") + .HasColumnOrder(2); + + b.Property("TempPassword") + .HasColumnType("TEXT") + .HasColumnOrder(3); + + b.Property("TempPasswordCreated") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("TotpSecret") + .HasColumnType("TEXT") + .HasColumnOrder(4); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(9); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("Username") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.HasKey("Id"); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("Users", (string)null); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", b => + { + b.Property("Id") + .HasColumnType("TEXT") + .HasColumnOrder(0); + + b.Property("CreatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(6); + + b.Property("CreatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(5); + + b.Property("IsGaplessPlaybackEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(16); + + b.Property("IsMuted") + .HasColumnType("INTEGER") + .HasColumnOrder(20); + + b.Property("IsPaginationEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(2); + + b.Property("IsThemeCachingEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(9); + + b.Property("ItemsPerPage") + .HasColumnType("INTEGER") + .HasColumnOrder(3); + + b.Property("ReplayGainMode") + .HasColumnType("INTEGER") + .HasColumnOrder(17); + + b.Property("ShouldAggregateArtworkWhenMissing") + .HasColumnType("INTEGER") + .HasColumnOrder(13); + + b.Property("ShouldAggregateMetadataWhenMissing") + .HasColumnType("INTEGER") + .HasColumnOrder(10); + + b.Property("ShouldAutoplay") + .HasColumnType("INTEGER") + .HasColumnOrder(15); + + b.Property("ShouldIgnoreThePrefixForAlphaPicker") + .HasColumnType("INTEGER") + .HasColumnOrder(4); + + b.Property("ShouldKeepDownloadingWhilePaused") + .HasColumnType("INTEGER") + .HasColumnOrder(14); + + b.Property("ShouldPreserveBookStyles") + .HasColumnType("INTEGER") + .HasColumnOrder(12); + + b.Property("ShouldRenderPdfAsImages") + .HasColumnType("INTEGER") + .HasColumnOrder(11); + + b.Property("StreamingQuality") + .HasColumnType("INTEGER") + .HasColumnOrder(18); + + b.Property("UpdatedBy") + .HasColumnType("TEXT") + .HasColumnOrder(8); + + b.Property("UpdatedOnUtc") + .HasColumnType("TEXT") + .HasColumnOrder(7); + + b.Property("UserId") + .HasColumnType("TEXT") + .HasColumnOrder(1); + + b.Property("Volume") + .HasColumnType("REAL") + .HasColumnOrder(19); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("UserSettings", (string)null); + }); + + modelBuilder.Entity("TrackGenres", b => + { + b.Property("TrackId") + .HasColumnType("TEXT"); + + b.Property("GenreId") + .HasColumnType("TEXT"); + + b.HasKey("TrackId", "GenreId"); + + b.HasIndex("GenreId"); + + b.ToTable("TrackGenres", (string)null); + }); + + modelBuilder.Entity("TrackTags", b => + { + b.Property("TrackId") + .HasColumnType("TEXT"); + + b.Property("TagId") + .HasColumnType("TEXT"); + + b.HasKey("TrackId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("TrackTags", (string)null); + }); + + modelBuilder.Entity("AlbumGenres", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", null) + .WithMany() + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null) + .WithMany() + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("AlbumTags", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", null) + .WithMany() + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ArtistGenres", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", null) + .WithMany() + .HasForeignKey("ArtistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null) + .WithMany() + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ArtistTags", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", null) + .WithMany() + .HasForeignKey("ArtistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BookGenres", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null) + .WithMany() + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BookTags", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany() + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RolePermissionEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission") + .WithMany("RolePermissions") + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role") + .WithMany("RolePermissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserPermissionEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", "Permission") + .WithMany("UserPermissions") + .HasForeignKey("PermissionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("UserPermissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithOne("UserRole") + .HasForeignKey("Lumina.Application.Common.DataAccess.Entities.Authorization.UserRoleEntity", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumContributorEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", null) + .WithMany("Contributors") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", "Artist") + .WithMany("Albums") + .HasForeignKey("ArtistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumCatalogNumberEntity", "CatalogNumbers", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("AlbumId") + .HasColumnType("TEXT"); + + b1.Property("CatalogNumber") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("AlbumId"); + + b1.ToTable("AlbumCatalogNumbers", (string)null); + + b1.WithOwner() + .HasForeignKey("AlbumId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AudioRatingEntity", "Ratings", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("AlbumId") + .HasColumnType("TEXT"); + + b1.Property("MaxValue") + .HasColumnType("decimal(3,2)"); + + b1.Property("Source") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("Value") + .HasColumnType("decimal(3,2)"); + + b1.Property("VoteCount") + .HasColumnType("INTEGER"); + + b1.HasKey("Id"); + + b1.HasIndex("AlbumId"); + + b1.ToTable("AlbumRatings", (string)null); + + b1.WithOwner() + .HasForeignKey("AlbumId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumReleaseTypeEntity", "ReleaseTypes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("AlbumId") + .HasColumnType("TEXT"); + + b1.Property("ReleaseType") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("AlbumId"); + + b1.ToTable("AlbumReleaseTypes", (string)null); + + b1.WithOwner() + .HasForeignKey("AlbumId"); + }); + + b.Navigation("Artist"); + + b.Navigation("CatalogNumbers"); + + b.Navigation("Ratings"); + + b.Navigation("ReleaseTypes"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistContributorEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", null) + .WithMany("Contributors") + .HasForeignKey("ArtistId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", b => + { + b.OwnsOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicAreaEntity", "Area", b1 => + { + b1.Property("ArtistEntityId"); + + b1.Property("Disambiguation"); + + b1.Property("Iso3166Code"); + + b1.Property("MusicBrainzAreaId"); + + b1.Property("Name") + .IsRequired(); + + b1.Property("SortName"); + + b1.Property("Type"); + + b1.HasKey("ArtistEntityId"); + + b1.ToTable("Artists"); + + b1 + .ToJson("Area") + .HasColumnType("TEXT"); + + b1.WithOwner() + .HasForeignKey("ArtistEntityId"); + }); + + b.OwnsOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicAreaEntity", "BeginArea", b1 => + { + b1.Property("ArtistEntityId"); + + b1.Property("Disambiguation"); + + b1.Property("Iso3166Code"); + + b1.Property("MusicBrainzAreaId"); + + b1.Property("Name") + .IsRequired(); + + b1.Property("SortName"); + + b1.Property("Type"); + + b1.HasKey("ArtistEntityId"); + + b1.ToTable("Artists"); + + b1 + .ToJson("BeginArea") + .HasColumnType("TEXT"); + + b1.WithOwner() + .HasForeignKey("ArtistEntityId"); + }); + + b.OwnsOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.MusicAreaEntity", "EndArea", b1 => + { + b1.Property("ArtistEntityId"); + + b1.Property("Disambiguation"); + + b1.Property("Iso3166Code"); + + b1.Property("MusicBrainzAreaId"); + + b1.Property("Name") + .IsRequired(); + + b1.Property("SortName"); + + b1.Property("Type"); + + b1.HasKey("ArtistEntityId"); + + b1.ToTable("Artists"); + + b1 + .ToJson("EndArea") + .HasColumnType("TEXT"); + + b1.WithOwner() + .HasForeignKey("ArtistEntityId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistAliasEntity", "Aliases", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("ArtistId") + .HasColumnType("TEXT"); + + b1.Property("BeginDate") + .HasColumnType("TEXT"); + + b1.Property("EndDate") + .HasColumnType("TEXT"); + + b1.Property("IsEnded") + .HasColumnType("INTEGER"); + + b1.Property("IsPrimary") + .HasColumnType("INTEGER"); + + b1.Property("Locale") + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b1.Property("SortName") + .HasMaxLength(255) + .HasColumnType("TEXT"); + + b1.Property("Type") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("ArtistId"); + + b1.ToTable("ArtistAliases", (string)null); + + b1.WithOwner() + .HasForeignKey("ArtistId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AudioRatingEntity", "Ratings", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("ArtistId") + .HasColumnType("TEXT"); + + b1.Property("MaxValue") + .HasColumnType("decimal(3,2)"); + + b1.Property("Source") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("Value") + .HasColumnType("decimal(3,2)"); + + b1.Property("VoteCount") + .HasColumnType("INTEGER"); + + b1.HasKey("Id"); + + b1.HasIndex("ArtistId"); + + b1.ToTable("ArtistRatings", (string)null); + + b1.WithOwner() + .HasForeignKey("ArtistId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistIpiEntity", "Ipis", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("ArtistId") + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("ArtistId"); + + b1.ToTable("ArtistIpis", (string)null); + + b1.WithOwner() + .HasForeignKey("ArtistId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistIsniEntity", "Isnis", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("ArtistId") + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("ArtistId"); + + b1.ToTable("ArtistIsnis", (string)null); + + b1.WithOwner() + .HasForeignKey("ArtistId"); + }); + + b.Navigation("Aliases"); + + b.Navigation("Area"); + + b.Navigation("BeginArea"); + + b.Navigation("EndArea"); + + b.Navigation("Ipis"); + + b.Navigation("Isnis"); + + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackContributorEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", null) + .WithMany("Contributors") + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", "Album") + .WithMany("Tracks") + .HasForeignKey("AlbumId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AudioRatingEntity", "Ratings", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("MaxValue") + .HasColumnType("decimal(3,2)"); + + b1.Property("Source") + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("TrackId") + .HasColumnType("TEXT"); + + b1.Property("Value") + .HasColumnType("decimal(3,2)"); + + b1.Property("VoteCount") + .HasColumnType("INTEGER"); + + b1.HasKey("Id"); + + b1.HasIndex("TrackId"); + + b1.ToTable("TrackRatings", (string)null); + + b1.WithOwner() + .HasForeignKey("TrackId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackIsrcEntity", "Isrcs", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("TrackId") + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(12) + .HasColumnType("TEXT") + .HasColumnName("ISRC"); + + b1.HasKey("Id"); + + b1.HasIndex("TrackId"); + + b1.ToTable("TrackIsrcs", (string)null); + + b1.WithOwner() + .HasForeignKey("TrackId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackMoodEntity", "Moods", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("TrackId") + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("TrackId"); + + b1.ToTable("TrackMoods", (string)null); + + b1.WithOwner() + .HasForeignKey("TrackId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackWorkIswcEntity", "WorkIswcs", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("TrackId") + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("TrackId"); + + b1.ToTable("TrackWorkIswcs", (string)null); + + b1.WithOwner() + .HasForeignKey("TrackId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackWorkLanguageEntity", "WorkLanguages", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("LanguageCode") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("TEXT"); + + b1.Property("LanguageName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b1.Property("NativeName") + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b1.Property("TrackId") + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("TrackId"); + + b1.ToTable("TrackWorkLanguages", (string)null); + + b1.WithOwner() + .HasForeignKey("TrackId"); + }); + + b.Navigation("Album"); + + b.Navigation("Isrcs"); + + b.Navigation("Moods"); + + b.Navigation("Ratings"); + + b.Navigation("WorkIswcs"); + + b.Navigation("WorkLanguages"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.DirectoryScanFingerprintEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", null) + .WithMany() + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("Libraries") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryContentLocationEntity", "ContentLocations", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("LibraryId") + .HasColumnType("TEXT"); + + b1.Property("Path") + .IsRequired() + .HasMaxLength(260) + .HasColumnType("TEXT") + .HasColumnName("Path"); + + b1.HasKey("Id"); + + b1.HasIndex("LibraryId"); + + b1.ToTable("LibraryContentLocations", (string)null); + + b1.WithOwner() + .HasForeignKey("LibraryId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryPathTemplatePartEntity", "PathTemplateParts", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("IsOptional") + .HasColumnType("INTEGER"); + + b1.Property("Kind") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("TEXT"); + + b1.Property("LibraryId") + .HasColumnType("TEXT"); + + b1.Property("Position") + .HasColumnType("INTEGER") + .HasColumnName("Position"); + + b1.Property("Representation") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("TEXT"); + + b1.HasKey("Id"); + + b1.HasIndex("LibraryId", "Position") + .IsUnique(); + + b1.ToTable("LibraryPathTemplateParts", (string)null); + + b1.WithOwner() + .HasForeignKey("LibraryId"); + }); + + b.Navigation("ContentLocations"); + + b.Navigation("PathTemplateParts"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", "Library") + .WithMany("LibraryScans") + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", "User") + .WithMany("LibraryScans") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Library"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanResultEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", "LibraryScan") + .WithMany("LibraryScanResults") + .HasForeignKey("LibraryScanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LibraryScan"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanSnapshotEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", "Library") + .WithMany() + .HasForeignKey("LibraryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Library"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanStagingResultsEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", null) + .WithMany() + .HasForeignKey("LibraryScanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookArtworkEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany("Artwork") + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookContributorEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", null) + .WithMany("Contributors") + .HasForeignKey("BookId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b => + { + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookRatingEntity", "Ratings", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("BookId") + .HasColumnType("TEXT"); + + b1.Property("MaxValue") + .HasColumnType("decimal(3,2)"); + + b1.Property("Source") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("TEXT"); + + b1.Property("Value") + .HasColumnType("decimal(3,2)"); + + b1.Property("VoteCount") + .HasColumnType("INTEGER"); + + b1.HasKey("Id"); + + b1.HasIndex("BookId"); + + b1.ToTable("BookRatings", (string)null); + + b1.WithOwner() + .HasForeignKey("BookId"); + }); + + b.OwnsMany("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.IsbnEntity", "ISBNs", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b1.Property("BookId") + .HasColumnType("TEXT"); + + b1.Property("Format") + .IsRequired() + .HasMaxLength(6) + .HasColumnType("TEXT"); + + b1.Property("Value") + .IsRequired() + .HasMaxLength(13) + .HasColumnType("TEXT") + .HasColumnName("ISBN"); + + b1.HasKey("Id"); + + b1.HasIndex("BookId"); + + b1.ToTable("BookISBNs", (string)null); + + b1.WithOwner() + .HasForeignKey("BookId"); + }); + + b.Navigation("ISBNs"); + + b.Navigation("Ratings"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", null) + .WithOne() + .HasForeignKey("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserSettingsEntity", "UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("TrackGenres", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.GenreEntity", null) + .WithMany() + .HasForeignKey("GenreId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", null) + .WithMany() + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("TrackTags", b => + { + b.HasOne("Lumina.Application.Common.DataAccess.Entities.Common.TagEntity", null) + .WithMany() + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", null) + .WithMany() + .HasForeignKey("TrackId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.PermissionEntity", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserPermissions"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Authorization.RoleEntity", b => + { + b.Navigation("RolePermissions"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.AlbumEntity", b => + { + b.Navigation("Contributors"); + + b.Navigation("Tracks"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.ArtistEntity", b => + { + b.Navigation("Albums"); + + b.Navigation("Contributors"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary.TrackEntity", b => + { + b.Navigation("Contributors"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryEntity", b => + { + b.Navigation("LibraryScans"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management.LibraryScanEntity", b => + { + b.Navigation("LibraryScanResults"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.MediaLibrary.WrittenContentLibrary.BookLibrary.BookEntity", b => + { + b.Navigation("Artwork"); + + b.Navigation("Contributors"); + }); + + modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b => + { + b.Navigation("Libraries"); + + b.Navigation("LibraryScans"); + + b.Navigation("UserPermissions"); + + b.Navigation("UserRole"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.cs b/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.cs new file mode 100644 index 00000000..9b74da5d --- /dev/null +++ b/src/Lumina.DataAccess/Common/Migrations/20261015160422_AddsPlaybackPreferencesAndStateToUserSettings.cs @@ -0,0 +1,102 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Lumina.DataAccess.Common.Migrations +{ + /// + public partial class AddsPlaybackPreferencesAndStateToUserSettings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsGaplessPlaybackEnabled", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: true) + .Annotation("Relational:ColumnOrder", 16); + + migrationBuilder.AddColumn( + name: "IsMuted", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: false) + .Annotation("Relational:ColumnOrder", 20); + + migrationBuilder.AddColumn( + name: "ReplayGainMode", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: 0) + .Annotation("Relational:ColumnOrder", 17); + + migrationBuilder.AddColumn( + name: "ShouldAutoplay", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: true) + .Annotation("Relational:ColumnOrder", 15); + + migrationBuilder.AddColumn( + name: "ShouldKeepDownloadingWhilePaused", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: true) + .Annotation("Relational:ColumnOrder", 14); + + migrationBuilder.AddColumn( + name: "StreamingQuality", + table: "UserSettings", + type: "INTEGER", + nullable: false, + defaultValue: 0) + .Annotation("Relational:ColumnOrder", 18); + + migrationBuilder.AddColumn( + name: "Volume", + table: "UserSettings", + type: "REAL", + nullable: false, + defaultValue: 1.0) + .Annotation("Relational:ColumnOrder", 19); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsGaplessPlaybackEnabled", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "IsMuted", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "ReplayGainMode", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "ShouldAutoplay", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "ShouldKeepDownloadingWhilePaused", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "StreamingQuality", + table: "UserSettings"); + + migrationBuilder.DropColumn( + name: "Volume", + table: "UserSettings"); + } + } +} diff --git a/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs b/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs index ad7bbe21..9d12074b 100644 --- a/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs +++ b/src/Lumina.DataAccess/Common/Migrations/LuminaDbContextModelSnapshot.cs @@ -2359,6 +2359,14 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("TEXT") .HasColumnOrder(5); + b.Property("IsGaplessPlaybackEnabled") + .HasColumnType("INTEGER") + .HasColumnOrder(16); + + b.Property("IsMuted") + .HasColumnType("INTEGER") + .HasColumnOrder(20); + b.Property("IsPaginationEnabled") .HasColumnType("INTEGER") .HasColumnOrder(2); @@ -2371,6 +2379,10 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("INTEGER") .HasColumnOrder(3); + b.Property("ReplayGainMode") + .HasColumnType("INTEGER") + .HasColumnOrder(17); + b.Property("ShouldAggregateArtworkWhenMissing") .HasColumnType("INTEGER") .HasColumnOrder(13); @@ -2379,10 +2391,18 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("INTEGER") .HasColumnOrder(10); + b.Property("ShouldAutoplay") + .HasColumnType("INTEGER") + .HasColumnOrder(15); + b.Property("ShouldIgnoreThePrefixForAlphaPicker") .HasColumnType("INTEGER") .HasColumnOrder(4); + b.Property("ShouldKeepDownloadingWhilePaused") + .HasColumnType("INTEGER") + .HasColumnOrder(14); + b.Property("ShouldPreserveBookStyles") .HasColumnType("INTEGER") .HasColumnOrder(12); @@ -2391,6 +2411,10 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("INTEGER") .HasColumnOrder(11); + b.Property("StreamingQuality") + .HasColumnType("INTEGER") + .HasColumnOrder(18); + b.Property("UpdatedBy") .HasColumnType("TEXT") .HasColumnOrder(8); @@ -2403,6 +2427,10 @@ namespace Lumina.DataAccess.Common.Migrations .HasColumnType("TEXT") .HasColumnOrder(1); + b.Property("Volume") + .HasColumnType("REAL") + .HasColumnOrder(19); + b.HasKey("Id"); b.HasIndex("UserId") diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/PlaybackStreamingQuality.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/PlaybackStreamingQuality.cs new file mode 100644 index 00000000..6350f42b --- /dev/null +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/PlaybackStreamingQuality.cs @@ -0,0 +1,30 @@ +namespace Lumina.Domain.SharedKernel.Common.Enums.Playback; + +/// +/// Enumeration for the quality cap applied to the audio the server normalizes (remuxes or transcodes) for a user. +/// +/// +/// The caps apply only to audio the server has to change; a track that is played directly is always delivered as it was stored. +/// +public enum PlaybackStreamingQuality +{ + /// + /// The server chooses the quality, with no explicit cap. + /// + Auto, + + /// + /// Normalized audio is capped at 96 kbps. + /// + Low, + + /// + /// Normalized audio is capped at 160 kbps. + /// + Medium, + + /// + /// Normalized audio is capped at 320 kbps. + /// + High, +} diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/ReplayGainMode.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/ReplayGainMode.cs new file mode 100644 index 00000000..fea96752 --- /dev/null +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/Playback/ReplayGainMode.cs @@ -0,0 +1,23 @@ +namespace Lumina.Domain.SharedKernel.Common.Enums.Playback; + +/// +/// Enumeration for the ways ReplayGain normalization is applied to the tracks a user plays. +/// +public enum ReplayGainMode +{ + /// + /// ReplayGain is not applied. Tracks play at the loudness at which they were stored. + /// + Off, + + /// + /// Each track is normalized using its own ReplayGain track gain, so tracks from different albums play at a similar loudness. + /// + Track, + + /// + /// Each track is normalized using the ReplayGain album gain of the album it belongs to, so an album keeps its relative loudness + /// while albums play at a similar loudness to each other. + /// + Album, +} diff --git a/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs b/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs index 4778b3f2..06219906 100644 --- a/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs +++ b/src/Lumina.Domain/Common/Errors/Errors.UserSettings.cs @@ -14,5 +14,15 @@ public static partial class Errors public static Error UserSettingsAlreadyExists => Error.Conflict(description: nameof(UserSettingsAlreadyExists)); public static Error UserSettingsNotFound => Error.NotFound(description: nameof(UserSettingsNotFound)); public static Error ItemsPerPageMustBeGreaterThanZero => Error.Validation(description: nameof(ItemsPerPageMustBeGreaterThanZero)); + public static Error VolumeCannotBeNull => Error.Validation(description: nameof(VolumeCannotBeNull)); + public static Error VolumeMustBeBetweenZeroAndOne => Error.Validation(description: nameof(VolumeMustBeBetweenZeroAndOne)); + public static Error IsMutedCannotBeNull => Error.Validation(description: nameof(IsMutedCannotBeNull)); + public static Error ShouldKeepDownloadingWhilePausedCannotBeNull => Error.Validation(description: nameof(ShouldKeepDownloadingWhilePausedCannotBeNull)); + public static Error ShouldAutoplayCannotBeNull => Error.Validation(description: nameof(ShouldAutoplayCannotBeNull)); + public static Error IsGaplessPlaybackEnabledCannotBeNull => Error.Validation(description: nameof(IsGaplessPlaybackEnabledCannotBeNull)); + public static Error ReplayGainModeCannotBeNull => Error.Validation(description: nameof(ReplayGainModeCannotBeNull)); + public static Error StreamingQualityCannotBeNull => Error.Validation(description: nameof(StreamingQualityCannotBeNull)); + public static Error InvalidReplayGainMode => Error.Validation(description: nameof(InvalidReplayGainMode)); + public static Error InvalidStreamingQuality => Error.Validation(description: nameof(InvalidStreamingQuality)); } } diff --git a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs index 59f22083..5f151cf3 100644 --- a/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs +++ b/src/Lumina.Domain/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettings.cs @@ -1,9 +1,9 @@ #region ========================================================================= USING ===================================================================================== -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Models.Core; using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate.ValueObjects; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Diagnostics; #endregion @@ -23,6 +23,13 @@ public class UserSettings : AggregateRoot private const bool DEFAULT_AGGREGATE_ARTWORK_WHEN_MISSING = false; private const bool DEFAULT_SHOULD_RENDER_PDF_AS_IMAGES = false; private const bool DEFAULT_SHOULD_PRESERVE_BOOK_STYLES = true; + private const bool DEFAULT_SHOULD_KEEP_DOWNLOADING_WHILE_PAUSED = true; + private const bool DEFAULT_SHOULD_AUTOPLAY = true; + private const bool DEFAULT_IS_GAPLESS_PLAYBACK_ENABLED = true; + private const ReplayGainMode DEFAULT_REPLAY_GAIN_MODE = ReplayGainMode.Off; + private const PlaybackStreamingQuality DEFAULT_STREAMING_QUALITY = PlaybackStreamingQuality.Auto; + private const double DEFAULT_VOLUME = 1.0; + private const bool DEFAULT_IS_MUTED = false; /// /// Gets the object representing the unique identifier of the user that owns these settings. @@ -72,6 +79,41 @@ public class UserSettings : AggregateRoot /// public bool ShouldPreserveBookStyles { get; private set; } + /// + /// Gets whether the player keeps downloading a track while playback is paused, or not, up to the entire file. + /// + public bool ShouldKeepDownloadingWhilePaused { get; private set; } + + /// + /// Gets whether the player continues playback at the end of an album or artist, or not. + /// + public bool ShouldAutoplay { get; private set; } + + /// + /// Gets whether the player transitions between consecutive tracks without a gap, or not. + /// + public bool IsGaplessPlaybackEnabled { get; private set; } + + /// + /// Gets the way ReplayGain normalization is applied to the tracks the user plays. + /// + public ReplayGainMode ReplayGainMode { get; private set; } + + /// + /// Gets the quality cap applied to the audio the server normalizes for the user. + /// + public PlaybackStreamingQuality StreamingQuality { get; private set; } + + /// + /// Gets the last volume the player reported for the user. It is written automatically by the player, and is not part of the settings the user edits. + /// + public double Volume { get; private set; } + + /// + /// Gets the last mute state the player reported for the user. It is written automatically by the player, and is not part of the settings the user edits. + /// + public bool IsMuted { get; private set; } + /// /// Initializes a new instance of the class. /// @@ -85,6 +127,13 @@ public class UserSettings : AggregateRoot /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. + /// Whether the player keeps downloading a track while playback is paused, or not. + /// Whether the player continues playback at the end of an album or artist, or not. + /// Whether the player transitions between consecutive tracks without a gap, or not. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. + /// The last volume the player reported for the user. + /// The last mute state the player reported for the user. private UserSettings( UserSettingsId id, UserId userId, @@ -95,7 +144,14 @@ public class UserSettings : AggregateRoot bool shouldAggregateMetadataWhenMissing, bool shouldAggregateArtworkWhenMissing, bool shouldRenderPdfAsImages, - bool shouldPreserveBookStyles) : base(id) + bool shouldPreserveBookStyles, + bool shouldKeepDownloadingWhilePaused, + bool shouldAutoplay, + bool isGaplessPlaybackEnabled, + ReplayGainMode replayGainMode, + PlaybackStreamingQuality streamingQuality, + double volume, + bool isMuted) : base(id) { UserId = userId; IsPaginationEnabled = isPaginationEnabled; @@ -106,6 +162,13 @@ public class UserSettings : AggregateRoot ShouldAggregateArtworkWhenMissing = shouldAggregateArtworkWhenMissing; ShouldRenderPdfAsImages = shouldRenderPdfAsImages; ShouldPreserveBookStyles = shouldPreserveBookStyles; + ShouldKeepDownloadingWhilePaused = shouldKeepDownloadingWhilePaused; + ShouldAutoplay = shouldAutoplay; + IsGaplessPlaybackEnabled = isGaplessPlaybackEnabled; + ReplayGainMode = replayGainMode; + StreamingQuality = streamingQuality; + Volume = volume; + IsMuted = isMuted; } /// @@ -117,15 +180,22 @@ public class UserSettings : AggregateRoot public static Result Create() { return Create( - UserId.CreateUnique(), - DEFAULT_IS_PAGINATION_ENABLED, - DEFAULT_ITEMS_PER_PAGE, - DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, - DEFAULT_IS_THEME_CACHING_ENABLED, - DEFAULT_AGGREGATE_METADATA_WHEN_MISSING, + UserId.CreateUnique(), + DEFAULT_IS_PAGINATION_ENABLED, + DEFAULT_ITEMS_PER_PAGE, + DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, + DEFAULT_IS_THEME_CACHING_ENABLED, + DEFAULT_AGGREGATE_METADATA_WHEN_MISSING, DEFAULT_AGGREGATE_ARTWORK_WHEN_MISSING, DEFAULT_SHOULD_RENDER_PDF_AS_IMAGES, - DEFAULT_SHOULD_PRESERVE_BOOK_STYLES + DEFAULT_SHOULD_PRESERVE_BOOK_STYLES, + DEFAULT_SHOULD_KEEP_DOWNLOADING_WHILE_PAUSED, + DEFAULT_SHOULD_AUTOPLAY, + DEFAULT_IS_GAPLESS_PLAYBACK_ENABLED, + DEFAULT_REPLAY_GAIN_MODE, + DEFAULT_STREAMING_QUALITY, + DEFAULT_VOLUME, + DEFAULT_IS_MUTED ); } @@ -139,15 +209,22 @@ public class UserSettings : AggregateRoot public static Result Create(UserId userId) { return Create( - userId, - DEFAULT_IS_PAGINATION_ENABLED, - DEFAULT_ITEMS_PER_PAGE, - DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, - DEFAULT_IS_THEME_CACHING_ENABLED, - DEFAULT_AGGREGATE_METADATA_WHEN_MISSING, + userId, + DEFAULT_IS_PAGINATION_ENABLED, + DEFAULT_ITEMS_PER_PAGE, + DEFAULT_IGNORE_THE_PREFIX_FOR_ALPHA_PICKER, + DEFAULT_IS_THEME_CACHING_ENABLED, + DEFAULT_AGGREGATE_METADATA_WHEN_MISSING, DEFAULT_AGGREGATE_ARTWORK_WHEN_MISSING, DEFAULT_SHOULD_RENDER_PDF_AS_IMAGES, - DEFAULT_SHOULD_PRESERVE_BOOK_STYLES + DEFAULT_SHOULD_PRESERVE_BOOK_STYLES, + DEFAULT_SHOULD_KEEP_DOWNLOADING_WHILE_PAUSED, + DEFAULT_SHOULD_AUTOPLAY, + DEFAULT_IS_GAPLESS_PLAYBACK_ENABLED, + DEFAULT_REPLAY_GAIN_MODE, + DEFAULT_STREAMING_QUALITY, + DEFAULT_VOLUME, + DEFAULT_IS_MUTED ); } @@ -163,6 +240,13 @@ public class UserSettings : AggregateRoot /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. + /// Whether the player keeps downloading a track while playback is paused, or not. + /// Whether the player continues playback at the end of an album or artist, or not. + /// Whether the player transitions between consecutive tracks without a gap, or not. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. + /// The last volume the player reported for the user. + /// The last mute state the player reported for the user. /// /// An containing either a successfully created , or an error message. /// @@ -175,11 +259,15 @@ public class UserSettings : AggregateRoot bool shouldAggregateMetadataWhenMissing, bool shouldAggregateArtworkWhenMissing, bool shouldRenderPdfAsImages, - bool shouldPreserveBookStyles) + bool shouldPreserveBookStyles, + bool shouldKeepDownloadingWhilePaused, + bool shouldAutoplay, + bool isGaplessPlaybackEnabled, + ReplayGainMode replayGainMode, + PlaybackStreamingQuality streamingQuality, + double volume, + bool isMuted) { - if (itemsPerPage <= 0) - return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; - return new UserSettings( UserSettingsId.CreateUnique(), userId, @@ -190,7 +278,14 @@ public class UserSettings : AggregateRoot shouldAggregateMetadataWhenMissing, shouldAggregateArtworkWhenMissing, shouldRenderPdfAsImages, - shouldPreserveBookStyles); + shouldPreserveBookStyles, + shouldKeepDownloadingWhilePaused, + shouldAutoplay, + isGaplessPlaybackEnabled, + replayGainMode, + streamingQuality, + volume, + isMuted); } /// @@ -206,6 +301,13 @@ public class UserSettings : AggregateRoot /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. + /// Whether the player keeps downloading a track while playback is paused, or not. + /// Whether the player continues playback at the end of an album or artist, or not. + /// Whether the player transitions between consecutive tracks without a gap, or not. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. + /// The last volume the player reported for the user. + /// The last mute state the player reported for the user. /// /// An containing either a successfully created , or an error message. /// @@ -219,17 +321,25 @@ public class UserSettings : AggregateRoot bool shouldAggregateMetadataWhenMissing, bool shouldAggregateArtworkWhenMissing, bool shouldRenderPdfAsImages, - bool shouldPreserveBookStyles) + bool shouldPreserveBookStyles, + bool shouldKeepDownloadingWhilePaused, + bool shouldAutoplay, + bool isGaplessPlaybackEnabled, + ReplayGainMode replayGainMode, + PlaybackStreamingQuality streamingQuality, + double volume, + bool isMuted) { - if (itemsPerPage <= 0) - return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; - - return new UserSettings(id, userId, isPaginationEnabled, itemsPerPage, shouldIgnoreThePrefixForAlphaPicker, isThemeCachingEnabled, shouldAggregateMetadataWhenMissing, shouldAggregateArtworkWhenMissing, shouldRenderPdfAsImages, shouldPreserveBookStyles); + return new UserSettings(id, userId, isPaginationEnabled, itemsPerPage, shouldIgnoreThePrefixForAlphaPicker, isThemeCachingEnabled, shouldAggregateMetadataWhenMissing, shouldAggregateArtworkWhenMissing, shouldRenderPdfAsImages, shouldPreserveBookStyles, shouldKeepDownloadingWhilePaused, shouldAutoplay, isGaplessPlaybackEnabled, replayGainMode, streamingQuality, volume, isMuted); } /// /// Updates the settings of the user. /// + /// + /// The playback state the player reports automatically (the volume and the mute state) is not part of the settings the user edits, so + /// this method neither accepts nor changes it. + /// /// Whether pagination is enabled for the user, or not. /// The number of library items displayed per page when pagination is enabled. /// Whether the "The" prefix of library item titles is ignored by the alpha picker, or not. @@ -238,6 +348,11 @@ public class UserSettings : AggregateRoot /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. /// Whether PDF books are rendered as page images for the user, or not. /// Whether the styles of the book content are preserved when it is rendered for the user, or not. + /// Whether the player keeps downloading a track while playback is paused, or not. + /// Whether the player continues playback at the end of an album or artist, or not. + /// Whether the player transitions between consecutive tracks without a gap, or not. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. /// An representing either a successful update, or an error. public Result UpdateSettings( bool isPaginationEnabled, @@ -247,11 +362,13 @@ public class UserSettings : AggregateRoot bool shouldAggregateMetadataWhenMissing, bool shouldAggregateArtworkWhenMissing, bool shouldRenderPdfAsImages, - bool shouldPreserveBookStyles) + bool shouldPreserveBookStyles, + bool shouldKeepDownloadingWhilePaused, + bool shouldAutoplay, + bool isGaplessPlaybackEnabled, + ReplayGainMode replayGainMode, + PlaybackStreamingQuality streamingQuality) { - if (itemsPerPage <= 0) - return Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero; - IsPaginationEnabled = isPaginationEnabled; ItemsPerPage = itemsPerPage; ShouldIgnoreThePrefixForAlphaPicker = shouldIgnoreThePrefixForAlphaPicker; @@ -260,6 +377,24 @@ public class UserSettings : AggregateRoot ShouldAggregateArtworkWhenMissing = shouldAggregateArtworkWhenMissing; ShouldRenderPdfAsImages = shouldRenderPdfAsImages; ShouldPreserveBookStyles = shouldPreserveBookStyles; + ShouldKeepDownloadingWhilePaused = shouldKeepDownloadingWhilePaused; + ShouldAutoplay = shouldAutoplay; + IsGaplessPlaybackEnabled = isGaplessPlaybackEnabled; + ReplayGainMode = replayGainMode; + StreamingQuality = streamingQuality; + return Result.Updated; + } + + /// + /// Updates the playback state the player reports automatically. + /// + /// The last volume the player reported for the user. + /// The last mute state the player reported for the user. + /// An representing either a successful update, or an error. + public Result UpdatePlaybackState(double volume, bool isMuted) + { + Volume = volume; + IsMuted = isMuted; return Result.Updated; } } diff --git a/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs b/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs index 1be6e11b..3a24a202 100644 --- a/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs +++ b/src/Lumina.Presentation.Api/Common/Routes/UsersManagement/ApiRoutes.Users.cs @@ -13,5 +13,7 @@ public static partial class ApiRoutes public const string GET_USER_BY_ID = "/users/{id}"; public const string GET_USER_SETTINGS = "/users/me/settings"; // uses "me" because it is always for the currently authenticated user public const string UPDATE_USER_SETTINGS = "/users/me/settings"; + public const string GET_PLAYBACK_STATE = "/users/me/settings/playback-state"; + public const string UPDATE_PLAYBACK_STATE = "/users/me/settings/playback-state"; } } diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs new file mode 100644 index 00000000..aebd1029 --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs @@ -0,0 +1,55 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Application.Common.CQRS; +using Lumina.Application.Core.UsersManagement.Settings.Queries.GetPlaybackState; +using Lumina.Contracts.Responses.UsersManagement.Settings; +using Lumina.Domain.Common.Primitives; +using Lumina.Presentation.Api.Common.Routes.UsersManagement; +using Lumina.Presentation.Api.Core.Endpoints.Common; +using Microsoft.AspNetCore.Http; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Settings.GetPlaybackState; + +/// +/// API endpoint for the /users/me/settings/playback-state route. +/// +/// +/// Uses "me" because it is always for the currently authenticated user. +/// +public class GetPlaybackStateEndpoint : BaseEndpoint +{ + private readonly IQueryHandler> _getPlaybackStateQueryHandler; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for handling get playback state queries. + public GetPlaybackStateEndpoint(IQueryHandler> getPlaybackStateQueryHandler) + { + _getPlaybackStateQueryHandler = getPlaybackStateQueryHandler; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(Http.GET); + Routes(ApiRoutes.Users.GET_PLAYBACK_STATE); + Version(1); + DontCatchExceptions(); + } + + /// + /// Gets the playback state the player reported for the current user automatically. + /// + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + Result result = await _getPlaybackStateQueryHandler.HandleAsync(new GetPlaybackStateQuery(), cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs new file mode 100644 index 00000000..1ee71e41 --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs @@ -0,0 +1,59 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Contracts.Responses.UsersManagement.Settings; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Settings.GetPlaybackState; + +/// +/// Class used for providing a textual description for the API endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetPlaybackStateEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetPlaybackStateEndpointSummary() + { + Summary = "Retrieves the playback state the player reported for the current user."; + Description = "Retrieves the last volume and mute state the player reported for the current user. When no settings are stored for the user yet, the default values are returned."; + + Response(200, "The playback state of the current user is returned.", + example: new PlaybackStateResponse( + Volume: 1.0, + IsMuted: false + )); + + Response(401, "Authentication required.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "Authentication failed", + instance = "/api/v1/users/me/settings/playback-state" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "The token has expired", + instance = "/api/v1/users/me/settings/playback-state" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "The token is invalid", + instance = "/api/v1/users/me/settings/playback-state" + } + } + ); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs index 708a3959..5be9415c 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/GetUserSettings/GetUserSettingsEndpointSummary.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using FastEndpoints; using Lumina.Contracts.Responses.UsersManagement.Settings; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Diagnostics.CodeAnalysis; #endregion @@ -31,7 +32,12 @@ public class GetUserSettingsEndpointSummary : Summary +/// API endpoint for the /users/me/settings/playback-state route. +/// +/// +/// Uses "me" because it is always for the currently authenticated user. +/// +public class UpdatePlaybackStateEndpoint : BaseEndpoint +{ + private readonly ICommandHandler> _updatePlaybackStateCommandHandler; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for handling update playback state commands. + public UpdatePlaybackStateEndpoint(ICommandHandler> updatePlaybackStateCommandHandler) + { + _updatePlaybackStateCommandHandler = updatePlaybackStateCommandHandler; + } + + /// + /// Configures the API endpoint. + /// + public override void Configure() + { + Verbs(FastEndpoints.Http.PUT); + Routes(ApiRoutes.Users.UPDATE_PLAYBACK_STATE); + Version(1); + DontCatchExceptions(); + } + + /// + /// Updates the playback state the player reported for the current user automatically. + /// + /// The request containing the latest playback state of the current user. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(UpdatePlaybackStateRequest request, CancellationToken cancellationToken) + { + Result result = await _updatePlaybackStateCommandHandler.HandleAsync(request.ToCommand(), cancellationToken).ConfigureAwait(false); + return result.Match(success => TypedResults.Ok(success), Problem); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs new file mode 100644 index 00000000..03a9c9fa --- /dev/null +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs @@ -0,0 +1,87 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Contracts.Requests.UsersManagement.Settings; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Settings.UpdatePlaybackState; + +/// +/// Class used for providing a textual description for the API endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdatePlaybackStateEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdatePlaybackStateEndpointSummary() + { + Summary = "Updates the playback state the player reported for the current user."; + Description = "Updates the last volume and mute state the player reported for the current user. This is written automatically by the player and is not part of the settings the user edits. When no settings are stored for the user yet, they are created with the provided playback state."; + + ExampleRequest = new UpdatePlaybackStateRequest( + Volume: 0.75, + IsMuted: false + ); + + RequestParam(r => r.Volume, "The last volume the player reported, as a value between 0 and 1. Required."); + RequestParam(r => r.IsMuted, "The last mute state the player reported. Required."); + + Response(200, "The playback state of the current user was successfully updated."); + + Response(401, "Authentication required.", "application/problem+json", + example: new[] + { + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "Authentication failed", + instance = "/api/v1/users/me/settings/playback-state" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "The token has expired", + instance = "/api/v1/users/me/settings/playback-state" + }, + new + { + type = "https://tools.ietf.org/html/rfc7235#section-3.1", + status = 401, + title = "Unauthorized", + detail = "The token is invalid", + instance = "/api/v1/users/me/settings/playback-state" + } + } + ); + + Response(422, "The request did not pass validation checks.", "application/problem+json", + example: new + { + type = "https://tools.ietf.org/html/rfc4918#section-11.2", + title = "General.Validation", + status = 422, + detail = "OneOrMoreValidationErrorsOccurred", + instance = "/api/v1/users/me/settings/playback-state", + errors = new Dictionary + { + { + "General.Validation", new[] + { + "VolumeCannotBeNull", + "VolumeMustBeBetweenZeroAndOne", + "IsMutedCannotBeNull" + } + } + }, + traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00" + } + ); + } +} diff --git a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointSummary.cs b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointSummary.cs index 7e78c199..0b96e4ad 100644 --- a/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointSummary.cs +++ b/src/Lumina.Presentation.Api/Core/Endpoints/UsersManagement/Settings/UpdateUserSettings/UpdateUserSettingsEndpointSummary.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using FastEndpoints; using Lumina.Contracts.Requests.UsersManagement.Settings; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; #endregion @@ -29,7 +30,12 @@ public class UpdateUserSettingsEndpointSummary : Summary r.IsPaginationEnabled, "Whether pagination is enabled for the user, or not. Required."); @@ -40,6 +46,11 @@ public class UpdateUserSettingsEndpointSummary : Summary r.ShouldAggregateArtworkWhenMissing, "Whether the artwork of the media library items is aggregated from multiple providers, when it is missing, or not. Required."); RequestParam(r => r.ShouldRenderPdfAsImages, "Whether PDF books are rendered as page images for the user, or not. Required."); RequestParam(r => r.ShouldPreserveBookStyles, "Whether the styles of the book content are preserved when it is rendered for the user, or not. Required."); + RequestParam(r => r.ShouldKeepDownloadingWhilePaused, "Whether the player keeps downloading a track while playback is paused, or not. Required."); + RequestParam(r => r.ShouldAutoplay, "Whether the player continues playback at the end of an album or artist, or not. Required."); + RequestParam(r => r.IsGaplessPlaybackEnabled, "Whether the player transitions between consecutive tracks without a gap, or not. Required."); + RequestParam(r => r.ReplayGainMode, "The way ReplayGain normalization is applied to the tracks the user plays. Required."); + RequestParam(r => r.StreamingQuality, "The quality cap applied to the audio the server normalizes for the user. Required."); Response(200, "The settings of the current user were successfully updated."); @@ -86,7 +97,14 @@ public class UpdateUserSettingsEndpointSummary : Summary +/// Data transfer object for the playback state a user last reported to the player. The player writes these values automatically, and they are not part of the settings the user edits. +/// +[DebuggerDisplay("Volume: {Volume}; IsMuted: {IsMuted}")] +public class PlaybackStateDto +{ + /// + /// Gets or sets the last volume the player reported, as a value between 0 and 1. + /// + public double? Volume { get; set; } + + /// + /// Gets or sets the last mute state the player reported. + /// + public bool? IsMuted { get; set; } +} diff --git a/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs index 4290cf87..c27e04d9 100644 --- a/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs +++ b/src/Lumina.Presentation.Web/Common/DTO/UsersManagement/UserSettingsDto.cs @@ -1,4 +1,5 @@ #region ========================================================================= USING ===================================================================================== +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; using System; using System.Diagnostics; #endregion @@ -58,4 +59,29 @@ public class UserSettingsDto /// external servers, which those servers could observe; stripping them removes that possibility, at the cost of the look of the book. /// public bool ShouldPreserveBookStyles { get; set; } + + /// + /// Gets or sets whether the player keeps downloading a track while playback is paused, or not, up to the entire file. + /// + public bool? ShouldKeepDownloadingWhilePaused { get; set; } + + /// + /// Gets or sets whether the player continues playback at the end of an album or artist, or not. + /// + public bool? ShouldAutoplay { get; set; } + + /// + /// Gets or sets whether the player transitions between consecutive tracks without a gap, or not. + /// + public bool? IsGaplessPlaybackEnabled { get; set; } + + /// + /// Gets or sets the way ReplayGain normalization is applied to the tracks the user plays. + /// + public ReplayGainMode? ReplayGainMode { get; set; } + + /// + /// Gets or sets the quality cap applied to the audio the server normalizes for the user. + /// + public PlaybackStreamingQuality? StreamingQuality { get; set; } } diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/PlaybackStreamingQuality.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/PlaybackStreamingQuality.cs new file mode 100644 index 00000000..283aabfe --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/PlaybackStreamingQuality.cs @@ -0,0 +1,35 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the quality cap applied to the audio the server normalizes (remuxes or transcodes) for a user. +/// +/// +/// The caps apply only to audio the server has to change; a track that is played directly is always delivered as it was stored. +/// +[DebuggerDisplay("{ToString()}")] +public enum PlaybackStreamingQuality +{ + /// + /// The server chooses the quality, with no explicit cap. + /// + Auto, + + /// + /// Normalized audio is capped at 96 kbps. + /// + Low, + + /// + /// Normalized audio is capped at 160 kbps. + /// + Medium, + + /// + /// Normalized audio is capped at 320 kbps. + /// + High, +} diff --git a/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/ReplayGainMode.cs b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/ReplayGainMode.cs new file mode 100644 index 00000000..ebcd97ec --- /dev/null +++ b/src/Lumina.Presentation.Web/Common/Enums/AudioLibrary/ReplayGainMode.cs @@ -0,0 +1,28 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Presentation.Web.Common.Enums.AudioLibrary; + +/// +/// Enumeration for the ways ReplayGain normalization is applied to the tracks a user plays. +/// +[DebuggerDisplay("{ToString()}")] +public enum ReplayGainMode +{ + /// + /// ReplayGain is not applied. Tracks play at the loudness at which they were stored. + /// + Off, + + /// + /// Each track is normalized using its own ReplayGain track gain, so tracks from different albums play at a similar loudness. + /// + Track, + + /// + /// Each track is normalized using the ReplayGain album gain of the album it belongs to, so an album keeps its relative loudness + /// while albums play at a similar loudness to each other. + /// + Album, +} diff --git a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs index 7ef9fa39..dbcfecf3 100644 --- a/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs +++ b/src/Lumina.Presentation.Web/Common/Routes/ApiRoutes.Users.cs @@ -12,5 +12,7 @@ public static partial class ApiRoutes { public const string GET_USER_SETTINGS = "users/me/settings"; public const string UPDATE_USER_SETTINGS = "users/me/settings"; + public const string GET_PLAYBACK_STATE = "users/me/settings/playback-state"; + public const string UPDATE_PLAYBACK_STATE = "users/me/settings/playback-state"; } } diff --git a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs index 267383c8..3806b805 100644 --- a/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs +++ b/src/Lumina.Presentation.Web/Common/Routes/WebRoutes.Settings.cs @@ -13,5 +13,7 @@ public static partial class WebRoutes public const string INDEX = "{culture}/tools/settings"; public const string GET_USER_SETTINGS = "{culture}/tools/settings/api-get-user-settings"; public const string UPDATE_USER_SETTINGS = "{culture}/tools/settings/api-update-user-settings"; + public const string GET_PLAYBACK_STATE = "{culture}/tools/settings/api-get-playback-state"; + public const string UPDATE_PLAYBACK_STATE = "{culture}/tools/settings/api-update-playback-state"; } } diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs new file mode 100644 index 00000000..ed497ad3 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpoint.cs @@ -0,0 +1,53 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.UsersManagement; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.GetPlaybackState; + +/// +/// API endpoint for the /{culture}/tools/settings/api-get-playback-state route. +/// +public class GetPlaybackStateEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public GetPlaybackStateEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.GET); + Routes(WebRoutes.Settings.GET_PLAYBACK_STATE); + DontAutoTag(); + Options(options => options.WithTags("Settings")); + } + + /// + /// Retrieves the playback state the player reported for the current user automatically. + /// + /// The request object. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(EmptyRequest request, CancellationToken cancellationToken) + { + PlaybackStateDto response = await _apiHttpClient.GetAsync(ApiRoutes.Users.GET_PLAYBACK_STATE, cancellationToken).ConfigureAwait(false); + return JsonSuccess(response); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs new file mode 100644 index 00000000..5984cb06 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/GetPlaybackState/GetPlaybackStateEndpointSummary.cs @@ -0,0 +1,26 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.DTO.Common; +using Lumina.Presentation.Web.Common.DTO.UsersManagement; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.GetPlaybackState; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class GetPlaybackStateEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public GetPlaybackStateEndpointSummary() + { + Summary = "Retrieves the playback state the player reported for the current user."; + Description = "Retrieves the last volume and mute state the player reported for the current user. These values are not part of the settings the user edits."; + + Response(200, "The playback state of the current user is returned.", example: new SuccessResponse(true, default)); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpoint.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpoint.cs new file mode 100644 index 00000000..8c0be3be --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpoint.cs @@ -0,0 +1,54 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.Api; +using Lumina.Presentation.Web.Common.DTO.UsersManagement; +using Lumina.Presentation.Web.Common.Routes; +using Lumina.Presentation.Web.Core.Endpoints.Common; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using System.Threading; +using System.Threading.Tasks; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.UpdatePlaybackState; + +/// +/// API endpoint for the /{culture}/tools/settings/api-update-playback-state route. +/// +public class UpdatePlaybackStateEndpoint : BaseEndpoint +{ + private readonly IApiHttpClient _apiHttpClient; + + /// + /// Initializes a new instance of the class. + /// + /// Injected service for interactions with the API. + public UpdatePlaybackStateEndpoint(IApiHttpClient apiHttpClient) + { + _apiHttpClient = apiHttpClient; + } + + /// + /// Configures the endpoint. + /// + public override void Configure() + { + base.Configure(); + Verbs(Http.POST); + Routes(WebRoutes.Settings.UPDATE_PLAYBACK_STATE); + DontAutoTag(); + Options(options => options.WithTags("Settings")); + EnableAntiforgery(); + } + + /// + /// Updates the playback state the player reported for the current user automatically. + /// + /// The request containing the latest playback state of the current user. + /// Cancellation token that can be used to stop the execution. + public override async Task ExecuteAsync(PlaybackStateDto request, CancellationToken cancellationToken) + { + await _apiHttpClient.PutAsync(ApiRoutes.Users.UPDATE_PLAYBACK_STATE, request, cancellationToken).ConfigureAwait(false); + return JsonSuccess(new { isUpdated = true }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs new file mode 100644 index 00000000..d68c0530 --- /dev/null +++ b/src/Lumina.Presentation.Web/Core/Endpoints/Tools/Settings/UpdatePlaybackState/UpdatePlaybackStateEndpointSummary.cs @@ -0,0 +1,30 @@ +#region ========================================================================= USING ===================================================================================== +using FastEndpoints; +using Lumina.Presentation.Web.Common.DTO.UsersManagement; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Presentation.Web.Core.Endpoints.Tools.Settings.UpdatePlaybackState; + +/// +/// Class used for providing a textual description for the endpoint, for OpenAPI. +/// +[ExcludeFromCodeCoverage] +public class UpdatePlaybackStateEndpointSummary : Summary +{ + /// + /// Initializes a new instance of the class. + /// + public UpdatePlaybackStateEndpointSummary() + { + Summary = "Updates the playback state the player reported for the current user."; + Description = "Updates the last volume and mute state the player reported for the current user. This is written automatically by the player and is not part of the settings the user edits."; + + RequestParam(r => r.Volume, "The last volume the player reported, as a value between 0 and 1. Required."); + RequestParam(r => r.IsMuted, "The last mute state the player reported. Required."); + + ExampleRequest = new PlaybackStateDto { Volume = 1.0, IsMuted = false }; + + Response(200, "The playback state of the current user is updated.", example: new { success = true, data = new { isUpdated = true } }); + } +} diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ar-SA.resx index ac29e5d3..d2251bd8 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ar-SA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ar-SA.resx @@ -813,4 +813,34 @@ نوع الجدول غير صالح! + + وضع ReplayGain غير صالح! + + + جودة البث غير صالحة! + + + لا يمكن أن تكون حالة الكتم فارغة! + + + لا يمكن أن يكون مستوى الصوت فارغًا! + + + يجب أن يكون مستوى الصوت بين 0 و 1! + + + لا يمكن أن يكون إعداد متابعة التنزيل أثناء الإيقاف المؤقت فارغًا! + + + لا يمكن أن يكون إعداد التشغيل التلقائي فارغًا! + + + لا يمكن أن يكون إعداد التشغيل دون فواصل فارغًا! + + + لا يمكن أن يكون وضع ReplayGain فارغًا! + + + لا يمكن أن تكون جودة البث فارغة! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.de-DE.resx index c8647bcc..36820a5d 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.de-DE.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.de-DE.resx @@ -813,4 +813,34 @@ Der Zeitplantyp ist ungültig! + + Ungültiger ReplayGain-Modus! + + + Ungültige Streaming-Qualität! + + + Der Stummschaltungsstatus darf nicht null sein! + + + Die Lautstärke darf nicht null sein! + + + Die Lautstärke muss zwischen 0 und 1 liegen! + + + Die Einstellung zum Weiterherunterladen beim Pausieren darf nicht null sein! + + + Die Einstellung für die automatische Wiedergabe darf nicht null sein! + + + Die Einstellung für die lückenlose Wiedergabe darf nicht null sein! + + + Der ReplayGain-Modus darf nicht null sein! + + + Die Streaming-Qualität darf nicht null sein! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.en-US.resx index f13e7548..93aaeaaa 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.en-US.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.en-US.resx @@ -813,4 +813,34 @@ The schedule type is invalid! + + Invalid ReplayGain mode! + + + Invalid streaming quality! + + + The mute state cannot be null! + + + The volume cannot be null! + + + The volume must be between 0 and 1! + + + The keep-downloading-while-paused preference cannot be null! + + + The autoplay preference cannot be null! + + + The gapless playback preference cannot be null! + + + The ReplayGain mode cannot be null! + + + The streaming quality cannot be null! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.es-ES.resx index faafc50f..d7c88159 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.es-ES.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.es-ES.resx @@ -813,4 +813,34 @@ El tipo de programación no es válido! + + ¡Modo ReplayGain no válido! + + + ¡Calidad de transmisión no válida! + + + ¡El estado de silencio no puede ser nulo! + + + ¡El volumen no puede ser nulo! + + + ¡El volumen debe estar entre 0 y 1! + + + ¡La preferencia de seguir descargando en pausa no puede ser nula! + + + ¡La preferencia de reproducción automática no puede ser nula! + + + ¡La preferencia de reproducción sin pausas no puede ser nula! + + + ¡El modo ReplayGain no puede ser nulo! + + + ¡La calidad de transmisión no puede ser nula! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.fr-FR.resx index 1d433f85..4cb0b921 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.fr-FR.resx @@ -813,4 +813,34 @@ Le type de planification n'est pas valide ! + + Mode ReplayGain non valide ! + + + Qualité de diffusion non valide ! + + + L'état de sourdine ne peut pas être nul ! + + + Le volume ne peut pas être nul ! + + + Le volume doit être compris entre 0 et 1 ! + + + La préférence de téléchargement en pause ne peut pas être nulle ! + + + La préférence de lecture automatique ne peut pas être nulle ! + + + La préférence de lecture sans interruption ne peut pas être nulle ! + + + Le mode ReplayGain ne peut pas être nul ! + + + La qualité de diffusion ne peut pas être nulle ! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.it-IT.resx index e41878ca..065a0846 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.it-IT.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.it-IT.resx @@ -813,4 +813,34 @@ Il tipo di pianificazione non è valido! + + Modalità ReplayGain non valida! + + + Qualità dello streaming non valida! + + + Lo stato di silenziamento non può essere nullo! + + + Il volume non può essere nullo! + + + Il volume deve essere compreso tra 0 e 1! + + + La preferenza di continuare il download in pausa non può essere nulla! + + + La preferenza di riproduzione automatica non può essere nulla! + + + La preferenza di riproduzione senza interruzioni non può essere nulla! + + + La modalità ReplayGain non può essere nulla! + + + La qualità dello streaming non può essere nulla! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ja-JP.resx index 2cd57da7..44d8928f 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ja-JP.resx @@ -813,4 +813,34 @@ スケジュールタイプが無効です! + + ReplayGain モードが無効です。 + + + ストリーミング品質が無効です。 + + + ミュート状態は null にできません。 + + + 音量は null にできません。 + + + 音量は 0 から 1 の間でなければなりません。 + + + 一時停止中のダウンロード継続の設定は null にできません。 + + + 自動再生の設定は null にできません。 + + + ギャップレス再生の設定は null にできません。 + + + ReplayGain モードは null にできません。 + + + ストリーミング品質は null にできません。 + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.resx index fe193be8..922d0096 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.resx @@ -813,4 +813,34 @@ The schedule type is invalid! + + Invalid ReplayGain mode! + + + Invalid streaming quality! + + + The mute state cannot be null! + + + The volume cannot be null! + + + The volume must be between 0 and 1! + + + The keep-downloading-while-paused preference cannot be null! + + + The autoplay preference cannot be null! + + + The gapless playback preference cannot be null! + + + The ReplayGain mode cannot be null! + + + The streaming quality cannot be null! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ro-RO.resx index 2aa1c5dd..4eb8295a 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.ro-RO.resx @@ -813,4 +813,34 @@ Tipul de programare este invalid! + + Mod ReplayGain invalid! + + + Calitate de streaming invalidă! + + + Starea de mut nu poate fi nulă! + + + Volumul nu poate fi nul! + + + Volumul trebuie să fie între 0 și 1! + + + Preferința de a continua descărcarea în pauză nu poate fi nulă! + + + Preferința de redare automată nu poate fi nulă! + + + Preferința de redare fără întreruperi nu poate fi nulă! + + + Modul ReplayGain nu poate fi nul! + + + Calitatea fluxului nu poate fi nulă! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.uk-UA.resx index ea2e4393..4743fff4 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.uk-UA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.uk-UA.resx @@ -813,4 +813,34 @@ Тип розкладу недійсний! + + Неприпустимий режим ReplayGain! + + + Неприпустима якість потокового передавання! + + + Стан без звуку не може бути порожнім! + + + Гучність не може бути порожньою! + + + Гучність має бути між 0 і 1! + + + Налаштування продовження завантаження на паузі не може бути порожнім! + + + Налаштування автовідтворення не може бути порожнім! + + + Налаштування відтворення без пауз не може бути порожнім! + + + Режим ReplayGain не може бути порожнім! + + + Якість потокового передавання не може бути порожньою! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.zh-CN.resx index 0b05709e..9045e36d 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Common/Middlewares/ExceptionHandlingMiddleware.zh-CN.resx @@ -813,4 +813,34 @@ 调度类型无效! + + 无效的 ReplayGain 模式! + + + 无效的流媒体质量! + + + 静音状态不能为空! + + + 音量不能为空! + + + 音量必须介于 0 和 1 之间! + + + 暂停时继续下载的偏好设置不能为空! + + + 自动播放的偏好设置不能为空! + + + 无缝播放的偏好设置不能为空! + + + ReplayGain 模式不能为空! + + + 流媒体质量不能为空! + \ No newline at end of file diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ar-SA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ar-SA.resx index 96b79082..a506eef3 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ar-SA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ar-SA.resx @@ -69,4 +69,58 @@ عند التفعيل، تُستكمل الأعمال الفنية لعناصر المكتبة التي لا يوفرها مزود الأعمال الفنية الأول من المزودين التاليين. + + التشغيل + + + متابعة التنزيل أثناء الإيقاف المؤقت + + + ما إذا كان المشغل يواصل تنزيل المقطع أثناء إيقاف التشغيل مؤقتًا، حتى الملف كاملاً، بحيث لا ينتظر الاستئناف البيانات أبدًا. + + + التشغيل التلقائي + + + ما إذا كان التشغيل يستمر تلقائيًا بالمقاطع التالية عند انتهاء الألبوم أو الفنان. + + + تشغيل دون فواصل + + + ما إذا كانت المقاطع المتتالية تُشغَّل دون صمت بينها. + + + ReplayGain + + + كيفية تطبيق تسوية ReplayGain على المقاطع التي تشغّلها. + + + إيقاف + + + لكل مقطع + + + لكل ألبوم + + + جودة البث + + + حد الجودة الذي يُطبَّق عندما يضطر الخادم إلى تسوية مقطع للتشغيل. لا يتغير التشغيل المباشر أبدًا. + + + تلقائي + + + منخفضة (96 kbps) + + + متوسطة (160 kbps) + + + عالية (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx index e2d3bb19..e3767eb2 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.de-DE.resx @@ -69,4 +69,58 @@ Wenn aktiviert, wird das Artwork von Bibliothekselementen, das der erste Artwork-Anbieter nicht liefert, aus den nachfolgenden Anbietern ergänzt. + + Wiedergabe + + + Beim Pausieren weiter herunterladen + + + Ob der Player den Titel auch bei pausierter Wiedergabe weiter herunterlädt, bis zur gesamten Datei, damit die Fortsetzung nie auf Daten warten muss. + + + Automatische Wiedergabe + + + Ob die Wiedergabe am Ende eines Albums oder Interpreten automatisch mit den folgenden Titeln fortgesetzt wird. + + + Lückenlose Wiedergabe + + + Ob aufeinanderfolgende Titel ohne stille Lücke zwischen ihnen abgespielt werden. + + + ReplayGain + + + Wie die ReplayGain-Normalisierung auf die abgespielten Titel angewendet wird. + + + Aus + + + Pro Titel + + + Pro Album + + + Streaming-Qualität + + + Die Qualitätsobergrenze, die angewendet wird, wenn der Server einen Titel für die Wiedergabe normalisieren muss. Die direkte Wiedergabe wird nie verändert. + + + Automatisch + + + Niedrig (96 kbit/s) + + + Mittel (160 kbit/s) + + + Hoch (320 kbit/s) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx index 2778bb63..27a71a6f 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.en-US.resx @@ -69,4 +69,58 @@ When enabled, the artwork of library items that the first artwork provider does not supply is filled in from the following providers. + + Playback + + + Keep downloading while paused + + + Whether the player keeps downloading the track while playback is paused, up to the entire file, so resuming never waits for data. + + + Autoplay + + + Whether playback continues automatically with the following tracks when an album or artist finishes. + + + Gapless playback + + + Whether consecutive tracks play without a silent gap between them. + + + ReplayGain + + + How ReplayGain normalization is applied to the tracks you play. + + + Off + + + Per track + + + Per album + + + Streaming quality + + + The quality cap applied when the server has to normalize a track for playback. Direct playback is never changed. + + + Automatic + + + Low (96 kbps) + + + Medium (160 kbps) + + + High (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx index fc36ab24..c4ad3366 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.es-ES.resx @@ -69,4 +69,58 @@ Cuando está habilitado, las ilustraciones de los elementos de la biblioteca que el primer proveedor de ilustraciones no proporciona se completan desde los proveedores siguientes. + + Reproducción + + + Seguir descargando en pausa + + + Indica si el reproductor sigue descargando la pista mientras la reproducción está en pausa, hasta el archivo completo, para que reanudar nunca espere datos. + + + Reproducción automática + + + Indica si la reproducción continúa automáticamente con las pistas siguientes al terminar un álbum o un artista. + + + Reproducción sin pausas + + + Indica si las pistas consecutivas se reproducen sin un silencio entre ellas. + + + ReplayGain + + + Cómo se aplica la normalización ReplayGain a las pistas que reproduces. + + + Desactivado + + + Por pista + + + Por álbum + + + Calidad de transmisión + + + El límite de calidad que se aplica cuando el servidor tiene que normalizar una pista para reproducirla. La reproducción directa nunca se modifica. + + + Automática + + + Baja (96 kbps) + + + Media (160 kbps) + + + Alta (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx index 0366f7b8..5b327b98 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.fr-FR.resx @@ -69,4 +69,58 @@ Lorsque cette option est activée, les illustrations des éléments de la bibliothèque que le premier fournisseur d'illustrations ne fournit pas sont complétées par les fournisseurs suivants. + + Lecture + + + Continuer le téléchargement en pause + + + Indique si le lecteur continue de télécharger le morceau lorsque la lecture est en pause, jusqu'au fichier entier, afin que la reprise n'attende jamais les données. + + + Lecture automatique + + + Indique si la lecture se poursuit automatiquement avec les morceaux suivants à la fin d'un album ou d'un artiste. + + + Lecture sans interruption + + + Indique si les morceaux consécutifs sont lus sans silence entre eux. + + + ReplayGain + + + La manière dont la normalisation ReplayGain est appliquée aux morceaux que vous écoutez. + + + Désactivé + + + Par morceau + + + Par album + + + Qualité de diffusion + + + Le plafond de qualité appliqué lorsque le serveur doit normaliser un morceau pour la lecture. La lecture directe n'est jamais modifiée. + + + Automatique + + + Basse (96 kbit/s) + + + Moyenne (160 kbit/s) + + + Élevée (320 kbit/s) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx index 70ab422f..82a30343 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.it-IT.resx @@ -69,4 +69,58 @@ Se abilitato, le illustrazioni degli elementi della libreria che il primo provider di illustrazioni non fornisce vengono integrate dai provider successivi. + + Riproduzione + + + Continua il download in pausa + + + Indica se il lettore continua a scaricare il brano mentre la riproduzione è in pausa, fino all'intero file, così che la ripresa non debba mai attendere i dati. + + + Riproduzione automatica + + + Indica se la riproduzione continua automaticamente con i brani successivi al termine di un album o di un artista. + + + Riproduzione senza interruzioni + + + Indica se i brani consecutivi vengono riprodotti senza un silenzio tra loro. + + + ReplayGain + + + Come la normalizzazione ReplayGain viene applicata ai brani che riproduci. + + + Disattivato + + + Per brano + + + Per album + + + Qualità dello streaming + + + Il limite di qualità applicato quando il server deve normalizzare un brano per la riproduzione. La riproduzione diretta non viene mai modificata. + + + Automatica + + + Bassa (96 kbps) + + + Media (160 kbps) + + + Alta (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx index 6b24406d..0114337d 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ja-JP.resx @@ -69,4 +69,58 @@ 有効にすると、最初のアートワークプロバイダーが提供しないライブラリ項目のアートワークが、後続のプロバイダーから補完されます。 + + 再生 + + + 一時停止中もダウンロードを続ける + + + 再生を一時停止している間もプレーヤーがトラックのダウンロードをファイル全体まで続けるかどうか。再開時にデータを待たずに済みます。 + + + 自動再生 + + + アルバムまたはアーティストの再生が終わったときに、続くトラックを自動的に再生するかどうか。 + + + ギャップレス再生 + + + 連続するトラックを間に無音を挟まずに再生するかどうか。 + + + ReplayGain + + + 再生するトラックに ReplayGain の正規化をどのように適用するか。 + + + オフ + + + トラックごと + + + アルバムごと + + + ストリーミング品質 + + + サーバーが再生のためにトラックを正規化する必要がある場合に適用される品質の上限。直接再生は決して変更されません。 + + + 自動 + + + 低 (96 kbps) + + + 中 (160 kbps) + + + 高 (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx index 2778bb63..27a71a6f 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.resx @@ -69,4 +69,58 @@ When enabled, the artwork of library items that the first artwork provider does not supply is filled in from the following providers. + + Playback + + + Keep downloading while paused + + + Whether the player keeps downloading the track while playback is paused, up to the entire file, so resuming never waits for data. + + + Autoplay + + + Whether playback continues automatically with the following tracks when an album or artist finishes. + + + Gapless playback + + + Whether consecutive tracks play without a silent gap between them. + + + ReplayGain + + + How ReplayGain normalization is applied to the tracks you play. + + + Off + + + Per track + + + Per album + + + Streaming quality + + + The quality cap applied when the server has to normalize a track for playback. Direct playback is never changed. + + + Automatic + + + Low (96 kbps) + + + Medium (160 kbps) + + + High (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx index 1a6e38b5..cf66fa31 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.ro-RO.resx @@ -69,4 +69,58 @@ Când este activat, ilustrațiile elementelor din bibliotecă pe care primul furnizor de ilustrații nu le oferă sunt completate de la furnizorii următori. + + Redare + + + Continuă descărcarea în pauză + + + Dacă playerul continuă să descarce piesa în timp ce redarea este în pauză, până la întregul fișier, astfel încât reluarea să nu aștepte niciodată datele. + + + Redare automată + + + Dacă redarea continuă automat cu piesele următoare la sfârșitul unui album sau al unui artist. + + + Redare fără întreruperi + + + Dacă piesele consecutive sunt redate fără o pauză de sunet între ele. + + + ReplayGain + + + Modul în care normalizarea ReplayGain este aplicată pieselor pe care le redai. + + + Dezactivat + + + Per piesă + + + Per album + + + Calitatea fluxului + + + Limita de calitate aplicată atunci când serverul trebuie să normalizeze o piesă pentru redare. Redarea directă nu este niciodată modificată. + + + Automată + + + Redusă (96 kbps) + + + Medie (160 kbps) + + + Ridicată (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.uk-UA.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.uk-UA.resx index 74bf06a6..6bbf73e6 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.uk-UA.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.uk-UA.resx @@ -69,4 +69,58 @@ Коли ввімкнено, ілюстрації елементів бібліотеки, які не надає перший постачальник ілюстрацій, доповнюються від наступних постачальників. + + Відтворення + + + Продовжувати завантаження на паузі + + + Чи продовжує програвач завантажувати трек, поки відтворення призупинено, аж до всього файлу, щоб відновлення ніколи не чекало на дані. + + + Автовідтворення + + + Чи продовжується відтворення автоматично наступними треками після завершення альбому або виконавця. + + + Відтворення без пауз + + + Чи відтворюються послідовні треки без тихої паузи між ними. + + + ReplayGain + + + Як нормалізація ReplayGain застосовується до треків, які ви відтворюєте. + + + Вимкнено + + + Для кожного треку + + + Для кожного альбому + + + Якість потокового передавання + + + Обмеження якості, що застосовується, коли сервер має нормалізувати трек для відтворення. Пряме відтворення ніколи не змінюється. + + + Автоматично + + + Низька (96 kbps) + + + Середня (160 kbps) + + + Висока (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx index 592699f7..08aa28b9 100644 --- a/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx +++ b/src/Lumina.Presentation.Web/Core/Resources/Views/Tools/Settings.zh-CN.resx @@ -69,4 +69,58 @@ 启用后,首个图片提供程序未提供的媒体库项目图片将由后续提供程序补齐。 + + 播放 + + + 暂停时继续下载 + + + 播放暂停时播放器是否继续下载曲目直到整个文件,这样恢复播放时无需等待数据。 + + + 自动播放 + + + 专辑或艺术家播放结束后是否自动继续播放后续曲目。 + + + 无缝播放 + + + 连续曲目之间是否无静默间隔地播放。 + + + ReplayGain + + + 如何对您播放的曲目应用 ReplayGain 音量标准化。 + + + 关闭 + + + 按曲目 + + + 按专辑 + + + 流媒体质量 + + + 当服务器需要为播放对曲目进行标准化时应用的质量上限。直接播放永远不会被更改。 + + + 自动 + + + 低 (96 kbps) + + + 中 (160 kbps) + + + 高 (320 kbps) + diff --git a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml index 904b8a2d..0a38b2b1 100644 --- a/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml +++ b/src/Lumina.Presentation.Web/Core/Views/Tools/Settings.cshtml @@ -130,6 +130,78 @@ @_localizer["DescriptionShouldAggregateArtworkWhenMissing"] + +
+

@_localizer["Playback"]

+
+ +
+
+ : +
+
+ +
+ @_localizer["DescriptionShouldKeepDownloadingWhilePaused"] +
+ +
+
+ : +
+
+ +
+ @_localizer["DescriptionShouldAutoplay"] +
+ +
+
+ : +
+
+ +
+ @_localizer["DescriptionIsGaplessPlaybackEnabled"] +
+ +
+
+ : +
+
+ +
+ @_localizer["DescriptionReplayGainMode"] +
+ +
+
+ : +
+
+ +
+ @_localizer["DescriptionStreamingQuality"] +
@@ -154,6 +226,11 @@ const checkboxShouldPreserveBookStyles = document.getElementById('ShouldPreserveBookStyles'); const checkboxShouldAggregateMetadataWhenMissing = document.getElementById('ShouldAggregateMetadataWhenMissing'); const checkboxShouldAggregateArtworkWhenMissing = document.getElementById('ShouldAggregateArtworkWhenMissing'); + const checkboxShouldKeepDownloadingWhilePaused = document.getElementById('ShouldKeepDownloadingWhilePaused'); + const checkboxShouldAutoplay = document.getElementById('ShouldAutoplay'); + const checkboxIsGaplessPlaybackEnabled = document.getElementById('IsGaplessPlaybackEnabled'); + const selectReplayGainMode = document.getElementById('ReplayGainMode'); + const selectStreamingQuality = document.getElementById('StreamingQuality'); // Toggle the enabled state of the items per page input based on the pagination checkbox. function updateItemsPerPageEnabledState() { @@ -172,6 +249,11 @@ checkboxShouldPreserveBookStyles.checked = data.shouldPreserveBookStyles === true; checkboxShouldAggregateMetadataWhenMissing.checked = data.shouldAggregateMetadataWhenMissing === true; checkboxShouldAggregateArtworkWhenMissing.checked = data.shouldAggregateArtworkWhenMissing === true; + checkboxShouldKeepDownloadingWhilePaused.checked = data.shouldKeepDownloadingWhilePaused === true; + checkboxShouldAutoplay.checked = data.shouldAutoplay === true; + checkboxIsGaplessPlaybackEnabled.checked = data.isGaplessPlaybackEnabled === true; + selectReplayGainMode.value = data.replayGainMode ?? 'Off'; + selectStreamingQuality.value = data.streamingQuality ?? 'Auto'; updateItemsPerPageEnabledState(); } } @@ -186,7 +268,12 @@ ShouldAggregateMetadataWhenMissing: checkboxShouldAggregateMetadataWhenMissing.checked, ShouldAggregateArtworkWhenMissing: checkboxShouldAggregateArtworkWhenMissing.checked, ShouldRenderPdfAsImages: checkboxShouldRenderPdfAsImages.checked, - ShouldPreserveBookStyles: checkboxShouldPreserveBookStyles.checked + ShouldPreserveBookStyles: checkboxShouldPreserveBookStyles.checked, + ShouldKeepDownloadingWhilePaused: checkboxShouldKeepDownloadingWhilePaused.checked, + ShouldAutoplay: checkboxShouldAutoplay.checked, + IsGaplessPlaybackEnabled: checkboxIsGaplessPlaybackEnabled.checked, + ReplayGainMode: selectReplayGainMode.value, + StreamingQuality: selectStreamingQuality.value }; const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_USER_SETTINGS)', formData); if (data && data.isUpdated === true) diff --git a/src/Lumina.sln b/src/Lumina.sln index 8a3f9d13..f9cafda0 100644 --- a/src/Lumina.sln +++ b/src/Lumina.sln @@ -412,7 +412,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "authorization", "authorizat EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "settings", "settings", "{240E1B2A-08A3-439D-B8B2-4D9C18B4AF8A}" ProjectSection(SolutionItems) = preProject + ..\docs\technical\requests\users-management\settings\GetPlaybackState.http = ..\docs\technical\requests\users-management\settings\GetPlaybackState.http ..\docs\technical\requests\users-management\settings\GetUserSettings.http = ..\docs\technical\requests\users-management\settings\GetUserSettings.http + ..\docs\technical\requests\users-management\settings\UpdatePlaybackState.http = ..\docs\technical\requests\users-management\settings\UpdatePlaybackState.http ..\docs\technical\requests\users-management\settings\UpdateUserSettings.http = ..\docs\technical\requests\users-management\settings\UpdateUserSettings.http EndProjectSection EndProject diff --git a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs index 721527a2..9997a6ae 100644 --- a/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Common/DataAccess/Entities/UsersManagement/UserSettingsEntityFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Application.Common.DataAccess.Entities.UsersManagement; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -27,6 +28,13 @@ public class UserSettingsEntityFixture /// Optional. Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing, or not. /// Optional. Whether PDF books are rendered as page images for the user, or not. /// Optional. Whether the styles of the book content are preserved when it is rendered for the user, or not. + /// Optional. Whether the player keeps downloading a track while playback is paused, or not. + /// Optional. Whether the player continues playback at the end of an album or artist, or not. + /// Optional. Whether the player transitions between consecutive tracks without a gap, or not. + /// Optional. The way ReplayGain normalization is applied to the tracks the user plays. + /// Optional. The quality cap applied to the audio the server normalizes for the user. + /// Optional. The last volume the player reported for the user. + /// Optional. The last mute state the player reported for the user. /// The created user settings entity. public UserSettingsEntity Create( Guid? id = null, @@ -37,7 +45,14 @@ public class UserSettingsEntityFixture bool? isThemeCachingEnabled = null, bool? shouldAggregateMetadataWhenMissing = null, bool? shouldRenderPdfAsImages = null, - bool? shouldPreserveBookStyles = null) + bool? shouldPreserveBookStyles = null, + bool? shouldKeepDownloadingWhilePaused = null, + bool? shouldAutoplay = null, + bool? isGaplessPlaybackEnabled = null, + ReplayGainMode? replayGainMode = null, + PlaybackStreamingQuality? streamingQuality = null, + double? volume = null, + bool? isMuted = null) { return new Faker() .CustomInstantiator(f => new UserSettingsEntity @@ -50,7 +65,14 @@ public class UserSettingsEntityFixture IsThemeCachingEnabled = isThemeCachingEnabled ?? f.Random.Bool(), ShouldAggregateMetadataWhenMissing = shouldAggregateMetadataWhenMissing ?? f.Random.Bool(), ShouldRenderPdfAsImages = shouldRenderPdfAsImages ?? f.Random.Bool(), - ShouldPreserveBookStyles = shouldPreserveBookStyles ?? f.Random.Bool() + ShouldPreserveBookStyles = shouldPreserveBookStyles ?? f.Random.Bool(), + ShouldKeepDownloadingWhilePaused = shouldKeepDownloadingWhilePaused ?? f.Random.Bool(), + ShouldAutoplay = shouldAutoplay ?? f.Random.Bool(), + IsGaplessPlaybackEnabled = isGaplessPlaybackEnabled ?? f.Random.Bool(), + ReplayGainMode = replayGainMode ?? f.PickRandom(), + StreamingQuality = streamingQuality ?? f.PickRandom(), + Volume = volume ?? f.Random.Double(0.0, 1.0), + IsMuted = isMuted ?? f.Random.Bool() }) .Generate(); } diff --git a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs index 36b56f5f..73f32c90 100644 --- a/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs +++ b/tests/Common/Lumina.Application.Fixtures/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Application.Core.UsersManagement.Settings.Commands.UpdateUserSettings; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -25,6 +26,11 @@ public class UpdateUserSettingsCommandFixture /// Optional. Whether the artwork of the media library items is aggregated from multiple providers, when it is missing. /// Optional. Whether PDF books are rendered as page images for the user. /// Optional. Whether the styles of the book content are preserved when it is rendered for the user. + /// Optional. Whether the player keeps downloading a track while playback is paused, or not. + /// Optional. Whether the player continues playback at the end of an album or artist, or not. + /// Optional. Whether the player transitions between consecutive tracks without a gap, or not. + /// Optional. The way ReplayGain normalization is applied to the tracks the user plays. + /// Optional. The quality cap applied to the audio the server normalizes for the user. /// The created command. public UpdateUserSettingsCommand Create( bool? isPaginationEnabled = null, @@ -34,10 +40,15 @@ public class UpdateUserSettingsCommandFixture bool? shouldAggregateMetadataWhenMissing = null, bool? shouldAggregateArtworkWhenMissing = null, bool? shouldRenderPdfAsImages = null, - bool? shouldPreserveBookStyles = null) + bool? shouldPreserveBookStyles = null, + bool? shouldKeepDownloadingWhilePaused = null, + bool? shouldAutoplay = null, + bool? isGaplessPlaybackEnabled = null, + ReplayGainMode? replayGainMode = null, + PlaybackStreamingQuality? streamingQuality = null) { return new Faker() - .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default, default, default, default, default, default)) + .CustomInstantiator(f => new UpdateUserSettingsCommand(default, default, default, default, default, default, default, default, default, default, default, default, default)) .RuleFor(x => x.IsPaginationEnabled, f => isPaginationEnabled ?? f.Random.Bool()) .RuleFor(x => x.ItemsPerPage, f => itemsPerPage ?? f.Random.Int(1, 100)) .RuleFor(x => x.ShouldIgnoreThePrefixForAlphaPicker, f => shouldIgnoreThePrefixForAlphaPicker ?? f.Random.Bool()) @@ -46,6 +57,11 @@ public class UpdateUserSettingsCommandFixture .RuleFor(x => x.ShouldAggregateArtworkWhenMissing, f => shouldAggregateArtworkWhenMissing ?? f.Random.Bool()) .RuleFor(x => x.ShouldRenderPdfAsImages, f => shouldRenderPdfAsImages ?? f.Random.Bool()) .RuleFor(x => x.ShouldPreserveBookStyles, f => shouldPreserveBookStyles ?? f.Random.Bool()) + .RuleFor(x => x.ShouldKeepDownloadingWhilePaused, f => shouldKeepDownloadingWhilePaused ?? f.Random.Bool()) + .RuleFor(x => x.ShouldAutoplay, f => shouldAutoplay ?? f.Random.Bool()) + .RuleFor(x => x.IsGaplessPlaybackEnabled, f => isGaplessPlaybackEnabled ?? f.Random.Bool()) + .RuleFor(x => x.ReplayGainMode, f => replayGainMode ?? f.PickRandom()) + .RuleFor(x => x.StreamingQuality, f => streamingQuality ?? f.PickRandom()) .Generate(); } diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/UsersManagement/Settings/UpdateUserSettingsRequestFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/UsersManagement/Settings/UpdateUserSettingsRequestFixture.cs index 6240d10e..44c56f6b 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/UsersManagement/Settings/UpdateUserSettingsRequestFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Requests/UsersManagement/Settings/UpdateUserSettingsRequestFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Contracts.Requests.UsersManagement.Settings; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -27,6 +28,11 @@ public class UpdateUserSettingsRequestFixture /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing. /// Whether PDF books are rendered as page images for the user. /// Whether the styles of the book content are preserved when it is rendered for the user. + /// Whether the player keeps downloading a track while playback is paused. + /// Whether the player continues playback at the end of an album or artist. + /// Whether the player transitions between consecutive tracks without a gap. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. /// The created . public UpdateUserSettingsRequest Create( bool? isPaginationEnabled = null, @@ -36,7 +42,12 @@ public class UpdateUserSettingsRequestFixture bool? shouldAggregateMetadataWhenMissing = null, bool? shouldAggregateArtworkWhenMissing = null, bool? shouldRenderPdfAsImages = null, - bool? shouldPreserveBookStyles = null) + bool? shouldPreserveBookStyles = null, + bool? shouldKeepDownloadingWhilePaused = null, + bool? shouldAutoplay = null, + bool? isGaplessPlaybackEnabled = null, + ReplayGainMode? replayGainMode = null, + PlaybackStreamingQuality? streamingQuality = null) { return new UpdateUserSettingsRequest( isPaginationEnabled ?? _faker.Random.Bool(), @@ -46,7 +57,12 @@ public class UpdateUserSettingsRequestFixture shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool(), shouldAggregateArtworkWhenMissing ?? _faker.Random.Bool(), shouldRenderPdfAsImages ?? _faker.Random.Bool(), - shouldPreserveBookStyles ?? _faker.Random.Bool()); + shouldPreserveBookStyles ?? _faker.Random.Bool(), + shouldKeepDownloadingWhilePaused ?? _faker.Random.Bool(), + shouldAutoplay ?? _faker.Random.Bool(), + isGaplessPlaybackEnabled ?? _faker.Random.Bool(), + replayGainMode ?? _faker.PickRandom(), + streamingQuality ?? _faker.PickRandom()); } /// diff --git a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/UsersManagement/Settings/UserSettingsResponseFixture.cs b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/UsersManagement/Settings/UserSettingsResponseFixture.cs index 0723a9d2..504e3b92 100644 --- a/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/UsersManagement/Settings/UserSettingsResponseFixture.cs +++ b/tests/Common/Lumina.Contracts.Fixtures/Core/Responses/UsersManagement/Settings/UserSettingsResponseFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Contracts.Responses.UsersManagement.Settings; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -29,6 +30,11 @@ public class UserSettingsResponseFixture /// Optional. Whether the artwork of the media library items is aggregated from multiple providers, when it is missing. /// Optional. Whether PDF books are rendered as page images for the user. /// Optional. Whether the styles of the book content are preserved when it is rendered for the user. + /// Optional. Whether the player keeps downloading a track while playback is paused. + /// Optional. Whether the player continues playback at the end of an album or artist. + /// Optional. Whether the player transitions between consecutive tracks without a gap. + /// Optional. The way ReplayGain normalization is applied to the tracks the user plays. + /// Optional. The quality cap applied to the audio the server normalizes for the user. /// The created . public UserSettingsResponse Create( Guid? userId = null, @@ -39,7 +45,12 @@ public class UserSettingsResponseFixture bool? shouldAggregateMetadataWhenMissing = null, bool? shouldAggregateArtworkWhenMissing = null, bool? shouldRenderPdfAsImages = null, - bool? shouldPreserveBookStyles = null) + bool? shouldPreserveBookStyles = null, + bool? shouldKeepDownloadingWhilePaused = null, + bool? shouldAutoplay = null, + bool? isGaplessPlaybackEnabled = null, + ReplayGainMode? replayGainMode = null, + PlaybackStreamingQuality? streamingQuality = null) { return new UserSettingsResponse( userId ?? Guid.NewGuid(), @@ -50,7 +61,12 @@ public class UserSettingsResponseFixture shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool(), shouldAggregateArtworkWhenMissing ?? _faker.Random.Bool(), shouldRenderPdfAsImages ?? _faker.Random.Bool(), - shouldPreserveBookStyles ?? _faker.Random.Bool()); + shouldPreserveBookStyles ?? _faker.Random.Bool(), + shouldKeepDownloadingWhilePaused ?? _faker.Random.Bool(), + shouldAutoplay ?? _faker.Random.Bool(), + isGaplessPlaybackEnabled ?? _faker.Random.Bool(), + replayGainMode ?? _faker.PickRandom(), + streamingQuality ?? _faker.PickRandom()); } /// diff --git a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs index 066592cc..5ed4e956 100644 --- a/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs +++ b/tests/Common/Lumina.Domain.Fixtures/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsFixture.cs @@ -2,6 +2,7 @@ using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -28,6 +29,13 @@ public class UserSettingsFixture /// Whether the artwork of the media library items is aggregated from multiple providers, when it is missing. /// Whether PDF books are rendered as page images for the user. /// Whether the styles of the book content are preserved when it is rendered for the user. + /// Whether the player keeps downloading a track while playback is paused. + /// Whether the player continues playback at the end of an album or artist. + /// Whether the player transitions between consecutive tracks without a gap. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. + /// The last volume the player reported for the user. + /// The last mute state the player reported for the user. /// The created . public UserSettings Create( Guid? userId = null, @@ -38,7 +46,14 @@ public class UserSettingsFixture bool shouldAggregateMetadataWhenMissing = false, bool shouldAggregateArtworkWhenMissing = false, bool shouldRenderPdfAsImages = false, - bool shouldPreserveBookStyles = true) + bool shouldPreserveBookStyles = true, + bool shouldKeepDownloadingWhilePaused = true, + bool shouldAutoplay = true, + bool isGaplessPlaybackEnabled = true, + ReplayGainMode replayGainMode = ReplayGainMode.Off, + PlaybackStreamingQuality streamingQuality = PlaybackStreamingQuality.Auto, + double volume = 1.0, + bool isMuted = false) { Result settings = UserSettings.Create( userId is null ? UserId.CreateUnique() : UserId.Create(userId.Value), @@ -49,7 +64,14 @@ public class UserSettingsFixture shouldAggregateMetadataWhenMissing, shouldAggregateArtworkWhenMissing, shouldRenderPdfAsImages, - shouldPreserveBookStyles); + shouldPreserveBookStyles, + shouldKeepDownloadingWhilePaused, + shouldAutoplay, + isGaplessPlaybackEnabled, + replayGainMode, + streamingQuality, + volume, + isMuted); return settings.Value; } diff --git a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/UsersManagement/UserSettingsDtoFixture.cs b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/UsersManagement/UserSettingsDtoFixture.cs index 29004a70..90317ec5 100644 --- a/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/UsersManagement/UserSettingsDtoFixture.cs +++ b/tests/Common/Lumina.Presentation.Web.Fixtures/Common/DTO/UsersManagement/UserSettingsDtoFixture.cs @@ -1,6 +1,7 @@ #region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Presentation.Web.Common.DTO.UsersManagement; +using Lumina.Presentation.Web.Common.Enums.AudioLibrary; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -28,6 +29,11 @@ public class UserSettingsDtoFixture /// Whether the metadata of the media library items is aggregated from multiple providers, when fields are missing. /// Whether PDF books are rendered as page images for the user. /// Whether the styles of the book content are preserved when it is rendered for the user. + /// Whether the player keeps downloading a track while playback is paused. + /// Whether the player continues playback at the end of an album or artist. + /// Whether the player transitions between consecutive tracks without a gap. + /// The way ReplayGain normalization is applied to the tracks the user plays. + /// The quality cap applied to the audio the server normalizes for the user. /// A configured instance. public UserSettingsDto Create( Guid? userId = null, @@ -37,7 +43,12 @@ public class UserSettingsDtoFixture bool? isThemeCachingEnabled = null, bool? shouldAggregateMetadataWhenMissing = null, bool? shouldRenderPdfAsImages = null, - bool? shouldPreserveBookStyles = null) + bool? shouldPreserveBookStyles = null, + bool? shouldKeepDownloadingWhilePaused = null, + bool? shouldAutoplay = null, + bool? isGaplessPlaybackEnabled = null, + ReplayGainMode? replayGainMode = null, + PlaybackStreamingQuality? streamingQuality = null) { return new UserSettingsDto { @@ -48,7 +59,12 @@ public class UserSettingsDtoFixture IsThemeCachingEnabled = isThemeCachingEnabled ?? _faker.Random.Bool(), ShouldAggregateMetadataWhenMissing = shouldAggregateMetadataWhenMissing ?? _faker.Random.Bool(), ShouldRenderPdfAsImages = shouldRenderPdfAsImages ?? _faker.Random.Bool(), - ShouldPreserveBookStyles = shouldPreserveBookStyles ?? _faker.Random.Bool() + ShouldPreserveBookStyles = shouldPreserveBookStyles ?? _faker.Random.Bool(), + ShouldKeepDownloadingWhilePaused = shouldKeepDownloadingWhilePaused ?? _faker.Random.Bool(), + ShouldAutoplay = shouldAutoplay ?? _faker.Random.Bool(), + IsGaplessPlaybackEnabled = isGaplessPlaybackEnabled ?? _faker.Random.Bool(), + ReplayGainMode = replayGainMode ?? _faker.PickRandom(), + StreamingQuality = streamingQuality ?? _faker.PickRandom() }; } diff --git a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs index 9b4c7a08..08c37f4d 100644 --- a/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs +++ b/tests/UnitTests/Lumina.Application.UnitTests/Core/UsersManagement/Settings/Commands/UpdateUserSettings/UpdateUserSettingsCommandHandlerTests.cs @@ -192,43 +192,6 @@ public class UpdateUserSettingsCommandHandlerTests await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); } - [Fact] - public async Task HandleAsync_WhenToDomainEntityFails_ShouldReturnErrorAndNotUpdate() - { - // Arrange - UpdateUserSettingsCommand command = _updateUserSettingsCommandFixture.Create(); - // An entity carrying an invalid items-per-page value fails to convert to its domain aggregate. - UserSettingsEntity existingSettings = _userSettingsEntityFixture.Create(userId: _userId, itemsPerPage: 0); - _mockUserSettingsRepository.GetByUserIdAsync(_userId, Arg.Any()) - .Returns(Result.From(existingSettings)); - - // Act - Result result = await _sut.HandleAsync(command, CancellationToken.None); - - // Assert - Assert.True(result.IsFailure); - await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); - await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); - } - - [Fact] - public async Task HandleAsync_WhenUpdateSettingsFails_ShouldReturnErrorAndNotPersist() - { - // Arrange - UpdateUserSettingsCommand command = _updateUserSettingsCommandFixture.Create(itemsPerPage: 0); - UserSettingsEntity existingSettings = _userSettingsEntityFixture.Create(userId: _userId); - _mockUserSettingsRepository.GetByUserIdAsync(_userId, Arg.Any()) - .Returns(Result.From(existingSettings)); - - // Act - Result result = await _sut.HandleAsync(command, CancellationToken.None); - - // Assert - Assert.True(result.IsFailure); - await _mockUserSettingsRepository.DidNotReceive().UpdateAsync(Arg.Any(), Arg.Any()); - await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any()); - } - [Fact] public async Task HandleAsync_WhenUpdateFails_ShouldReturnErrorAndNotSaveChanges() { diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs index 7cd1e9a8..672d78cb 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Common/Errors/ErrorsTests.cs @@ -79,10 +79,20 @@ public class ErrorsTests { // Assert // The count assertion fails when an error is added or removed, reminding to update the assertions below. - Assert.Equal(3, typeof(DomainErrors.UserSettings).GetProperties().Length); + Assert.Equal(13, typeof(DomainErrors.UserSettings).GetProperties().Length); AssertError(DomainErrors.UserSettings.UserSettingsAlreadyExists, ErrorType.Conflict); AssertError(DomainErrors.UserSettings.UserSettingsNotFound, ErrorType.NotFound); AssertError(DomainErrors.UserSettings.ItemsPerPageMustBeGreaterThanZero, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.VolumeCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.VolumeMustBeBetweenZeroAndOne, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.IsMutedCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.ShouldKeepDownloadingWhilePausedCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.ShouldAutoplayCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.IsGaplessPlaybackEnabledCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.ReplayGainModeCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.StreamingQualityCannotBeNull, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.InvalidReplayGainMode, ErrorType.Validation); + AssertError(DomainErrors.UserSettings.InvalidStreamingQuality, ErrorType.Validation); } [Fact] diff --git a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs index 49092a2e..fbb27861 100644 --- a/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs +++ b/tests/UnitTests/Lumina.Domain.UnitTests/Core/BoundedContexts/UserManagementBoundedContext/UserSettingsAggregate/UserSettingsTests.cs @@ -1,5 +1,4 @@ #region ========================================================================= USING ===================================================================================== -using Lumina.Domain.Common.Errors; using Lumina.Domain.Common.Primitives; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects; using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate; @@ -7,6 +6,7 @@ using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserSettin using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects; using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate; using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.UserSettingsAggregate.ValueObjects; +using Lumina.Domain.SharedKernel.Common.Enums.Playback; using System.Diagnostics.CodeAnalysis; #endregion @@ -80,7 +80,7 @@ public class UserSettingsTests UserId userId = _userIdFixture.Create(); // Act - Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, shouldIgnoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: true, shouldAggregateArtworkWhenMissing: true, shouldRenderPdfAsImages: true, shouldPreserveBookStyles: true); + Result result = UserSettings.Create(userId, isPaginationEnabled: false, itemsPerPage: 24, shouldIgnoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: true, shouldAggregateArtworkWhenMissing: true, shouldRenderPdfAsImages: true, shouldPreserveBookStyles: true, shouldKeepDownloadingWhilePaused: true, shouldAutoplay: true, isGaplessPlaybackEnabled: true, replayGainMode: ReplayGainMode.Off, streamingQuality: PlaybackStreamingQuality.Auto, volume: 1.0, isMuted: false); // Assert Assert.False(result.IsFailure); @@ -108,22 +108,6 @@ public class UserSettingsTests Assert.NotEqual(result.Value.Id.Value, result.Value.UserId.Value); } - [Theory] - [InlineData(0)] - [InlineData(-1)] - public void Create_WhenItemsPerPageIsNotPositive_ShouldReturnError(int itemsPerPage) - { - // Arrange - UserId userId = _userIdFixture.Create(); - - // Act - Result result = UserSettings.Create(userId, isPaginationEnabled: true, itemsPerPage: itemsPerPage, shouldIgnoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: false, shouldAggregateArtworkWhenMissing: false, shouldRenderPdfAsImages: false, shouldPreserveBookStyles: false); - - // Assert - Assert.True(result.IsFailure); - Assert.Equal(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero, result.FirstError); - } - [Fact] public void Create_WhenCalledWithPreExistingIdAndValidValues_ShouldCreateSettingsWithThatId() { @@ -132,7 +116,7 @@ public class UserSettingsTests UserSettingsId id = _userSettingsIdFixture.Create(); // Act - Result result = UserSettings.Create(id, userId, isPaginationEnabled: true, itemsPerPage: 24, shouldIgnoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: false, shouldAggregateArtworkWhenMissing: false, shouldRenderPdfAsImages: false, shouldPreserveBookStyles: true); + Result result = UserSettings.Create(id, userId, isPaginationEnabled: true, itemsPerPage: 24, shouldIgnoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: false, shouldAggregateArtworkWhenMissing: false, shouldRenderPdfAsImages: false, shouldPreserveBookStyles: true, shouldKeepDownloadingWhilePaused: true, shouldAutoplay: true, isGaplessPlaybackEnabled: true, replayGainMode: ReplayGainMode.Off, streamingQuality: PlaybackStreamingQuality.Auto, volume: 1.0, isMuted: false); // Assert Assert.False(result.IsFailure); @@ -141,21 +125,6 @@ public class UserSettingsTests Assert.Equal(24, result.Value.ItemsPerPage); } - [Fact] - public void Create_WhenCalledWithPreExistingIdAndNonPositiveItemsPerPage_ShouldReturnError() - { - // Arrange - UserId userId = _userIdFixture.Create(); - UserSettingsId id = _userSettingsIdFixture.Create(); - - // Act - Result result = UserSettings.Create(id, userId, isPaginationEnabled: true, itemsPerPage: 0, shouldIgnoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: false, shouldAggregateArtworkWhenMissing: false, shouldRenderPdfAsImages: false, shouldPreserveBookStyles: false); - - // Assert - Assert.True(result.IsFailure); - Assert.Equal(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero, result.FirstError); - } - [Fact] public void UpdateSettings_WhenCalledWithValidValues_ShouldUpdateSettings() { @@ -163,7 +132,7 @@ public class UserSettingsTests UserSettings userSettings = _userSettingsFixture.Create(); // Act - Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, shouldIgnoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: false, shouldAggregateMetadataWhenMissing: true, shouldAggregateArtworkWhenMissing: true, shouldRenderPdfAsImages: true, shouldPreserveBookStyles: true); + Result result = userSettings.UpdateSettings(isPaginationEnabled: false, itemsPerPage: 12, shouldIgnoreThePrefixForAlphaPicker: true, isThemeCachingEnabled: false, shouldAggregateMetadataWhenMissing: true, shouldAggregateArtworkWhenMissing: true, shouldRenderPdfAsImages: true, shouldPreserveBookStyles: true, shouldKeepDownloadingWhilePaused: true, shouldAutoplay: true, isGaplessPlaybackEnabled: true, replayGainMode: ReplayGainMode.Off, streamingQuality: PlaybackStreamingQuality.Auto); // Assert Assert.False(result.IsFailure); @@ -175,20 +144,4 @@ public class UserSettingsTests Assert.True(userSettings.ShouldRenderPdfAsImages); Assert.True(userSettings.ShouldPreserveBookStyles); } - - [Theory] - [InlineData(0)] - [InlineData(-5)] - public void UpdateSettings_WhenItemsPerPageIsNotPositive_ShouldReturnError(int itemsPerPage) - { - // Arrange - UserSettings userSettings = _userSettingsFixture.Create(); - - // Act - Result result = userSettings.UpdateSettings(isPaginationEnabled: true, itemsPerPage: itemsPerPage, shouldIgnoreThePrefixForAlphaPicker: false, isThemeCachingEnabled: true, shouldAggregateMetadataWhenMissing: false, shouldAggregateArtworkWhenMissing: false, shouldRenderPdfAsImages: false, shouldPreserveBookStyles: false); - - // Assert - Assert.True(result.IsFailure); - Assert.Equal(Errors.UserSettings.ItemsPerPageMustBeGreaterThanZero, result.FirstError); - } }