Adds the opt-in directory fast skip scan setting and renames the library scan settings for consistency

This commit is contained in:
BinaryAlley committed 2026-08-09 13:18:07 -07:00
1 parent cce145e522
commit 9c2e5452da
38 files changed
+1360 -146

No files matched your search

@@ -17,8 +17,9 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
/// <param name="CoverImage">The path of the image file used as the cover for the library.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated.</param>
/// <param name="DownloadMedatadaFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="SaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="DownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.</param>
[DebuggerDisplay("Title: {Title}")]
public record AddLibraryCommand(
string? Title,
@@ -27,6 +28,7 @@ public record AddLibraryCommand(
string? CoverImage,
bool IsEnabled,
bool IsLocked,
bool DownloadMedatadaFromWeb,
bool SaveMetadataInMediaDirectories
bool DownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan
) : IRequest<ErrorOr<LibraryResponse>>;
@@ -65,7 +65,7 @@ public class AddLibraryCommandHandler : IRequestHandler<AddLibraryCommand, Error
/// <param name="request">The request to be handled.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a successfuly created <see cref="LibraryResponse"/>, or an error message.
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully created <see cref="LibraryResponse"/>, or an error message.
/// </returns>
public async ValueTask<ErrorOr<LibraryResponse>> Handle(AddLibraryCommand request, CancellationToken cancellationToken)
{
@@ -98,8 +98,9 @@ public class AddLibraryCommandHandler : IRequestHandler<AddLibraryCommand, Error
request.CoverImage,
request.IsEnabled,
request.IsLocked,
request.DownloadMedatadaFromWeb,
request.SaveMetadataInMediaDirectories,
request.DownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan,
[]
);
@@ -19,8 +19,9 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary
/// <param name="CoverImage">The path of the image file used as the cover for the library.</param>
/// <param name="IsEnabled">Whether this media library is enabled or not. A disabled media library is never shown or changed.</param>
/// <param name="IsLocked">Whether this media library is locked or not. A locked media library is displayed, but is never changed or updated.</param>
/// <param name="DownloadMedatadaFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="SaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="DownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.</param>
[DebuggerDisplay("Title: {Title}")]
public record UpdateLibraryCommand(
Guid Id,
@@ -31,6 +32,7 @@ public record UpdateLibraryCommand(
string? CoverImage,
bool IsEnabled,
bool IsLocked,
bool DownloadMedatadaFromWeb,
bool SaveMetadataInMediaDirectories
bool DownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan
) : IRequest<ErrorOr<LibraryResponse>>;
@@ -68,7 +68,7 @@ public class UpdateLibraryCommandHandler : IRequestHandler<UpdateLibraryCommand,
/// <param name="request">The request to be handled.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>
/// An <see cref="ErrorOr{TValue}"/> containing either a successfuly updated <see cref="LibraryResponse"/>, or an error message.
/// An <see cref="ErrorOr{TValue}"/> containing either a successfully updated <see cref="LibraryResponse"/>, or an error message.
/// </returns>
public async ValueTask<ErrorOr<LibraryResponse>> Handle(UpdateLibraryCommand request, CancellationToken cancellationToken)
{
@@ -110,8 +110,9 @@ public class UpdateLibraryCommandHandler : IRequestHandler<UpdateLibraryCommand,
request.CoverImage,
request.IsEnabled,
request.IsLocked,
request.DownloadMedatadaFromWeb,
request.SaveMetadataInMediaDirectories,
request.DownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan,
getLibraryResult.Value.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id)).ToList()
);
if (createLibraryResult.IsError)
@@ -63,7 +63,7 @@ public class LibraryScanQueuedDomainEventHandler : INotificationHandler<LibraryS
// start the media library scan
ErrorOr<Success> startScanResult = await _mediaLibraryScanningService.StartScanAsync(
libraryScanDomainResult.Value, getLibraryScanResult.Value.Library.LibraryType, getLibraryScanResult.Value.Library.DownloadMedatadaFromWeb, cancellationToken).ConfigureAwait(false);
libraryScanDomainResult.Value, getLibraryScanResult.Value.Library.LibraryType, getLibraryScanResult.Value.Library.DownloadMetadataFromWeb, cancellationToken).ConfigureAwait(false);
if (startScanResult.IsError)
throw new EventualConsistencyException(startScanResult.FirstError, startScanResult.Errors);