mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Adds playback preferences and auto-persisted playback state to user settings
This commit is contained in:
1 parent
aab36dcd29
commit
dd76309ded
81 files changed
+6102
-173
No files matched your search
+36
@@ -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
|
||||
/// </summary>
|
||||
public bool ShouldPreserveBookStyles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the player keeps downloading a track while playback is paused, or not, up to the entire file.
|
||||
/// </summary>
|
||||
public bool ShouldKeepDownloadingWhilePaused { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the player continues playback at the end of an album or artist, or not.
|
||||
/// </summary>
|
||||
public bool ShouldAutoplay { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the player transitions between consecutive tracks without a gap, or not.
|
||||
/// </summary>
|
||||
public bool IsGaplessPlaybackEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the way ReplayGain normalization is applied to the tracks the user plays.
|
||||
/// </summary>
|
||||
public ReplayGainMode ReplayGainMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the quality cap applied to the audio the server normalizes for the user.
|
||||
/// </summary>
|
||||
public PlaybackStreamingQuality StreamingQuality { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public double Volume { get; set; } = 1.0;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public bool IsMuted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time and date when the entity was added.
|
||||
/// </summary>
|
||||
|
||||
+25
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for converting <see cref="UpdatePlaybackStateRequest"/>.
|
||||
/// </summary>
|
||||
public static class UpdatePlaybackStateRequestMapping
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts <paramref name="request"/> to <see cref="UpdatePlaybackStateCommand"/>.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to be converted.</param>
|
||||
/// <returns>The converted command.</returns>
|
||||
public static UpdatePlaybackStateCommand ToCommand(this UpdatePlaybackStateRequest request)
|
||||
{
|
||||
return new UpdatePlaybackStateCommand(
|
||||
request.Volume,
|
||||
request.IsMuted
|
||||
);
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user