Adds a per-library option to skip hidden files and directories during scans

This commit is contained in:
BinaryAlley committed 2026-11-27 09:52:40 +02:00
1 parent 0bb795dca5
commit 0e8d61b215
67 files changed
+4624 -19

No files matched your search

+4 -2
View File
@@ -34,7 +34,7 @@ Lumina can scan two kinds of libraries today:
The other types in Lumina's model, such as movies, TV shows, comics, manga, photos, podcasts and audiobooks, are designed but not implemented yet. There is no scanner for them, so they cannot be scanned. The other types in Lumina's model, such as movies, TV shows, comics, manga, photos, podcasts and audiobooks, are designed but not implemented yet. There is no scanner for them, so they cannot be scanned.
A scan includes hidden files and folders. A scan includes hidden files and folders, unless the library is set to skip them.
## Creating a library ## Creating a library
@@ -51,6 +51,7 @@ Open the Libraries management page, choose to add a library, and fill in the for
| Download metadata from the web | on | Whether Lumina may look up the metadata of the items online. This only has an effect when a metadata provider is enabled for the library (see [Plugins](../plugins/index.md)). | | Download metadata from the web | on | Whether Lumina may look up the metadata of the items online. This only has an effect when a metadata provider is enabled for the library (see [Plugins](../plugins/index.md)). |
| Save metadata in media directories | off | Whether the metadata Lumina fetches is also written next to your media files, so other tools can read it. This is the one option that writes into your media folders. | | Save metadata in media directories | off | Whether the metadata Lumina fetches is also written next to your media files, so other tools can read it. This is the one option that writes into your media folders. |
| Skip unchanged directories during scan | off | An opt-in speedup that skips folders whose own last-modified time has not changed since the last scan. Editing the contents of an existing file in place, without adding, removing or renaming anything in that folder, leaves the folder's time untouched, so that edit can be missed while it is on. | | Skip unchanged directories during scan | off | An opt-in speedup that skips folders whose own last-modified time has not changed since the last scan. Editing the contents of an existing file in place, without adding, removing or renaming anything in that folder, leaves the folder's time untouched, so that edit can be missed while it is on. |
| Skip hidden files and directories during scan | off | Whether hidden files and hidden folders are left out of the scan. Off indexes them like any other item. |
| Content is on SSD | off | Whether the folders of this library are stored on a solid state drive. When on, the file discovery and content hashing stages read several files at the same time, which is faster on solid state drives. Leave it off for mechanical hard drives, where reading files in parallel can slow the scan down. | | Content is on SSD | off | Whether the folders of this library are stored on a solid state drive. When on, the file discovery and content hashing stages read several files at the same time, which is faster on solid state drives. Leave it off for mechanical hard drives, where reading files in parallel can slow the scan down. |
| Track consumption progress | the type default | Whether the latest playback or reading position of the library's items is remembered, so a user can resume where they left off. | | Track consumption progress | the type default | Whether the latest playback or reading position of the library's items is remembered, so a user can resume where they left off. |
| Completion threshold | the type default | The percentage of an item that must be consumed for a stopped session to be recorded as completed. Empty means completion is recorded only when it is reported explicitly. | | Completion threshold | the type default | The percentage of an item that must be consumed for a stopped session to be recorded as completed. Empty means completion is recorded only when it is reported explicitly. |
@@ -195,7 +196,8 @@ These are per user settings, each user changes their own from the settings page
## Things to watch out for ## Things to watch out for
- **`Save metadata in media directories` writes into your media folders.** It is off by default; turn it on only if you want metadata files to accompany your media. - **`Save metadata in media directories` writes into your media folders.** It is off by default; turn it on only if you want metadata files to accompany your media.
- **`Skip unchanged directories during scan` can miss in-place edits.** It trusts each folder's own last-modified time, so editing the contents of an existing file without adding, removing or renaming anything in its folder leaves the folder unchanged and it gets skipped. Adding, removing or renaming a file does change the folder, and is still seen. - **`Skip unchanged directories during scan` can miss in-place edits.** It trusts each folder's own last-modified time, so editing the contents of an existing file without adding, removing or renaming anything in its folder leaves the folder unchanged and it gets skipped. Adding, removing or renaming a file does change the folder, and is still seen. Changing either scan scope setting discards the stored directory fingerprints, so the next scan reads the whole library.
- **`Skip hidden files and directories during scan` leaves hidden items out of the catalogue.** Files and folders marked as hidden by the operating system, and dot-prefixed names on Unix-like systems, are not indexed while it is on. Turning it back off picks them up on the next scan, and changing either scan scope setting discards the stored directory fingerprints, so the next scan reads the whole library.
- **`Content is on SSD` changes how file discovery and content hashing read files.** Turn it on only when the folders of the library really are on a solid state drive. On a mechanical hard drive, parallel reads can make those stages slower than sequential ones. - **`Content is on SSD` changes how file discovery and content hashing read files.** Turn it on only when the folders of the library really are on a solid state drive. On a mechanical hard drive, parallel reads can make those stages slower than sequential ones.
- **`Locked` blocks everything.** A locked library is not scanned and not updated, including by the scheduler. - **`Locked` blocks everything.** A locked library is not scanned and not updated, including by the scheduler.
- **`Disabled` hides the library.** A disabled library is neither shown on the dashboard nor touched. - **`Disabled` hides the library.** A disabled library is neither shown on the dashboard nor touched.
@@ -65,6 +65,7 @@ POST api/v1/libraries
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -85,7 +86,7 @@ POST api/v1/libraries
} }
``` ```
The `metadataProviders`, `artworkProviders` and `bookReaders` lists configure the providers and readers of the library in the same request: each entry names a plugin returned by the matching `GET api/v1/libraries/{metadata-providers|artwork-providers|book-readers}/{libraryType}` request, and whether it is enabled, and the order of the provider entries is the order in which the providers are tried. A supported plugin left out of a list is added disabled, after the listed ones. The `isEnabled` of an entry can be omitted, in which case the stored state is kept and a provider without one starts disabled, so a list can reorder providers without changing their state. A list that is `null` or absent adds every supported plugin disabled, in alphabetical order. A plugin that does not support the library type fails the request with `PluginNotSupportedForLibraryType`. The `metadataProviders`, `artworkProviders` and `bookReaders` lists configure the providers and readers of the library in the same request: each entry names a plugin returned by the matching `GET api/v1/libraries/{metadata-providers|artwork-providers|book-readers}/{libraryType}` request, and whether it is enabled, and the order of the provider entries is the order in which the providers are tried. A supported plugin left out of a list is added disabled, after the listed ones. The `isEnabled` of an entry can be omitted, in which case the stored state is kept and a provider without one starts disabled, so a list can reorder providers without changing their state. A list that is `null` or absent adds every supported plugin disabled, in alphabetical order. A plugin that does not support the library type fails the request with `PluginNotSupportedForLibraryType`. The `shouldSkipHiddenFilesAndDirectoriesDuringScan` setting is optional and defaults to `false` when it is absent.
#### Add Library Response #### Add Library Response
@@ -108,6 +109,7 @@ The `metadataProviders`, `artworkProviders` and `bookReaders` lists configure th
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -147,6 +149,7 @@ GET api/v1/libraries
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -187,6 +190,7 @@ GET api/v1/libraries/enabled
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -226,6 +230,7 @@ GET api/v1/libraries/{id}
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -257,6 +262,7 @@ PUT api/v1/libraries/{id}
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -274,7 +280,7 @@ PUT api/v1/libraries/{id}
Updating a library requires being its owner and holding the `CanCreateLibraries` permission, or being an admin, who can update any library; any other user is answered with `403 NotAuthorized` before the cover image is read. The owner of the library is the user who created it: an update never changes it, so the request carries no owner. Updating a library requires being its owner and holding the `CanCreateLibraries` permission, or being an admin, who can update any library; any other user is answered with `403 NotAuthorized` before the cover image is read. The owner of the library is the user who created it: an update never changes it, so the request carries no owner.
The `metadataProviders`, `artworkProviders` and `bookReaders` lists work as for [Add Library](#add-library). A list that is sent also removes the stored configurations of the plugins that do not support the library type, even when the list does not name them, and keeps the stored state of the supported plugins it leaves out, ordering them after the listed ones. A list that is `null` or absent keeps the stored configurations when the library type is unchanged, and when the type changes, removes the configurations of the plugins that do not support the new type and adds the newly supported plugins disabled. The `metadataProviders`, `artworkProviders` and `bookReaders` lists work as for [Add Library](#add-library). A list that is sent also removes the stored configurations of the plugins that do not support the library type, even when the list does not name them, and keeps the stored state of the supported plugins it leaves out, ordering them after the listed ones. A list that is `null` or absent keeps the stored configurations when the library type is unchanged, and when the type changes, removes the configurations of the plugins that do not support the new type and adds the newly supported plugins disabled. The `shouldSkipHiddenFilesAndDirectoriesDuringScan` setting is optional; when it is absent, the stored value is kept. Changing either `shouldSkipUnchangedDirectoriesDuringScan` or `shouldSkipHiddenFilesAndDirectoriesDuringScan` discards the library's stored directory fingerprints, so the next scan reads the whole library.
#### Update Library Response #### Update Library Response
@@ -297,6 +303,7 @@ The `metadataProviders`, `artworkProviders` and `bookReaders` lists work as for
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -14,6 +14,7 @@ Content-Type: application/json
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -15,6 +15,7 @@ Content-Type: application/json
"canDownloadMetadataFromWeb": true, "canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true, "shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true, "shouldSkipUnchangedDirectoriesDuringScan": true,
"shouldSkipHiddenFilesAndDirectoriesDuringScan": false,
"isContentOnSsd": false, "isContentOnSsd": false,
"shouldTrackConsumptionProgress": true, "shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100, "completionThresholdPercentage": 100,
@@ -80,6 +80,11 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
/// </summary> /// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; } public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; }
/// <summary>
/// Gets whether hidden files and directories are skipped during the scan of the media library.
/// </summary>
public bool ShouldSkipHiddenFilesAndDirectoriesDuringScan { get; init; }
/// <summary> /// <summary>
/// Gets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. /// Gets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.
/// </summary> /// </summary>
@@ -23,6 +23,14 @@ public interface IDirectoryScanFingerprintRepository : IRepository<DirectoryScan
/// <returns>An <see cref="Result{TValue}"/> containing either a path mapped dictionary of directory scan fingerprints, or an error.</returns> /// <returns>An <see cref="Result{TValue}"/> containing either a path mapped dictionary of directory scan fingerprints, or an error.</returns>
Task<Result<Dictionary<string, DirectoryScanFingerprintEntity>>> GetMappedByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); Task<Result<Dictionary<string, DirectoryScanFingerprintEntity>>> GetMappedByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
/// <summary>
/// Deletes all the directory scan fingerprints of the media library identified by <paramref name="libraryId"/>.
/// </summary>
/// <param name="libraryId">The unique identifier of the library whose directory scan fingerprints are deleted.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
Task<Result<Deleted>> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Inserts or updates the provided directory scan fingerprints in the storage medium. /// Inserts or updates the provided directory scan fingerprints in the storage medium.
/// </summary> /// </summary>
@@ -34,6 +34,7 @@ public static class AddMediaLibraryRequestMapping
request.CanDownloadMetadataFromWeb, request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories, request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan, request.ShouldSkipUnchangedDirectoriesDuringScan,
request.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
request.IsContentOnSsd, request.IsContentOnSsd,
request.ShouldTrackConsumptionProgress, request.ShouldTrackConsumptionProgress,
request.CompletionThresholdPercentage, request.CompletionThresholdPercentage,
@@ -36,6 +36,7 @@ public static class LibraryEntityMapping
repositoryEntity.CanDownloadMetadataFromWeb, repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories, repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan, repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
repositoryEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
repositoryEntity.IsContentOnSsd, repositoryEntity.IsContentOnSsd,
repositoryEntity.ShouldTrackConsumptionProgress, repositoryEntity.ShouldTrackConsumptionProgress,
repositoryEntity.CompletionThresholdPercentage, repositoryEntity.CompletionThresholdPercentage,
@@ -74,6 +75,7 @@ public static class LibraryEntityMapping
repositoryEntity.CanDownloadMetadataFromWeb, repositoryEntity.CanDownloadMetadataFromWeb,
repositoryEntity.ShouldSaveMetadataInMediaDirectories, repositoryEntity.ShouldSaveMetadataInMediaDirectories,
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan, repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
repositoryEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
repositoryEntity.IsContentOnSsd, repositoryEntity.IsContentOnSsd,
consumptionSettings, consumptionSettings,
pathTemplateResult.Value, pathTemplateResult.Value,
@@ -38,6 +38,7 @@ public static class LibraryMapping
CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb, CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb,
ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories, ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories,
ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan, ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan,
ShouldSkipHiddenFilesAndDirectoriesDuringScan = domainEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
IsContentOnSsd = domainEntity.IsContentOnSsd, IsContentOnSsd = domainEntity.IsContentOnSsd,
ShouldTrackConsumptionProgress = domainEntity.ConsumptionSettings.ShouldTrackConsumptionProgress, ShouldTrackConsumptionProgress = domainEntity.ConsumptionSettings.ShouldTrackConsumptionProgress,
CompletionThresholdPercentage = domainEntity.ConsumptionSettings.CompletionThresholdPercentage.HasValue CompletionThresholdPercentage = domainEntity.ConsumptionSettings.CompletionThresholdPercentage.HasValue
@@ -35,6 +35,7 @@ public static class UpdateLibraryRequestMapping
request.CanDownloadMetadataFromWeb, request.CanDownloadMetadataFromWeb,
request.ShouldSaveMetadataInMediaDirectories, request.ShouldSaveMetadataInMediaDirectories,
request.ShouldSkipUnchangedDirectoriesDuringScan, request.ShouldSkipUnchangedDirectoriesDuringScan,
request.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
request.IsContentOnSsd, request.IsContentOnSsd,
request.ShouldTrackConsumptionProgress, request.ShouldTrackConsumptionProgress,
request.CompletionThresholdPercentage, request.CompletionThresholdPercentage,
@@ -18,6 +18,7 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param> /// <param name="CanDownloadMetadataFromWeb">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="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> /// <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>
/// <param name="ShouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not. When absent, the default is off.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param> /// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. When absent, the default of the library type is used.</param> /// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. When absent, the default of the library type is used.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the default of the library type is used on creation.</param> /// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the default of the library type is used on creation.</param>
@@ -36,6 +37,7 @@ public record AddLibraryCommand(
bool CanDownloadMetadataFromWeb, bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories, bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan, bool ShouldSkipUnchangedDirectoriesDuringScan,
bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan,
bool IsContentOnSsd, bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress, bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage, int? CompletionThresholdPercentage,
@@ -147,6 +147,7 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
command.CanDownloadMetadataFromWeb, command.CanDownloadMetadataFromWeb,
command.ShouldSaveMetadataInMediaDirectories, command.ShouldSaveMetadataInMediaDirectories,
command.ShouldSkipUnchangedDirectoriesDuringScan, command.ShouldSkipUnchangedDirectoriesDuringScan,
command.ShouldSkipHiddenFilesAndDirectoriesDuringScan ?? false,
command.IsContentOnSsd, command.IsContentOnSsd,
consumptionSettings, consumptionSettings,
pathTemplateResult.Value, pathTemplateResult.Value,
@@ -20,6 +20,7 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param> /// <param name="CanDownloadMetadataFromWeb">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="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> /// <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>
/// <param name="ShouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not. When absent, the stored value is kept.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param> /// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. When absent, the stored value is kept.</param> /// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. When absent, the stored value is kept.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the stored value is kept.</param> /// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the stored value is kept.</param>
@@ -39,6 +40,7 @@ public record UpdateLibraryCommand(
bool CanDownloadMetadataFromWeb, bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories, bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan, bool ShouldSkipUnchangedDirectoriesDuringScan,
bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan,
bool IsContentOnSsd, bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress, bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage, int? CompletionThresholdPercentage,
@@ -114,6 +114,13 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
!await _authorizationService.HasPermissionAsync(userId, AuthorizationPermission.CanCreateLibraries, cancellationToken).ConfigureAwait(false)) !await _authorizationService.HasPermissionAsync(userId, AuthorizationPermission.CanCreateLibraries, cancellationToken).ConfigureAwait(false))
return ApplicationErrors.Authorization.NotAuthorized; return ApplicationErrors.Authorization.NotAuthorized;
bool hasProviderChoices = command.MetadataProviders is not null || command.ArtworkProviders is not null || command.BookReaders is not null; bool hasProviderChoices = command.MetadataProviders is not null || command.ArtworkProviders is not null || command.BookReaders is not null;
// A missing hidden files setting keeps the stored one, so that a partial update never silently turns it off.
bool shouldSkipHiddenFilesAndDirectoriesDuringScan = command.ShouldSkipHiddenFilesAndDirectoriesDuringScan ?? getLibraryResult.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan;
// The directory scan fingerprints are only valid for the scan scope that produced them, so changing either scan scope setting
// discards them, forcing the next scan to read the whole library instead of skipping directories that are no longer in scope.
bool areScanScopeSettingsChanged =
getLibraryResult.Value.ShouldSkipUnchangedDirectoriesDuringScan != command.ShouldSkipUnchangedDirectoriesDuringScan ||
getLibraryResult.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan != shouldSkipHiddenFilesAndDirectoriesDuringScan;
// Make sure the file is an actual supported image, but only when a new cover image was chosen; the stored cover image is // Make sure the file is an actual supported image, but only when a new cover image was chosen; the stored cover image is
// relative to the application base directory and is already validated, so it must not block saving unrelated changes. // relative to the application base directory and is already validated, so it must not block saving unrelated changes.
@@ -173,6 +180,7 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
command.CanDownloadMetadataFromWeb, command.CanDownloadMetadataFromWeb,
command.ShouldSaveMetadataInMediaDirectories, command.ShouldSaveMetadataInMediaDirectories,
command.ShouldSkipUnchangedDirectoriesDuringScan, command.ShouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan,
command.IsContentOnSsd, command.IsContentOnSsd,
consumptionSettings, consumptionSettings,
pathTemplateResult.Value, pathTemplateResult.Value,
@@ -189,6 +197,12 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
Result<Updated> updateLibraryResult = await _unitOfWork.LibraryRepository.UpdateAsync(persistenceLibrary, cancellationToken).ConfigureAwait(false); Result<Updated> updateLibraryResult = await _unitOfWork.LibraryRepository.UpdateAsync(persistenceLibrary, cancellationToken).ConfigureAwait(false);
if (updateLibraryResult.IsFailure) if (updateLibraryResult.IsFailure)
return updateLibraryResult.Errors; return updateLibraryResult.Errors;
if (areScanScopeSettingsChanged)
{
Result<Deleted> deleteDirectoryScanFingerprintsResult = await _unitOfWork.DirectoryScanFingerprintRepository.DeleteByLibraryIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
if (deleteDirectoryScanFingerprintsResult.IsFailure)
return deleteDirectoryScanFingerprintsResult.Errors;
}
bool isLibraryTypeChanged = getLibraryResult.Value.LibraryType != newLibraryType; bool isLibraryTypeChanged = getLibraryResult.Value.LibraryType != newLibraryType;
if (isLibraryTypeChanged || hasProviderChoices) if (isLibraryTypeChanged || hasProviderChoices)
{ {
@@ -16,6 +16,7 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param> /// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</param> /// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</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. Required.</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. Required.</param>
/// <param name="ShouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not. Optional, the default is off when absent.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param> /// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent.</param> /// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent.</param> /// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent.</param>
@@ -34,6 +35,7 @@ public record AddLibraryRequest(
bool CanDownloadMetadataFromWeb, bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories, bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan, bool ShouldSkipUnchangedDirectoriesDuringScan,
bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan,
bool IsContentOnSsd, bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress, bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage, int? CompletionThresholdPercentage,
@@ -18,6 +18,7 @@ namespace Lumina.Contracts.Requests.MediaLibrary.Management;
/// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param> /// <param name="CanDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not. Required.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</param> /// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Required.</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. Required.</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. Required.</param>
/// <param name="ShouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not. Optional, the stored value is kept when absent.</param>
/// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param> /// <param name="IsContentOnSsd">Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Required.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent.</param> /// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent.</param> /// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent.</param>
@@ -37,6 +38,7 @@ public record class UpdateLibraryRequest(
bool CanDownloadMetadataFromWeb, bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories, bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan, bool ShouldSkipUnchangedDirectoriesDuringScan,
bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan,
bool IsContentOnSsd, bool IsContentOnSsd,
bool? ShouldTrackConsumptionProgress, bool? ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage, int? CompletionThresholdPercentage,
@@ -21,6 +21,7 @@ namespace Lumina.Contracts.Responses.MediaLibrary.Management;
/// <param name="CanDownloadMetadataFromWeb">Whether the media library should update the metadata of its elements from the web, or not.</param> /// <param name="CanDownloadMetadataFromWeb">Whether the media library should update the metadata of its elements from the web, or not.</param>
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether the media library should copy the downloaded metadata into the media library content locations, or not.</param> /// <param name="ShouldSaveMetadataInMediaDirectories">Whether the media library should copy the downloaded metadata into the media library content locations, or not.</param>
/// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether the media library should skip the directories whose contents have not changed since the last scan, during the scan.</param> /// <param name="ShouldSkipUnchangedDirectoriesDuringScan">Whether the media library should skip the directories whose contents have not changed since the last scan, during the scan.</param>
/// <param name="ShouldSkipHiddenFilesAndDirectoriesDuringScan">Whether the media library should skip hidden files and directories during the scan.</param>
/// <param name="IsContentOnSsd">Whether the content of the media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param> /// <param name="IsContentOnSsd">Whether the content of the media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.</param>
/// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items is tracked.</param> /// <param name="ShouldTrackConsumptionProgress">Whether the consumption progress of the media library items is tracked.</param>
/// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.</param> /// <param name="CompletionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.</param>
@@ -40,6 +41,7 @@ public record LibraryResponse(
bool CanDownloadMetadataFromWeb, bool CanDownloadMetadataFromWeb,
bool ShouldSaveMetadataInMediaDirectories, bool ShouldSaveMetadataInMediaDirectories,
bool ShouldSkipUnchangedDirectoriesDuringScan, bool ShouldSkipUnchangedDirectoriesDuringScan,
bool ShouldSkipHiddenFilesAndDirectoriesDuringScan,
bool IsContentOnSsd, bool IsContentOnSsd,
bool ShouldTrackConsumptionProgress, bool ShouldTrackConsumptionProgress,
int? CompletionThresholdPercentage, int? CompletionThresholdPercentage,
@@ -83,6 +83,10 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
.HasDefaultValue(false) .HasDefaultValue(false)
.HasColumnOrder(18); .HasColumnOrder(18);
builder.Property(library => library.ShouldSkipHiddenFilesAndDirectoriesDuringScan)
.HasDefaultValue(false)
.HasColumnOrder(19);
// One user with many libraries. // One user with many libraries.
builder.HasOne(library => library.User) builder.HasOne(library => library.User)
.WithMany(user => user.Libraries) .WithMany(user => user.Libraries)
@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lumina.DataAccess.Common.Migrations
{
/// <inheritdoc />
public partial class AddsShouldSkipHiddenFilesAndDirectoriesDuringScan : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "ShouldSkipHiddenFilesAndDirectoriesDuringScan",
table: "Libraries",
type: "INTEGER",
nullable: false,
defaultValue: false)
.Annotation("Relational:ColumnOrder", 19);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ShouldSkipHiddenFilesAndDirectoriesDuringScan",
table: "Libraries");
}
}
}
@@ -1596,6 +1596,12 @@ namespace Lumina.DataAccess.Common.Migrations
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasColumnOrder(7); .HasColumnOrder(7);
b.Property<bool>("ShouldSkipHiddenFilesAndDirectoriesDuringScan")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnOrder(19);
b.Property<bool>("ShouldSkipUnchangedDirectoriesDuringScan") b.Property<bool>("ShouldSkipUnchangedDirectoriesDuringScan")
.HasColumnType("INTEGER") .HasColumnType("INTEGER")
.HasColumnOrder(8); .HasColumnOrder(8);
@@ -55,6 +55,20 @@ internal sealed class DirectoryScanFingerprintRepository : IDirectoryScanFingerp
return fingerprints.ToDictionary(fingerprint => fingerprint.Path, StringComparer.Ordinal); return fingerprints.ToDictionary(fingerprint => fingerprint.Path, StringComparer.Ordinal);
} }
/// <summary>
/// Deletes all the directory scan fingerprints of the media library identified by <paramref name="libraryId"/>.
/// </summary>
/// <param name="libraryId">The unique identifier of the library whose directory scan fingerprints are deleted.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
public async Task<Result<Deleted>> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken)
{
await _luminaDbContext.DirectoryScanFingerprints
.Where(fingerprint => fingerprint.LibraryId == libraryId)
.ExecuteDeleteAsync(cancellationToken).ConfigureAwait(false);
return Result.Deleted;
}
/// <summary> /// <summary>
/// Inserts or updates the provided directory scan fingerprints in the storage medium. /// Inserts or updates the provided directory scan fingerprints in the storage medium.
/// </summary> /// </summary>
@@ -76,6 +76,11 @@ public class Library : AggregateRoot<LibraryId>
/// </summary> /// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; private set; } public bool ShouldSkipUnchangedDirectoriesDuringScan { get; private set; }
/// <summary>
/// Gets whether this media library should skip hidden files and directories during the scan, or not.
/// </summary>
public bool ShouldSkipHiddenFilesAndDirectoriesDuringScan { get; private set; }
/// <summary> /// <summary>
/// Gets whether the content of this media library is stored on a solid state drive. When it is, the file discovery and content hashing stages read the files in parallel, /// Gets whether the content of this media library is stored on a solid state drive. When it is, the file discovery and content hashing stages read the files in parallel,
/// which takes advantage of the low latency of solid state drives. Mechanical hard drives keep those reads sequential, because parallel reads can reduce their throughput. /// which takes advantage of the low latency of solid state drives. Mechanical hard drives keep those reads sequential, because parallel reads can reduce their throughput.
@@ -117,6 +122,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param> /// <param name="canDownloadMetadataFromWeb">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="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> /// <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>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param> /// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param> /// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
@@ -133,6 +139,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb, bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories, bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan, bool shouldSkipUnchangedDirectoriesDuringScan,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan,
bool isContentOnSsd, bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings, LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate, LibraryPathTemplate pathTemplate,
@@ -148,6 +155,7 @@ public class Library : AggregateRoot<LibraryId>
CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb; CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb;
ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories; ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories;
ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan; ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan;
ShouldSkipHiddenFilesAndDirectoriesDuringScan = shouldSkipHiddenFilesAndDirectoriesDuringScan;
IsContentOnSsd = isContentOnSsd; IsContentOnSsd = isContentOnSsd;
ConsumptionSettings = consumptionSettings; ConsumptionSettings = consumptionSettings;
PathTemplate = pathTemplate; PathTemplate = pathTemplate;
@@ -167,6 +175,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param> /// <param name="canDownloadMetadataFromWeb">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="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> /// <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>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param> /// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param> /// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
@@ -185,6 +194,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb, bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories, bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan, bool shouldSkipUnchangedDirectoriesDuringScan,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan,
bool isContentOnSsd, bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings, LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate, LibraryPathTemplate pathTemplate,
@@ -211,6 +221,7 @@ public class Library : AggregateRoot<LibraryId>
canDownloadMetadataFromWeb, canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan,
isContentOnSsd, isContentOnSsd,
consumptionSettings, consumptionSettings,
pathTemplate, pathTemplate,
@@ -232,6 +243,7 @@ public class Library : AggregateRoot<LibraryId>
/// <param name="canDownloadMetadataFromWeb">Whether this media library should update the metadata of its elements from the web, or not.</param> /// <param name="canDownloadMetadataFromWeb">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="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> /// <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>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether this media library should skip hidden files and directories during the scan, or not.</param>
/// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of this media library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">The consumption settings of the media library.</param> /// <param name="consumptionSettings">The consumption settings of the media library.</param>
/// <param name="pathTemplate">The template describing the structure of the media library on disk.</param> /// <param name="pathTemplate">The template describing the structure of the media library on disk.</param>
@@ -251,6 +263,7 @@ public class Library : AggregateRoot<LibraryId>
bool canDownloadMetadataFromWeb, bool canDownloadMetadataFromWeb,
bool shouldSaveMetadataInMediaDirectories, bool shouldSaveMetadataInMediaDirectories,
bool shouldSkipUnchangedDirectoriesDuringScan, bool shouldSkipUnchangedDirectoriesDuringScan,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan,
bool isContentOnSsd, bool isContentOnSsd,
LibraryConsumptionSettings consumptionSettings, LibraryConsumptionSettings consumptionSettings,
LibraryPathTemplate pathTemplate, LibraryPathTemplate pathTemplate,
@@ -277,6 +290,7 @@ public class Library : AggregateRoot<LibraryId>
canDownloadMetadataFromWeb, canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan,
isContentOnSsd, isContentOnSsd,
consumptionSettings, consumptionSettings,
pathTemplate, pathTemplate,
@@ -133,6 +133,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
contentLocation.Path, contentLocation.Path,
fileProviderService, fileProviderService,
directoryProviderService, directoryProviderService,
domainLibraryResult.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
fingerprintsByPath is not null, fingerprintsByPath is not null,
shouldParallelizeReads, shouldParallelizeReads,
fingerprintsByPath, fingerprintsByPath,
@@ -196,6 +197,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
/// <param name="rootDirectoryPath">The path of the root directory from which to start collecting files.</param> /// <param name="rootDirectoryPath">The path of the root directory from which to start collecting files.</param>
/// <param name="fileProviderService">The service used to enumerate the files of a directory.</param> /// <param name="fileProviderService">The service used to enumerate the files of a directory.</param>
/// <param name="directoryProviderService">The service used to enumerate the subdirectories of a directory.</param> /// <param name="directoryProviderService">The service used to enumerate the subdirectories of a directory.</param>
/// <param name="shouldSkipHiddenFilesAndDirectories">Whether to skip hidden files and directories, or not.</param>
/// <param name="shouldSkipUnchangedDirectories">Whether to skip the directories whose last write time has not changed since the last scan, or not.</param> /// <param name="shouldSkipUnchangedDirectories">Whether to skip the directories whose last write time has not changed since the last scan, or not.</param>
/// <param name="shouldParallelizeReads">Whether the file system reads should run in parallel, which benefits solid state drives.</param> /// <param name="shouldParallelizeReads">Whether the file system reads should run in parallel, which benefits solid state drives.</param>
/// <param name="fingerprintsByPath">The directory scan fingerprints of the library, mapped by the directory path. Can be <see langword="null"/> when the fast skip is disabled.</param> /// <param name="fingerprintsByPath">The directory scan fingerprints of the library, mapped by the directory path. Can be <see langword="null"/> when the fast skip is disabled.</param>
@@ -212,6 +214,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
string rootDirectoryPath, string rootDirectoryPath,
IFileProviderService fileProviderService, IFileProviderService fileProviderService,
IDirectoryProviderService directoryProviderService, IDirectoryProviderService directoryProviderService,
bool shouldSkipHiddenFilesAndDirectories,
bool shouldSkipUnchangedDirectories, bool shouldSkipUnchangedDirectories,
bool shouldParallelizeReads, bool shouldParallelizeReads,
Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath, Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath,
@@ -265,7 +268,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
} }
// Process the files of the current directory. // Process the files of the current directory.
Result<IEnumerable<FileSystemPathId>> getFilesResult = fileProviderService.GetFilePaths(currentDirectory, true); Result<IEnumerable<FileSystemPathId>> getFilesResult = fileProviderService.GetFilePaths(currentDirectory, !shouldSkipHiddenFilesAndDirectories);
if (getFilesResult.IsSuccess) if (getFilesResult.IsSuccess)
{ {
if (shouldParallelizeReads) if (shouldParallelizeReads)
@@ -291,7 +294,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
} }
// Process the subdirectories - each new subdirectory is added to the same queue, for later processing. // Process the subdirectories - each new subdirectory is added to the same queue, for later processing.
Result<IEnumerable<FileSystemPathId>> getSubdirectoriesResult = directoryProviderService.GetSubdirectoryPaths(currentDirectory, true); Result<IEnumerable<FileSystemPathId>> getSubdirectoriesResult = directoryProviderService.GetSubdirectoryPaths(currentDirectory, !shouldSkipHiddenFilesAndDirectories);
if (getSubdirectoriesResult.IsSuccess) if (getSubdirectoriesResult.IsSuccess)
{ {
foreach (FileSystemPathId subdirectory in getSubdirectoriesResult.Value) foreach (FileSystemPathId subdirectory in getSubdirectoriesResult.Value)
@@ -41,12 +41,18 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
], ],
StringComparer.OrdinalIgnoreCase StringComparer.OrdinalIgnoreCase
); );
private static readonly EnumerationOptions s_enumerationOptions = new() private static readonly EnumerationOptions s_includingHiddenEnumerationOptions = new()
{ {
AttributesToSkip = FileAttributes.None, // Hidden files and directories are included in the discovery. AttributesToSkip = FileAttributes.None, // Hidden files and directories are included in the discovery.
IgnoreInaccessible = true, IgnoreInaccessible = true,
RecurseSubdirectories = false RecurseSubdirectories = false
}; };
private static readonly EnumerationOptions s_skippingHiddenEnumerationOptions = new()
{
AttributesToSkip = FileAttributes.Hidden,
IgnoreInaccessible = true,
RecurseSubdirectories = false
};
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
private readonly ILogger<BooksFileSystemDiscoveryJob> _logger; private readonly ILogger<BooksFileSystemDiscoveryJob> _logger;
@@ -134,6 +140,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
await DiscoverContentLocationAsync( await DiscoverContentLocationAsync(
contentLocation.Path, contentLocation.Path,
domainLibraryResult.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan,
fingerprintsByPath is not null, fingerprintsByPath is not null,
shouldParallelizeReads, shouldParallelizeReads,
fingerprintsByPath, fingerprintsByPath,
@@ -195,6 +202,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
/// Discovers the book files of a content location of the media library, using a breadth-first traversal, and writes them in batches to the staging results. /// Discovers the book files of a content location of the media library, using a breadth-first traversal, and writes them in batches to the staging results.
/// </summary> /// </summary>
/// <param name="rootDirectoryPath">The path of the root directory from which to start collecting files.</param> /// <param name="rootDirectoryPath">The path of the root directory from which to start collecting files.</param>
/// <param name="shouldSkipHiddenFilesAndDirectories">Whether to skip hidden files and directories, or not.</param>
/// <param name="shouldSkipUnchangedDirectories">Whether to skip the directories whose last write time has not changed since the last scan, or not.</param> /// <param name="shouldSkipUnchangedDirectories">Whether to skip the directories whose last write time has not changed since the last scan, or not.</param>
/// <param name="shouldParallelizeReads">Whether the file system reads should run in parallel, which benefits solid state drives.</param> /// <param name="shouldParallelizeReads">Whether the file system reads should run in parallel, which benefits solid state drives.</param>
/// <param name="fingerprintsByPath">The directory scan fingerprints of the library, mapped by the directory path. Can be <see langword="null"/> when the fast skip is disabled.</param> /// <param name="fingerprintsByPath">The directory scan fingerprints of the library, mapped by the directory path. Can be <see langword="null"/> when the fast skip is disabled.</param>
@@ -209,6 +217,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
[MethodImpl(MethodImplOptions.AggressiveOptimization)] [MethodImpl(MethodImplOptions.AggressiveOptimization)]
private async Task DiscoverContentLocationAsync( private async Task DiscoverContentLocationAsync(
string rootDirectoryPath, string rootDirectoryPath,
bool shouldSkipHiddenFilesAndDirectories,
bool shouldSkipUnchangedDirectories, bool shouldSkipUnchangedDirectories,
bool shouldParallelizeReads, bool shouldParallelizeReads,
Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath, Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath,
@@ -218,6 +227,9 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
IDirectoryScanFingerprintRepository directoryScanFingerprintRepository, IDirectoryScanFingerprintRepository directoryScanFingerprintRepository,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
EnumerationOptions enumerationOptions = shouldSkipHiddenFilesAndDirectories
? s_skippingHiddenEnumerationOptions
: s_includingHiddenEnumerationOptions;
Queue<DirectoryInfo> directoryQueue = new(); Queue<DirectoryInfo> directoryQueue = new();
directoryQueue.Enqueue(new DirectoryInfo(rootDirectoryPath)); directoryQueue.Enqueue(new DirectoryInfo(rootDirectoryPath));
@@ -257,7 +269,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
IEnumerable<FileInfo>? files = null; IEnumerable<FileInfo>? files = null;
try try
{ {
files = currentDirectory.EnumerateFiles("*", s_enumerationOptions) files = currentDirectory.EnumerateFiles("*", enumerationOptions)
.Where(file => s_bookExtensions.Contains(file.Extension)); .Where(file => s_bookExtensions.Contains(file.Extension));
} }
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
@@ -300,7 +312,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
IEnumerable<DirectoryInfo>? subdirectories = null; IEnumerable<DirectoryInfo>? subdirectories = null;
try try
{ {
subdirectories = currentDirectory.EnumerateDirectories("*", s_enumerationOptions); subdirectories = currentDirectory.EnumerateDirectories("*", enumerationOptions);
} }
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
{ {
@@ -37,6 +37,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -55,6 +56,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not. Optional."); RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not. Optional.");
RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional."); RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional.");
RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional."); RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.");
RequestParam(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not. Optional, the default is off when absent.");
RequestParam(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional."); RequestParam(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional.");
RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent."); RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used when absent.");
RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent."); RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used when absent.");
@@ -74,6 +76,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not."); ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel."); ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.");
ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked."); ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked.");
ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled."); ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.");
@@ -94,6 +97,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -33,6 +33,7 @@ public class GetEnabledLibrariesEndpointSummary : Summary<GetEnabledLibrariesEnd
ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not."); ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel."); ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.");
ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked."); ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked.");
ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled."); ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.");
@@ -54,6 +55,7 @@ public class GetEnabledLibrariesEndpointSummary : Summary<GetEnabledLibrariesEnd
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -73,6 +75,7 @@ public class GetEnabledLibrariesEndpointSummary : Summary<GetEnabledLibrariesEnd
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: true, ShouldSaveMetadataInMediaDirectories: true,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -33,6 +33,7 @@ public class GetLibrariesEndpointSummary : Summary<GetLibrariesEndpoint, EmptyRe
ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not."); ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel."); ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.");
ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked."); ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked.");
ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled."); ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.");
@@ -54,6 +55,7 @@ public class GetLibrariesEndpointSummary : Summary<GetLibrariesEndpoint, EmptyRe
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -73,6 +75,7 @@ public class GetLibrariesEndpointSummary : Summary<GetLibrariesEndpoint, EmptyRe
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: true, ShouldSaveMetadataInMediaDirectories: true,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -41,6 +41,7 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not."); ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel."); ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.");
ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked."); ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked.");
ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled."); ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.");
@@ -60,6 +61,7 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -38,6 +38,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -57,6 +58,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not. Optional."); RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not. Optional.");
RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional."); RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional.");
RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional."); RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. Optional.");
RequestParam(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not. Optional, the stored value is kept when absent.");
RequestParam(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional."); RequestParam(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional.");
RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent."); RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the stored value is kept when absent.");
RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent."); RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the stored value is kept when absent.");
@@ -76,6 +78,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not."); ResponseParam<LibraryResponse>(r => r.CanDownloadMetadataFromWeb, "Whether this media library should update the metadata of its elements from the web, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSaveMetadataInMediaDirectories, "Whether this media library should copy the downloaded metadata into the media library content locations, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not."); ResponseParam<LibraryResponse>(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether this media library should skip hidden files and directories during the scan, or not.");
ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel."); ResponseParam<LibraryResponse>(r => r.IsContentOnSsd, "Whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.");
ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked."); ResponseParam<LibraryResponse>(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items is tracked.");
ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled."); ResponseParam<LibraryResponse>(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed, when progress tracking is enabled.");
@@ -96,6 +99,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
CanDownloadMetadataFromWeb: true, CanDownloadMetadataFromWeb: true,
ShouldSaveMetadataInMediaDirectories: false, ShouldSaveMetadataInMediaDirectories: false,
ShouldSkipUnchangedDirectoriesDuringScan: false, ShouldSkipUnchangedDirectoriesDuringScan: false,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: false,
IsContentOnSsd: false, IsContentOnSsd: false,
ShouldTrackConsumptionProgress: true, ShouldTrackConsumptionProgress: true,
CompletionThresholdPercentage: 90, CompletionThresholdPercentage: 90,
@@ -63,6 +63,11 @@ public class LibraryDto
/// </summary> /// </summary>
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; set; } = false; public bool ShouldSkipUnchangedDirectoriesDuringScan { get; set; } = false;
/// <summary>
/// Gets or sets whether this media library should skip hidden files and directories during the scan, or not. When absent, the default is off on create, and the stored value is kept on update.
/// </summary>
public bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan { get; set; }
/// <summary> /// <summary>
/// Gets or sets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. /// Gets or sets whether the content of this media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel.
/// </summary> /// </summary>
@@ -30,6 +30,7 @@ public class SaveLibraryEndpointSummary : Summary<SaveLibraryEndpoint, LibraryDt
RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether the metadata of the media library items should be downloaded from the web, or not. Optional."); RequestParam(r => r.CanDownloadMetadataFromWeb, "Whether the metadata of the media library items should be downloaded from the web, or not. Optional.");
RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether the downloaded metadata should be copied into the media library content locations, or not. Optional."); RequestParam(r => r.ShouldSaveMetadataInMediaDirectories, "Whether the downloaded metadata should be copied into the media library content locations, or not. Optional.");
RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether the directories whose contents have not changed since the last scan should be skipped during the scan, or not. Optional."); RequestParam(r => r.ShouldSkipUnchangedDirectoriesDuringScan, "Whether the directories whose contents have not changed since the last scan should be skipped during the scan, or not. Optional.");
RequestParam(r => r.ShouldSkipHiddenFilesAndDirectoriesDuringScan, "Whether hidden files and directories should be skipped during the scan, or not. Optional, the stored value is kept when absent.");
RequestParam(r => r.IsContentOnSsd, "Whether the content of the media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional."); RequestParam(r => r.IsContentOnSsd, "Whether the content of the media library is stored on a solid state drive, in which case the file discovery and content hashing stages read the files in parallel. Optional.");
RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used on create, and the stored value is kept on update."); RequestParam(r => r.ShouldTrackConsumptionProgress, "Whether the consumption progress of the media library items should be tracked, or not. Optional, the default of the library type is used on create, and the stored value is kept on update.");
RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used on create, and the stored value is kept on update."); RequestParam(r => r.CompletionThresholdPercentage, "The percentage of a media library item that must be consumed for its session to be considered completed. Optional, the default of the library type is used on create, and the stored value is kept on update.");
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>ما إذا كان يجب حفظ نسخة من البيانات الوصفية التي تم تنزيلها في المجلدات التي تحتوي على محتوى مكتبة الوسائط أم لا. هذا يؤثر فقط إذا كان تنزيل البيانات الوصفية من الويب مفعّلًا.</value> <value>ما إذا كان يجب حفظ نسخة من البيانات الوصفية التي تم تنزيلها في المجلدات التي تحتوي على محتوى مكتبة الوسائط أم لا. هذا يؤثر فقط إذا كان تنزيل البيانات الوصفية من الويب مفعّلًا.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>عند التمكين، يتم استبعاد الملفات والمجلدات المخفية من عمليات فحص مكتبة الوسائط هذه.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>عند التفعيل، يستخدم هذا الخيار البيانات الوصفية للمجلدات لتخطي المجلدات التي لم تتغير منذ آخر فحص. يمكن أن يؤدي ذلك إلى تسريع عمليات الفحص _بشكل ملحوظ_، لكن انتبه إلى أن البيانات الوصفية للمجلدات _لا تتغير ولا تُحدَّث_ عند تعديل الملفات الموجودة، بل تتغير فقط عند إضافة ملفات جديدة أو حذف ملفات موجودة. فعّل هذا الخيار فقط إذا كنت لا تعدّل الملفات الموجودة.</value> <value>عند التفعيل، يستخدم هذا الخيار البيانات الوصفية للمجلدات لتخطي المجلدات التي لم تتغير منذ آخر فحص. يمكن أن يؤدي ذلك إلى تسريع عمليات الفحص _بشكل ملحوظ_، لكن انتبه إلى أن البيانات الوصفية للمجلدات _لا تتغير ولا تُحدَّث_ عند تعديل الملفات الموجودة، بل تتغير فقط عند إضافة ملفات جديدة أو حذف ملفات موجودة. فعّل هذا الخيار فقط إذا كنت لا تعدّل الملفات الموجودة.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>حفظ البيانات الوصفية في مجلدات الوسائط</value> <value>حفظ البيانات الوصفية في مجلدات الوسائط</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>تخطي الملفات والمجلدات المخفية أثناء الفحص</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>تخطي المجلدات غير المتغيرة أثناء الفحص</value> <value>تخطي المجلدات غير المتغيرة أثناء الفحص</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Ob eine Kopie der heruntergeladenen Metadaten in den Verzeichnissen der Medienbibliothek gespeichert werden soll oder nicht. Dies hat nur eine Auswirkung, wenn das Herunterladen von Metadaten aus dem Web aktiv ist.</value> <value>Ob eine Kopie der heruntergeladenen Metadaten in den Verzeichnissen der Medienbibliothek gespeichert werden soll oder nicht. Dies hat nur eine Auswirkung, wenn das Herunterladen von Metadaten aus dem Web aktiv ist.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Wenn diese Option aktiviert ist, werden versteckte Dateien und Ordner bei den Scans dieser Medienbibliothek ausgelassen.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Wenn diese Option aktiviert ist, verwendet sie Verzeichnismetadaten, um Verzeichnisse zu überspringen, die sich seit dem letzten Scan nicht geändert haben. Dies kann die Scans _erheblich_ beschleunigen, aber beachten Sie, dass sich die Metadaten von Verzeichnissen _nicht_ ändern/aktualisieren, wenn vorhandene Dateien bearbeitet werden, sondern nur, wenn neue Dateien hinzugefügt oder vorhandene gelöscht werden. Aktivieren Sie diese Option nur, wenn Sie keine vorhandenen Dateien ändern.</value> <value>Wenn diese Option aktiviert ist, verwendet sie Verzeichnismetadaten, um Verzeichnisse zu überspringen, die sich seit dem letzten Scan nicht geändert haben. Dies kann die Scans _erheblich_ beschleunigen, aber beachten Sie, dass sich die Metadaten von Verzeichnissen _nicht_ ändern/aktualisieren, wenn vorhandene Dateien bearbeitet werden, sondern nur, wenn neue Dateien hinzugefügt oder vorhandene gelöscht werden. Aktivieren Sie diese Option nur, wenn Sie keine vorhandenen Dateien ändern.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Metadaten In Medienverzeichnissen Speichern</value> <value>Metadaten In Medienverzeichnissen Speichern</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Versteckte Dateien und Ordner Beim Scannen Überspringen</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Unveränderte Ordner Beim Scannen Überspringen</value> <value>Unveränderte Ordner Beim Scannen Überspringen</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Whether to save a copy of the downloaded metadata in the media library content locations directories, or not. This only has an effect if downloading metadata from the web is active.</value> <value>Whether to save a copy of the downloaded metadata in the media library content locations directories, or not. This only has an effect if downloading metadata from the web is active.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>When enabled, hidden files and directories are left out of the scans of this media library.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>When enabled, this option uses directory metadata to skip directories that have not changed since the last scan. This can _significantly_ speed up scans, but be aware that directories metadata _does not_ change/update when editing existing files, it does so only when adding new files or deleting existing ones. Only enable this if you don't modify existing files.</value> <value>When enabled, this option uses directory metadata to skip directories that have not changed since the last scan. This can _significantly_ speed up scans, but be aware that directories metadata _does not_ change/update when editing existing files, it does so only when adding new files or deleting existing ones. Only enable this if you don't modify existing files.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Save Metadata In Media Directories</value> <value>Save Metadata In Media Directories</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Skip Hidden Files and Directories During Scan</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Skip Unchanged Directories During Scan</value> <value>Skip Unchanged Directories During Scan</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Si guardar o no una copia de los metadatos descargados en los directorios de contenido de la biblioteca multimedia. Esto solo tiene efecto si la descarga de metadatos desde la web está activa.</value> <value>Si guardar o no una copia de los metadatos descargados en los directorios de contenido de la biblioteca multimedia. Esto solo tiene efecto si la descarga de metadatos desde la web está activa.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Cuando está habilitada, los archivos y carpetas ocultos se excluyen de los análisis de esta biblioteca multimedia.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Cuando esta opción está habilitada, utiliza los metadatos de los directorios para omitir los directorios que no han cambiado desde el último escaneo. Esto puede acelerar _significativamente_ los escaneos, pero tenga en cuenta que los metadatos de los directorios _no_ cambian/actualizan al editar archivos existentes, solo lo hacen al agregar archivos nuevos o eliminar archivos existentes. Habilite esta opción solo si no modifica archivos existentes.</value> <value>Cuando esta opción está habilitada, utiliza los metadatos de los directorios para omitir los directorios que no han cambiado desde el último escaneo. Esto puede acelerar _significativamente_ los escaneos, pero tenga en cuenta que los metadatos de los directorios _no_ cambian/actualizan al editar archivos existentes, solo lo hacen al agregar archivos nuevos o eliminar archivos existentes. Habilite esta opción solo si no modifica archivos existentes.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Guardar Metadatos En Los Directorios Multimedia</value> <value>Guardar Metadatos En Los Directorios Multimedia</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Omitir Archivos y Carpetas Ocultos Durante el Análisis</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Omitir Carpetas Sin Cambios Durante El Escaneo</value> <value>Omitir Carpetas Sin Cambios Durante El Escaneo</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Si une copie des métadonnées téléchargées doit être sauvegardée dans les répertoires de contenu de la médiathèque ou non. Ceci n'a d'effet que si le téléchargement des métadonnées depuis le web est actif.</value> <value>Si une copie des métadonnées téléchargées doit être sauvegardée dans les répertoires de contenu de la médiathèque ou non. Ceci n'a d'effet que si le téléchargement des métadonnées depuis le web est actif.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Lorsque cette option est activée, les fichiers et dossiers cachés sont exclus des analyses de cette bibliothèque multimédia.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Lorsque cette option est activée, elle utilise les métadonnées des dossiers pour ignorer les dossiers qui n'ont pas changé depuis la dernière analyse. Cela peut accélérer _considérablement_ les analyses, mais sachez que les métadonnées des dossiers _ne_ changent/mettent _pas_ à jour lors de la modification de fichiers existants, seulement lors de l'ajout de nouveaux fichiers ou de la suppression de fichiers existants. N'activez cette option que si vous ne modifiez pas les fichiers existants.</value> <value>Lorsque cette option est activée, elle utilise les métadonnées des dossiers pour ignorer les dossiers qui n'ont pas changé depuis la dernière analyse. Cela peut accélérer _considérablement_ les analyses, mais sachez que les métadonnées des dossiers _ne_ changent/mettent _pas_ à jour lors de la modification de fichiers existants, seulement lors de l'ajout de nouveaux fichiers ou de la suppression de fichiers existants. N'activez cette option que si vous ne modifiez pas les fichiers existants.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Sauvegarder Les Métadonnées Dans Les Répertoires Média</value> <value>Sauvegarder Les Métadonnées Dans Les Répertoires Média</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Ignorer Les Fichiers Et Dossiers Cachés Lors De L'Analyse</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Ignorer Les Dossiers Inchangés Lors De L'Analyse</value> <value>Ignorer Les Dossiers Inchangés Lors De L'Analyse</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Se salvare o meno una copia dei metadati scaricati nelle directory dei contenuti della libreria multimediale. Questo ha effetto solo se il download dei metadati dal web è attivo.</value> <value>Se salvare o meno una copia dei metadati scaricati nelle directory dei contenuti della libreria multimediale. Questo ha effetto solo se il download dei metadati dal web è attivo.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Quando è abilitata, i file e le cartelle nascosti vengono esclusi dalle scansioni di questa libreria multimediale.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Quando questa opzione è abilitata, utilizza i metadati delle cartelle per saltare le cartelle che non sono cambiate dall'ultima scansione. Questo può accelerare _significativamente_ le scansioni, ma tieni presente che i metadati delle cartelle _non_ cambiano/aggiornano quando si modificano file esistenti, lo fanno solo quando si aggiungono nuovi file o si eliminano file esistenti. Abilita questa opzione solo se non modifichi i file esistenti.</value> <value>Quando questa opzione è abilitata, utilizza i metadati delle cartelle per saltare le cartelle che non sono cambiate dall'ultima scansione. Questo può accelerare _significativamente_ le scansioni, ma tieni presente che i metadati delle cartelle _non_ cambiano/aggiornano quando si modificano file esistenti, lo fanno solo quando si aggiungono nuovi file o si eliminano file esistenti. Abilita questa opzione solo se non modifichi i file esistenti.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Salvare I Metadati Nelle Directory Multimediali</value> <value>Salvare I Metadati Nelle Directory Multimediali</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Ignora File e Cartelle Nascosti Durante la Scansione</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Salta Cartelle Invariate Durante La Scansione</value> <value>Salta Cartelle Invariate Durante La Scansione</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>ダウンロードしたメタデータのコピーをメディアライブラリのコンテンツディレクトリに保存するかどうか。これはウェブからのメタデータのダウンロードが有効な場合のみ効果があります。</value> <value>ダウンロードしたメタデータのコピーをメディアライブラリのコンテンツディレクトリに保存するかどうか。これはウェブからのメタデータのダウンロードが有効な場合のみ効果があります。</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>有効にすると、このメディアライブラリのスキャンから隠しファイルと隠しフォルダーが除外されます。</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>このオプションを有効にすると、ディレクトリのメタデータを使用して、前回のスキャン以降に変更されていないディレクトリをスキップします。これによりスキャンを_大幅に_高速化できますが、既存のファイルを編集してもディレクトリのメタデータは_変更/更新されない_ことに注意してください。変更されるのは、新しいファイルを追加したときや既存のファイルを削除したときだけです。既存のファイルを変更しない場合にのみ有効にしてください。</value> <value>このオプションを有効にすると、ディレクトリのメタデータを使用して、前回のスキャン以降に変更されていないディレクトリをスキップします。これによりスキャンを_大幅に_高速化できますが、既存のファイルを編集してもディレクトリのメタデータは_変更/更新されない_ことに注意してください。変更されるのは、新しいファイルを追加したときや既存のファイルを削除したときだけです。既存のファイルを変更しない場合にのみ有効にしてください。</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>メディアディレクトリにメタデータを保存</value> <value>メディアディレクトリにメタデータを保存</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>スキャン中に隠しファイルと隠しフォルダーをスキップする</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>スキャン中に変更のないフォルダをスキップ</value> <value>スキャン中に変更のないフォルダをスキップ</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Whether to save a copy of the downloaded metadata in the media library content locations directories, or not. This only has an effect if downloading metadata from the web is active.</value> <value>Whether to save a copy of the downloaded metadata in the media library content locations directories, or not. This only has an effect if downloading metadata from the web is active.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>When enabled, hidden files and directories are left out of the scans of this media library.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>When enabled, this option uses directory metadata to skip directories that have not changed since the last scan. This can _significantly_ speed up scans, but be aware that directories metadata _does not_ change/update when editing existing files, it does so only when adding new files or deleting existing ones. Only enable this if you don't modify existing files.</value> <value>When enabled, this option uses directory metadata to skip directories that have not changed since the last scan. This can _significantly_ speed up scans, but be aware that directories metadata _does not_ change/update when editing existing files, it does so only when adding new files or deleting existing ones. Only enable this if you don't modify existing files.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Save Metadata In Media Directories</value> <value>Save Metadata In Media Directories</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Skip Hidden Files and Directories During Scan</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Skip Unchanged Directories During Scan</value> <value>Skip Unchanged Directories During Scan</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Dacă se salvează sau nu o copie a metadatelor descărcate în directoarele cu conținut ale bibliotecii media. Acest lucru are efect doar dacă descărcarea metadatelor de pe web este activă.</value> <value>Dacă se salvează sau nu o copie a metadatelor descărcate în directoarele cu conținut ale bibliotecii media. Acest lucru are efect doar dacă descărcarea metadatelor de pe web este activă.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Când este activată, fișierele și dosarele ascunse sunt excluse din scanările acestei biblioteci media.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Când această opțiune este activată, folosește metadatele directorului pentru a sări peste directoarele care nu s-au schimbat de la ultima scanare. Acest lucru poate accelera _semnificativ_ scanările, dar rețineți că metadatele directoarelor _nu_ se schimbă/actualizează atunci când editați fișiere existente, se schimbă doar atunci când adăugați fișiere noi sau ștergeți fișiere existente. Activați această opțiune numai dacă nu modificați fișierele existente.</value> <value>Când această opțiune este activată, folosește metadatele directorului pentru a sări peste directoarele care nu s-au schimbat de la ultima scanare. Acest lucru poate accelera _semnificativ_ scanările, dar rețineți că metadatele directoarelor _nu_ se schimbă/actualizează atunci când editați fișiere existente, se schimbă doar atunci când adăugați fișiere noi sau ștergeți fișiere existente. Activați această opțiune numai dacă nu modificați fișierele existente.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Salvează Metadatele În Directoarele Media</value> <value>Salvează Metadatele În Directoarele Media</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Omite Fișierele și Dosarele Ascunse În Timpul Scanării</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Sari Peste Directorarele Neschimbate În Timpul Scanării</value> <value>Sari Peste Directorarele Neschimbate În Timpul Scanării</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Чи зберігати копію завантажених метаданих у каталогах вмісту медіатеки чи ні. Це діє лише якщо активне завантаження метаданих з інтернету.</value> <value>Чи зберігати копію завантажених метаданих у каталогах вмісту медіатеки чи ні. Це діє лише якщо активне завантаження метаданих з інтернету.</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Коли ввімкнено, приховані файли та папки не включаються до сканування цієї медіатеки.</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Під час увімкнення цієї опції використовуються метадані каталогів, щоб пропускати каталоги, які не змінювалися з моменту останнього сканування. Це може _значно_ прискорити сканування, але врахуйте, що метадані каталогів _не_ змінюються/оновлюються під час редагування наявних файлів, а лише під час додавання нових або видалення наявних. Вмикайте цю опцію лише в тому випадку, якщо ви не змінюєте наявні файли.</value> <value>Під час увімкнення цієї опції використовуються метадані каталогів, щоб пропускати каталоги, які не змінювалися з моменту останнього сканування. Це може _значно_ прискорити сканування, але врахуйте, що метадані каталогів _не_ змінюються/оновлюються під час редагування наявних файлів, а лише під час додавання нових або видалення наявних. Вмикайте цю опцію лише в тому випадку, якщо ви не змінюєте наявні файли.</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>Зберігати метадані в каталогах медіафайлів</value> <value>Зберігати метадані в каталогах медіафайлів</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>Пропускати Приховані Файли та Папки Під Час Сканування</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>Пропускати незмінені папки під час сканування</value> <value>Пропускати незмінені папки під час сканування</value>
</data> </data>
@@ -189,6 +189,9 @@
<data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="DescriptionShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>是否在媒体库内容位置目录中保存已下载元数据的副本。这仅在从网络下载元数据处于活动状态时才有效。</value> <value>是否在媒体库内容位置目录中保存已下载元数据的副本。这仅在从网络下载元数据处于活动状态时才有效。</value>
</data> </data>
<data name="DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>启用后,此媒体库的扫描将不包含隐藏文件和隐藏文件夹。</value>
</data>
<data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="DescriptionShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>启用此选项后,将使用目录元数据跳过自上次扫描以来未更改的目录。这可以_显著_加快扫描速度,但请注意,编辑现有文件时目录元数据_不会_更改/更新,只有在添加新文件或删除现有文件时才会更改。仅当您不修改现有文件时才启用此选项。</value> <value>启用此选项后,将使用目录元数据跳过自上次扫描以来未更改的目录。这可以_显著_加快扫描速度,但请注意,编辑现有文件时目录元数据_不会_更改/更新,只有在添加新文件或删除现有文件时才会更改。仅当您不修改现有文件时才启用此选项。</value>
</data> </data>
@@ -285,6 +288,9 @@
<data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve"> <data name="ShouldSaveMetadataInMediaDirectories" xml:space="preserve">
<value>在媒体目录中保存元数据</value> <value>在媒体目录中保存元数据</value>
</data> </data>
<data name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" xml:space="preserve">
<value>扫描时跳过隐藏文件和文件夹</value>
</data>
<data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve"> <data name="ShouldSkipUnchangedDirectoriesDuringScan" xml:space="preserve">
<value>扫描时跳过未更改的文件夹</value> <value>扫描时跳过未更改的文件夹</value>
</data> </data>
@@ -206,6 +206,18 @@
</div> </div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSkipUnchangedDirectoriesDuringScan"]</small> <small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSkipUnchangedDirectoriesDuringScan"]</small>
</div> </div>
<div class="form-row">
<div class="form-label">
<label asp-for="ShouldSkipHiddenFilesAndDirectoriesDuringScan">@_localizer["ShouldSkipHiddenFilesAndDirectoriesDuringScan"]:</label>
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" id="ShouldSkipHiddenFilesAndDirectoriesDuringScan" name="ShouldSkipHiddenFilesAndDirectoriesDuringScan" value="true" checked="@(Model.ShouldSkipHiddenFilesAndDirectoriesDuringScan == true)" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSkipHiddenFilesAndDirectoriesDuringScan"]</small>
</div>
<div class="form-row"> <div class="form-row">
<div class="form-label"> <div class="form-label">
<label asp-for="IsContentOnSsd">@_localizer["IsContentOnSsd"]:</label> <label asp-for="IsContentOnSsd">@_localizer["IsContentOnSsd"]:</label>
@@ -377,6 +389,7 @@
const chkCanDownloadMetadataFromWeb = form.querySelector('[name="CanDownloadMetadataFromWeb"]'); const chkCanDownloadMetadataFromWeb = form.querySelector('[name="CanDownloadMetadataFromWeb"]');
const chkShouldSaveMetadataInMediaDirectories = form.querySelector('[name="ShouldSaveMetadataInMediaDirectories"]'); const chkShouldSaveMetadataInMediaDirectories = form.querySelector('[name="ShouldSaveMetadataInMediaDirectories"]');
const chkShouldSkipUnchangedDirectoriesDuringScan = form.querySelector('[name="ShouldSkipUnchangedDirectoriesDuringScan"]'); const chkShouldSkipUnchangedDirectoriesDuringScan = form.querySelector('[name="ShouldSkipUnchangedDirectoriesDuringScan"]');
const chkShouldSkipHiddenFilesAndDirectoriesDuringScan = form.querySelector('[name="ShouldSkipHiddenFilesAndDirectoriesDuringScan"]');
const chkIsContentOnSsd = form.querySelector('[name="IsContentOnSsd"]'); const chkIsContentOnSsd = form.querySelector('[name="IsContentOnSsd"]');
const chkShouldTrackConsumptionProgress = form.querySelector('[name="ShouldTrackConsumptionProgress"]'); const chkShouldTrackConsumptionProgress = form.querySelector('[name="ShouldTrackConsumptionProgress"]');
const inputCompletionThresholdPercentage = form.querySelector('[name="CompletionThresholdPercentage"]'); const inputCompletionThresholdPercentage = form.querySelector('[name="CompletionThresholdPercentage"]');
@@ -410,6 +423,7 @@
CanDownloadMetadataFromWeb: chkCanDownloadMetadataFromWeb.checked, CanDownloadMetadataFromWeb: chkCanDownloadMetadataFromWeb.checked,
ShouldSaveMetadataInMediaDirectories: chkShouldSaveMetadataInMediaDirectories.checked, ShouldSaveMetadataInMediaDirectories: chkShouldSaveMetadataInMediaDirectories.checked,
ShouldSkipUnchangedDirectoriesDuringScan: chkShouldSkipUnchangedDirectoriesDuringScan.checked, ShouldSkipUnchangedDirectoriesDuringScan: chkShouldSkipUnchangedDirectoriesDuringScan.checked,
ShouldSkipHiddenFilesAndDirectoriesDuringScan: chkShouldSkipHiddenFilesAndDirectoriesDuringScan.checked,
IsContentOnSsd: chkIsContentOnSsd.checked, IsContentOnSsd: chkIsContentOnSsd.checked,
ShouldTrackConsumptionProgress: shouldTrackConsumptionProgress, ShouldTrackConsumptionProgress: shouldTrackConsumptionProgress,
// An empty threshold is sent as null: creating a library or enabling progress tracking uses the type default, // An empty threshold is sent as null: creating a library or enabling progress tracking uses the type default,
@@ -33,6 +33,7 @@ public class LibraryEntityFixture
/// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param> /// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether hidden files and directories should be skipped during a scan or not.</param>
/// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Whether the consumption progress of the media library items is tracked.</param> /// <param name="shouldTrackConsumptionProgress">Whether the consumption progress of the media library items is tracked.</param>
/// <param name="completionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -53,6 +54,7 @@ public class LibraryEntityFixture
bool canDownloadMetadataFromWeb = true, bool canDownloadMetadataFromWeb = true,
bool shouldSaveMetadataInMediaDirectories = true, bool shouldSaveMetadataInMediaDirectories = true,
bool shouldSkipUnchangedDirectoriesDuringScan = false, bool shouldSkipUnchangedDirectoriesDuringScan = false,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan = false,
bool isContentOnSsd = false, bool isContentOnSsd = false,
bool shouldTrackConsumptionProgress = false, bool shouldTrackConsumptionProgress = false,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -77,6 +79,7 @@ public class LibraryEntityFixture
CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb, CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb,
ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories, ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories,
ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan, ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan,
ShouldSkipHiddenFilesAndDirectoriesDuringScan = shouldSkipHiddenFilesAndDirectoriesDuringScan,
IsContentOnSsd = isContentOnSsd, IsContentOnSsd = isContentOnSsd,
ShouldTrackConsumptionProgress = shouldTrackConsumptionProgress, ShouldTrackConsumptionProgress = shouldTrackConsumptionProgress,
CompletionThresholdPercentage = completionThresholdPercentage, CompletionThresholdPercentage = completionThresholdPercentage,
@@ -28,6 +28,7 @@ public class AddLibraryCommandFixture
/// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param> /// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during a scan or not. When absent, the default is off.</param>
/// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param> /// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -46,6 +47,7 @@ public class AddLibraryCommandFixture
bool canDownloadMetadataFromWeb = true, bool canDownloadMetadataFromWeb = true,
bool shouldSaveMetadataInMediaDirectories = true, bool shouldSaveMetadataInMediaDirectories = true,
bool shouldSkipUnchangedDirectoriesDuringScan = false, bool shouldSkipUnchangedDirectoriesDuringScan = false,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
bool isContentOnSsd = false, bool isContentOnSsd = false,
bool? shouldTrackConsumptionProgress = null, bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -65,6 +67,7 @@ public class AddLibraryCommandFixture
true, true,
true, true,
false, false,
null,
false, false,
shouldTrackConsumptionProgress, shouldTrackConsumptionProgress,
completionThresholdPercentage, completionThresholdPercentage,
@@ -82,6 +85,7 @@ public class AddLibraryCommandFixture
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb) .RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories) .RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan) .RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
.RuleFor(x => x.ShouldSkipHiddenFilesAndDirectoriesDuringScan, shouldSkipHiddenFilesAndDirectoriesDuringScan)
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd) .RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
.RuleFor(x => x.PathTemplateParts, pathTemplateParts) .RuleFor(x => x.PathTemplateParts, pathTemplateParts)
.RuleFor(x => x.MetadataProviders, metadataProviders) .RuleFor(x => x.MetadataProviders, metadataProviders)
@@ -30,6 +30,7 @@ public class UpdateLibraryCommandFixture
/// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param> /// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during a scan or not. When absent, the stored value is kept.</param>
/// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param> /// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -49,6 +50,7 @@ public class UpdateLibraryCommandFixture
bool canDownloadMetadataFromWeb = true, bool canDownloadMetadataFromWeb = true,
bool shouldSaveMetadataInMediaDirectories = true, bool shouldSaveMetadataInMediaDirectories = true,
bool shouldSkipUnchangedDirectoriesDuringScan = false, bool shouldSkipUnchangedDirectoriesDuringScan = false,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
bool isContentOnSsd = false, bool isContentOnSsd = false,
bool? shouldTrackConsumptionProgress = null, bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -69,6 +71,7 @@ public class UpdateLibraryCommandFixture
true, true,
true, true,
false, false,
null,
false, false,
shouldTrackConsumptionProgress, shouldTrackConsumptionProgress,
completionThresholdPercentage, completionThresholdPercentage,
@@ -87,6 +90,7 @@ public class UpdateLibraryCommandFixture
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb) .RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories) .RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan) .RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
.RuleFor(x => x.ShouldSkipHiddenFilesAndDirectoriesDuringScan, shouldSkipHiddenFilesAndDirectoriesDuringScan)
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd) .RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
.RuleFor(x => x.PathTemplateParts, pathTemplateParts) .RuleFor(x => x.PathTemplateParts, pathTemplateParts)
.RuleFor(x => x.MetadataProviders, metadataProviders) .RuleFor(x => x.MetadataProviders, metadataProviders)
@@ -28,6 +28,7 @@ public class AddLibraryRequestFixture
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param> /// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during scan.</param>
/// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param> /// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -46,6 +47,7 @@ public class AddLibraryRequestFixture
bool? canDownloadMetadataFromWeb = null, bool? canDownloadMetadataFromWeb = null,
bool? shouldSaveMetadataInMediaDirectories = null, bool? shouldSaveMetadataInMediaDirectories = null,
bool? shouldSkipUnchangedDirectoriesDuringScan = null, bool? shouldSkipUnchangedDirectoriesDuringScan = null,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
bool? isContentOnSsd = null, bool? isContentOnSsd = null,
bool? shouldTrackConsumptionProgress = null, bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -64,6 +66,7 @@ public class AddLibraryRequestFixture
canDownloadMetadataFromWeb ?? _faker.Random.Bool(), canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(), shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(), shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool(),
isContentOnSsd ?? false, isContentOnSsd ?? false,
shouldTrackConsumptionProgress, shouldTrackConsumptionProgress,
completionThresholdPercentage, completionThresholdPercentage,
@@ -30,6 +30,7 @@ public class UpdateLibraryRequestFixture
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param> /// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during scan.</param>
/// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param> /// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items should be tracked, or not.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -49,6 +50,7 @@ public class UpdateLibraryRequestFixture
bool? canDownloadMetadataFromWeb = null, bool? canDownloadMetadataFromWeb = null,
bool? shouldSaveMetadataInMediaDirectories = null, bool? shouldSaveMetadataInMediaDirectories = null,
bool? shouldSkipUnchangedDirectoriesDuringScan = null, bool? shouldSkipUnchangedDirectoriesDuringScan = null,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
bool? isContentOnSsd = null, bool? isContentOnSsd = null,
bool? shouldTrackConsumptionProgress = null, bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -68,6 +70,7 @@ public class UpdateLibraryRequestFixture
canDownloadMetadataFromWeb ?? _faker.Random.Bool(), canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(), shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(), shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool(),
isContentOnSsd ?? false, isContentOnSsd ?? false,
shouldTrackConsumptionProgress, shouldTrackConsumptionProgress,
completionThresholdPercentage, completionThresholdPercentage,
@@ -32,6 +32,7 @@ public class LibraryResponseFixture
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param> /// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during scan.</param>
/// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Optional. Whether the content of the media library is stored on a solid state drive.</param>
/// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items is tracked.</param> /// <param name="shouldTrackConsumptionProgress">Optional. Whether the consumption progress of the media library items is tracked.</param>
/// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param> /// <param name="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
@@ -51,6 +52,7 @@ public class LibraryResponseFixture
bool? canDownloadMetadataFromWeb = null, bool? canDownloadMetadataFromWeb = null,
bool? shouldSaveMetadataInMediaDirectories = null, bool? shouldSaveMetadataInMediaDirectories = null,
bool? shouldSkipUnchangedDirectoriesDuringScan = null, bool? shouldSkipUnchangedDirectoriesDuringScan = null,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null,
bool? isContentOnSsd = null, bool? isContentOnSsd = null,
bool? shouldTrackConsumptionProgress = null, bool? shouldTrackConsumptionProgress = null,
int? completionThresholdPercentage = null, int? completionThresholdPercentage = null,
@@ -72,6 +74,7 @@ public class LibraryResponseFixture
canDownloadMetadataFromWeb ?? _faker.Random.Bool(), canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(), shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(), shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool(),
isContentOnSsd ?? false, isContentOnSsd ?? false,
resolvedShouldTrackConsumptionProgress, resolvedShouldTrackConsumptionProgress,
resolvedCompletionThresholdPercentage, resolvedCompletionThresholdPercentage,
@@ -43,6 +43,7 @@ public class LibraryFixture
/// <param name="canDownloadMetadataFromWeb">Whether metadata download from the web is enabled.</param> /// <param name="canDownloadMetadataFromWeb">Whether metadata download from the web is enabled.</param>
/// <param name="shouldSaveMetadataInMediaDirectories">Whether metadata should be saved in the media directories.</param> /// <param name="shouldSaveMetadataInMediaDirectories">Whether metadata should be saved in the media directories.</param>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during scan.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during scan.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether hidden files and directories should be skipped during scan.</param>
/// <param name="isContentOnSsd">Whether the content of the library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of the library is stored on a solid state drive.</param>
/// <param name="consumptionSettings">Optional. The consumption settings of the library.</param> /// <param name="consumptionSettings">Optional. The consumption settings of the library.</param>
/// <param name="scanIds">Optional. The scan Ids associated with the library.</param> /// <param name="scanIds">Optional. The scan Ids associated with the library.</param>
@@ -61,6 +62,7 @@ public class LibraryFixture
bool canDownloadMetadataFromWeb = true, bool canDownloadMetadataFromWeb = true,
bool shouldSaveMetadataInMediaDirectories = false, bool shouldSaveMetadataInMediaDirectories = false,
bool shouldSkipUnchangedDirectoriesDuringScan = false, bool shouldSkipUnchangedDirectoriesDuringScan = false,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan = false,
bool isContentOnSsd = false, bool isContentOnSsd = false,
LibraryConsumptionSettings? consumptionSettings = null, LibraryConsumptionSettings? consumptionSettings = null,
IEnumerable<Guid>? scanIds = null, IEnumerable<Guid>? scanIds = null,
@@ -93,6 +95,7 @@ public class LibraryFixture
canDownloadMetadataFromWeb, canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan,
isContentOnSsd, isContentOnSsd,
resolvedConsumptionSettings, resolvedConsumptionSettings,
pathTemplate ?? LibraryPathTemplate.Empty(), pathTemplate ?? LibraryPathTemplate.Empty(),
@@ -110,6 +113,7 @@ public class LibraryFixture
canDownloadMetadataFromWeb, canDownloadMetadataFromWeb,
shouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories,
shouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan,
isContentOnSsd, isContentOnSsd,
resolvedConsumptionSettings, resolvedConsumptionSettings,
pathTemplate ?? LibraryPathTemplate.Empty(), pathTemplate ?? LibraryPathTemplate.Empty(),
@@ -25,8 +25,15 @@ public class LibraryDtoFixture
/// <param name="libraryType">Optional type of the library.</param> /// <param name="libraryType">Optional type of the library.</param>
/// <param name="isEnabled">Whether the media library is enabled or not.</param> /// <param name="isEnabled">Whether the media library is enabled or not.</param>
/// <param name="contentLocations">Optional collection of directories that contain the library files.</param> /// <param name="contentLocations">Optional collection of directories that contain the library files.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Optional. Whether hidden files and directories should be skipped during the scan, or not.</param>
/// <returns>A configured <see cref="LibraryDto"/> instance.</returns> /// <returns>A configured <see cref="LibraryDto"/> instance.</returns>
public LibraryDto Create(Guid? id = null, string? title = null, string? libraryType = null, bool? isEnabled = null, List<string>? contentLocations = null) public LibraryDto Create(
Guid? id = null,
string? title = null,
string? libraryType = null,
bool? isEnabled = null,
List<string>? contentLocations = null,
bool? shouldSkipHiddenFilesAndDirectoriesDuringScan = null)
{ {
return new LibraryDto return new LibraryDto
{ {
@@ -35,7 +42,8 @@ public class LibraryDtoFixture
LibraryType = libraryType ?? _faker.PickRandom("Book", "Video", "Photo"), LibraryType = libraryType ?? _faker.PickRandom("Book", "Video", "Photo"),
CoverImage = _faker.Image.PicsumUrl(), CoverImage = _faker.Image.PicsumUrl(),
ContentLocations = contentLocations ?? [_faker.System.DirectoryPath()], ContentLocations = contentLocations ?? [_faker.System.DirectoryPath()],
IsEnabled = isEnabled ?? _faker.Random.Bool() IsEnabled = isEnabled ?? _faker.Random.Bool(),
ShouldSkipHiddenFilesAndDirectoriesDuringScan = shouldSkipHiddenFilesAndDirectoriesDuringScan ?? _faker.Random.Bool()
}; };
} }
@@ -95,6 +95,48 @@ public class DirectoryScanFingerprintRepositoryTests : IDisposable
Assert.Empty(result.Value); Assert.Empty(result.Value);
} }
[Fact]
public async Task DeleteByLibraryIdAsync_WhenCalled_ShouldDeleteOnlyTheFingerprintsOfThatLibrary()
{
// Arrange
(Guid libraryId, _) = await SeedLibraryGraphAsync();
UserEntity otherUser = _userEntityFixture.Create();
_context.Users.Add(otherUser);
Guid otherLibraryId = Guid.NewGuid();
LibraryEntity otherLibrary = _libraryEntityFixture.Create(id: otherLibraryId, userId: otherUser.Id);
_context.Libraries.Add(otherLibrary);
DirectoryScanFingerprintEntity firstFingerprint = _directoryScanFingerprintEntityFixture.Create(libraryId: libraryId, path: "/dir1");
DirectoryScanFingerprintEntity secondFingerprint = _directoryScanFingerprintEntityFixture.Create(libraryId: libraryId, path: "/dir2");
DirectoryScanFingerprintEntity fingerprintOfOtherLibrary = _directoryScanFingerprintEntityFixture.Create(libraryId: otherLibraryId, path: "/dir3");
_context.DirectoryScanFingerprints.AddRange(firstFingerprint, secondFingerprint, fingerprintOfOtherLibrary);
await _context.SaveChangesAsync();
// Act
Result<Deleted> result = await _sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
Assert.Equal(Result.Deleted, result.Value);
DirectoryScanFingerprintEntity remainingFingerprint = await _context.DirectoryScanFingerprints.AsNoTracking().SingleAsync();
Assert.Equal(fingerprintOfOtherLibrary.Id, remainingFingerprint.Id);
}
[Fact]
public async Task DeleteByLibraryIdAsync_WhenNoFingerprintsExist_ShouldReturnDeleted()
{
// Arrange
(Guid libraryId, _) = await SeedLibraryGraphAsync();
// Act
Result<Deleted> result = await _sut.DeleteByLibraryIdAsync(libraryId, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
Assert.Equal(Result.Deleted, result.Value);
Assert.False(await _context.DirectoryScanFingerprints.AnyAsync());
}
[Fact] [Fact]
public async Task UpsertRangeAsync_WhenCalledWithNewFingerprints_ShouldInsertThemAndReturnUpdated() public async Task UpsertRangeAsync_WhenCalledWithNewFingerprints_ShouldInsertThemAndReturnUpdated()
{ {
@@ -96,8 +96,13 @@ public class BooksFileSystemDiscoveryJobTests
using TemporaryLibraryDirectory temporaryLibraryDirectory = new(); using TemporaryLibraryDirectory temporaryLibraryDirectory = new();
temporaryLibraryDirectory.CreateFile("book1.pdf", "book content"); temporaryLibraryDirectory.CreateFile("book1.pdf", "book content");
temporaryLibraryDirectory.CreateFile("notes.log", "not a book"); temporaryLibraryDirectory.CreateFile("notes.log", "not a book");
temporaryLibraryDirectory.CreateFile(".hidden.pdf", "hidden book content");
SetHiddenAttribute(Path.Combine(temporaryLibraryDirectory.Path, ".hidden.pdf"));
string subdirectoryPath = temporaryLibraryDirectory.CreateSubdirectory("sub"); string subdirectoryPath = temporaryLibraryDirectory.CreateSubdirectory("sub");
File.WriteAllText(Path.Combine(subdirectoryPath, "book2.epub"), "another book content"); File.WriteAllText(Path.Combine(subdirectoryPath, "book2.epub"), "another book content");
string hiddenSubdirectoryPath = temporaryLibraryDirectory.CreateSubdirectory(".hidden");
SetHiddenAttribute(hiddenSubdirectoryPath);
File.WriteAllText(Path.Combine(hiddenSubdirectoryPath, "hidden.epub"), "hidden book content");
LibraryEntity libraryEntity = _libraryEntityFixture.Create( LibraryEntity libraryEntity = _libraryEntityFixture.Create(
id: _libraryId.Value, id: _libraryId.Value,
@@ -125,12 +130,53 @@ public class BooksFileSystemDiscoveryJobTests
.FirstOrDefault(); .FirstOrDefault();
Assert.True(actualEntities is not null, $"InsertRangeAsync was not called. Received: {string.Join(", ", _mockStagingResultsRepository.ReceivedCalls().Select(call => call.GetMethodInfo().Name))}"); Assert.True(actualEntities is not null, $"InsertRangeAsync was not called. Received: {string.Join(", ", _mockStagingResultsRepository.ReceivedCalls().Select(call => call.GetMethodInfo().Name))}");
Assert.Equal( Assert.Equal(
["book1.pdf", "book2.epub"], [".hidden.pdf", "book1.pdf", "book2.epub", "hidden.epub"],
actualEntities!.Select(entity => Path.GetFileName(entity.Path)).OrderBy(name => name, StringComparer.Ordinal)); actualEntities!.Select(entity => Path.GetFileName(entity.Path)).OrderBy(name => name, StringComparer.Ordinal));
await _mockDirectoryScanFingerprintRepository.DidNotReceive().UpsertRangeAsync(Arg.Any<IReadOnlyCollection<DirectoryScanFingerprintEntity>>(), Arg.Any<CancellationToken>()); await _mockDirectoryScanFingerprintRepository.DidNotReceive().UpsertRangeAsync(Arg.Any<IReadOnlyCollection<DirectoryScanFingerprintEntity>>(), Arg.Any<CancellationToken>());
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanProgressChangedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>()); await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanProgressChangedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>());
} }
[Fact]
public async Task ExecuteAsync_WhenHiddenFilesAndDirectoriesAreSkipped_ShouldNotDiscoverThem()
{
// Arrange
using TemporaryLibraryDirectory temporaryLibraryDirectory = new();
temporaryLibraryDirectory.CreateFile("visible.pdf", "visible book content");
temporaryLibraryDirectory.CreateFile(".hidden.pdf", "hidden book content");
string hiddenFileName = Path.Combine(temporaryLibraryDirectory.Path, ".hidden.pdf");
SetHiddenAttribute(hiddenFileName);
string visibleSubdirectoryPath = temporaryLibraryDirectory.CreateSubdirectory("visible");
File.WriteAllText(Path.Combine(visibleSubdirectoryPath, "nested.epub"), "nested book content");
string hiddenSubdirectoryPath = temporaryLibraryDirectory.CreateSubdirectory(".hidden");
SetHiddenAttribute(hiddenSubdirectoryPath);
File.WriteAllText(Path.Combine(hiddenSubdirectoryPath, "secret.epub"), "secret book content");
LibraryEntity libraryEntity = _libraryEntityFixture.Create(
id: _libraryId.Value,
userId: _userId.Value,
title: "Test Library",
libraryType: LibraryType.Book,
contentLocations: [temporaryLibraryDirectory.Path],
shouldSkipHiddenFilesAndDirectoriesDuringScan: true);
_mockLibraryRepository.GetByIdAsync(_libraryId.Value, cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(libraryEntity));
_mockStagingResultsRepository.InsertRangeAsync(Arg.Any<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(), Arg.Any<CancellationToken>())
.Returns(Result.From(Result.Created));
// Act
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
// Assert
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
await _mockStagingResultsRepository.Received(1).InsertRangeAsync(
Arg.Is<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(entities =>
entities.Count == 2
&& entities.Select(entity => Path.GetFileName(entity.Path)).OrderBy(name => name, StringComparer.Ordinal).SequenceEqual(new[] { "nested.epub", "visible.pdf" })),
Arg.Any<CancellationToken>());
}
[Fact] [Fact]
public async Task ExecuteAsync_WhenFastSkipIsEnabledAndDirectoryDidNotChange_ShouldSkipTheDirectoryAndUpsertOnlyChangedFingerprints() public async Task ExecuteAsync_WhenFastSkipIsEnabledAndDirectoryDidNotChange_ShouldSkipTheDirectoryAndUpsertOnlyChangedFingerprints()
{ {
@@ -310,6 +356,16 @@ public class BooksFileSystemDiscoveryJobTests
await mockChild.Received(1).ExecuteAsync(Arg.Any<Guid>(), Arg.Is<object>(executedInput => executedInput == input), Arg.Any<CancellationToken>()); await mockChild.Received(1).ExecuteAsync(Arg.Any<Guid>(), Arg.Is<object>(executedInput => executedInput == input), Arg.Any<CancellationToken>());
} }
/// <summary>
/// Marks the file system entry at <paramref name="path"/> as hidden on Windows, where the dot prefix alone is not enough.
/// </summary>
/// <param name="path">The path of the file or directory to mark as hidden.</param>
private static void SetHiddenAttribute(string path)
{
if (OperatingSystem.IsWindows())
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}
/// <summary> /// <summary>
/// Test helper managing a temporary library directory, deleted when the test finishes. /// Test helper managing a temporary library directory, deleted when the test finishes.
/// </summary> /// </summary>
@@ -71,7 +71,8 @@ public class AddLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
isLocked: false, isLocked: false,
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true shouldSkipUnchangedDirectoriesDuringScan: true,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true
); );
// Act // Act
@@ -83,12 +84,14 @@ public class AddLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFacto
Assert.NotNull(library); Assert.NotNull(library);
Assert.Equal("New Library", library!.Title); Assert.Equal("New Library", library!.Title);
Assert.Equal(LibraryType.EBook, library.LibraryType); Assert.Equal(LibraryType.EBook, library.LibraryType);
Assert.True(library.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
using IServiceScope scope = _apiFactory.Services.CreateScope(); using IServiceScope scope = _apiFactory.Services.CreateScope();
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
LibraryEntity? storedLibrary = await dbContext.Libraries.FirstOrDefaultAsync(lib => lib.Id == library.Id); LibraryEntity? storedLibrary = await dbContext.Libraries.FirstOrDefaultAsync(lib => lib.Id == library.Id);
Assert.NotNull(storedLibrary); Assert.NotNull(storedLibrary);
Assert.Equal("New Library", storedLibrary!.Title); Assert.Equal("New Library", storedLibrary!.Title);
Assert.True(storedLibrary.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
} }
[Fact] [Fact]
@@ -41,6 +41,7 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
}; };
private readonly LibraryEntityFixture _libraryEntityFixture = new(); private readonly LibraryEntityFixture _libraryEntityFixture = new();
private readonly DirectoryScanFingerprintEntityFixture _directoryScanFingerprintEntityFixture = new();
private readonly UpdateLibraryRequestFixture _updateLibraryRequestFixture = new(); private readonly UpdateLibraryRequestFixture _updateLibraryRequestFixture = new();
private readonly LibraryProviderSelectionRequestFixture _libraryProviderSelectionRequestFixture = new(); private readonly LibraryProviderSelectionRequestFixture _libraryProviderSelectionRequestFixture = new();
@@ -69,6 +70,12 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
Guid userId = GetCurrentUserId(); Guid userId = GetCurrentUserId();
Guid libraryId = Guid.NewGuid(); Guid libraryId = Guid.NewGuid();
await SeedLibraryAsync(libraryId, userId, "Original Title"); await SeedLibraryAsync(libraryId, userId, "Original Title");
using (IServiceScope seedScope = _apiFactory.Services.CreateScope())
{
LuminaDbContext seedDbContext = seedScope.ServiceProvider.GetRequiredService<LuminaDbContext>();
seedDbContext.DirectoryScanFingerprints.Add(_directoryScanFingerprintEntityFixture.Create(libraryId: libraryId, path: "/fingerprint"));
await seedDbContext.SaveChangesAsync();
}
UpdateLibraryRequest request = _updateLibraryRequestFixture.Create( UpdateLibraryRequest request = _updateLibraryRequestFixture.Create(
id: libraryId, id: libraryId,
title: "Updated Title", title: "Updated Title",
@@ -79,7 +86,8 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
isLocked: false, isLocked: false,
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: true shouldSkipUnchangedDirectoriesDuringScan: true,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true
); );
// Act // Act
@@ -91,12 +99,66 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
LibraryResponse? library = await response.Content.ReadFromJsonAsync<LibraryResponse>(_jsonOptions); LibraryResponse? library = await response.Content.ReadFromJsonAsync<LibraryResponse>(_jsonOptions);
Assert.NotNull(library); Assert.NotNull(library);
Assert.Equal("Updated Title", library!.Title); Assert.Equal("Updated Title", library!.Title);
Assert.True(library.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
using IServiceScope scope = _apiFactory.Services.CreateScope(); using IServiceScope scope = _apiFactory.Services.CreateScope();
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
LibraryEntity? storedLibrary = await dbContext.Libraries.FirstOrDefaultAsync(lib => lib.Id == libraryId); LibraryEntity? storedLibrary = await dbContext.Libraries.FirstOrDefaultAsync(lib => lib.Id == libraryId);
Assert.NotNull(storedLibrary); Assert.NotNull(storedLibrary);
Assert.Equal("Updated Title", storedLibrary!.Title); Assert.Equal("Updated Title", storedLibrary!.Title);
Assert.True(storedLibrary.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.False(await dbContext.DirectoryScanFingerprints.AnyAsync(fingerprint => fingerprint.LibraryId == libraryId));
}
[Fact]
public async Task UpdateLibrary_WhenHiddenFilesSettingIsAbsent_ShouldKeepTheStoredValue()
{
// Arrange
Guid userId = GetCurrentUserId();
Guid libraryId = Guid.NewGuid();
await SeedLibraryAsync(libraryId, userId, "Original Title", shouldSkipHiddenFilesAndDirectoriesDuringScan: true);
using (IServiceScope seedScope = _apiFactory.Services.CreateScope())
{
LuminaDbContext seedDbContext = seedScope.ServiceProvider.GetRequiredService<LuminaDbContext>();
seedDbContext.DirectoryScanFingerprints.Add(_directoryScanFingerprintEntityFixture.Create(libraryId: libraryId, path: "/fingerprint"));
await seedDbContext.SaveChangesAsync();
}
Dictionary<string, object?> request = new()
{
["id"] = libraryId,
["title"] = "Updated Title",
["libraryType"] = "EBook",
["contentLocations"] = new[] { "C:/Media" },
["coverImage"] = null,
["isEnabled"] = true,
["isLocked"] = false,
["canDownloadMetadataFromWeb"] = true,
["shouldSaveMetadataInMediaDirectories"] = false,
["shouldSkipUnchangedDirectoriesDuringScan"] = false,
["isContentOnSsd"] = false,
["shouldTrackConsumptionProgress"] = null,
["completionThresholdPercentage"] = null,
["pathTemplateParts"] = null,
["metadataProviders"] = null,
["artworkProviders"] = null,
["bookReaders"] = null
};
// Act
HttpResponseMessage response = await _client.PutAsJsonAsync($"/api/v1/libraries/{libraryId}", request);
// Assert
response.EnsureSuccessStatusCode();
LibraryResponse? library = await response.Content.ReadFromJsonAsync<LibraryResponse>(_jsonOptions);
Assert.NotNull(library);
Assert.True(library!.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
using IServiceScope scope = _apiFactory.Services.CreateScope();
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
LibraryEntity? storedLibrary = await dbContext.Libraries.FirstOrDefaultAsync(lib => lib.Id == libraryId);
Assert.NotNull(storedLibrary);
Assert.True(storedLibrary!.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.True(await dbContext.DirectoryScanFingerprints.AnyAsync(fingerprint => fingerprint.LibraryId == libraryId));
} }
[Fact] [Fact]
@@ -473,7 +535,8 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
Guid userId, Guid userId,
string title, string title,
bool shouldTrackConsumptionProgress = false, bool shouldTrackConsumptionProgress = false,
int? completionThresholdPercentage = null) int? completionThresholdPercentage = null,
bool shouldSkipHiddenFilesAndDirectoriesDuringScan = false)
{ {
using IServiceScope scope = _apiFactory.Services.CreateScope(); using IServiceScope scope = _apiFactory.Services.CreateScope();
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>(); LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
@@ -483,6 +546,7 @@ public class UpdateLibraryEndpointTests : IClassFixture<AuthenticatedLuminaApiFa
title: title, title: title,
libraryType: LibraryType.EBook, libraryType: LibraryType.EBook,
contentLocations: [], contentLocations: [],
shouldSkipHiddenFilesAndDirectoriesDuringScan: shouldSkipHiddenFilesAndDirectoriesDuringScan,
shouldTrackConsumptionProgress: shouldTrackConsumptionProgress, shouldTrackConsumptionProgress: shouldTrackConsumptionProgress,
completionThresholdPercentage: completionThresholdPercentage)); completionThresholdPercentage: completionThresholdPercentage));
await dbContext.SaveChangesAsync(); await dbContext.SaveChangesAsync();
@@ -11,6 +11,7 @@ using System;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
#endregion #endregion
@@ -56,6 +57,36 @@ public class EditLibraryViewEndpointTests : IClassFixture<LuminaWebFactory>
Assert.Contains($"libraries/{libraryId}", _apiFactory.ApiClientStub.GetEndpointsCalled); Assert.Contains($"libraries/{libraryId}", _apiFactory.ApiClientStub.GetEndpointsCalled);
} }
[Theory]
[InlineData(true)]
[InlineData(false)]
public async Task EditLibraryView_WhenLibraryHasHiddenFilesSetting_ShouldRenderTheCheckboxWithItsStoredState(bool shouldSkipHiddenFilesAndDirectoriesDuringScan)
{
// Arrange
_apiFactory.ApiClientStub.Reset();
Guid libraryId = Guid.NewGuid();
LibraryDto expectedLibrary = _libraryDtoFixture.Create(
id: libraryId,
title: "Books",
libraryType: "Book",
shouldSkipHiddenFilesAndDirectoriesDuringScan: shouldSkipHiddenFilesAndDirectoriesDuringScan);
_apiFactory.ApiClientStub.RegisterGetResponse($"libraries/{libraryId}", expectedLibrary);
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
// Act
HttpResponseMessage response = await webClient.Client.GetAsync($"/en-us/libraries/manage/item/{libraryId}");
string content = await response.Content.ReadAsStringAsync();
// Assert
response.EnsureSuccessStatusCode();
string? checkboxTag = GetCheckboxTag(content, "ShouldSkipHiddenFilesAndDirectoriesDuringScan");
Assert.NotNull(checkboxTag);
if (shouldSkipHiddenFilesAndDirectoriesDuringScan)
Assert.Contains("checked", checkboxTag, StringComparison.OrdinalIgnoreCase);
else
Assert.DoesNotContain("checked", checkboxTag, StringComparison.OrdinalIgnoreCase);
}
[Fact] [Fact]
public async Task EditLibraryView_WhenThemeProvidesFileSystemBrowserTemplates_ShouldRenderThemedComponent() public async Task EditLibraryView_WhenThemeProvidesFileSystemBrowserTemplates_ShouldRenderThemedComponent()
{ {
@@ -104,6 +135,18 @@ public class EditLibraryViewEndpointTests : IClassFixture<LuminaWebFactory>
Assert.Contains("initFileSystemBrowser(", content); Assert.Contains("initFileSystemBrowser(", content);
} }
/// <summary>
/// Gets the rendered checkbox input tag with the provided name, or <see langword="null"/> when it is not present.
/// </summary>
/// <param name="content">The rendered HTML content.</param>
/// <param name="name">The name of the checkbox input.</param>
/// <returns>The rendered checkbox input tag, or <see langword="null"/>.</returns>
private static string? GetCheckboxTag(string content, string name)
{
Match match = Regex.Match(content, $@"<input[^>]*name=""{Regex.Escape(name)}""[^>]*>");
return match.Success ? match.Value : null;
}
/// <summary> /// <summary>
/// Registers the theme template response returned for the specified page key of the given theme. /// Registers the theme template response returned for the specified page key of the given theme.
/// </summary> /// </summary>
@@ -36,6 +36,7 @@ public class AddMediaLibraryRequestMappingTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
shouldTrackConsumptionProgress: true, shouldTrackConsumptionProgress: true,
completionThresholdPercentage: 90 completionThresholdPercentage: 90
@@ -54,6 +55,7 @@ public class AddMediaLibraryRequestMappingTests
Assert.Equal(request.IsLocked, result.IsLocked); Assert.Equal(request.IsLocked, result.IsLocked);
Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb); Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb);
Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories); Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories);
Assert.Equal(request.ShouldSkipHiddenFilesAndDirectoriesDuringScan, result.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd); Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd);
Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress); Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage); Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
@@ -33,6 +33,7 @@ public class LibraryEntityMappingTests
libraryType: LibraryType.Book, libraryType: LibraryType.Book,
contentLocations: ["C:/Books", "D:/Media/Books"], contentLocations: ["C:/Books", "D:/Media/Books"],
coverImage: "D:/myPoster.jpg", coverImage: "D:/myPoster.jpg",
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true); isContentOnSsd: true);
// Act // Act
@@ -46,6 +47,7 @@ public class LibraryEntityMappingTests
Assert.Equal(entity.LibraryType, result.LibraryType); Assert.Equal(entity.LibraryType, result.LibraryType);
Assert.Equal(entity.ContentLocations.Select(l => l.Path), result.ContentLocations); Assert.Equal(entity.ContentLocations.Select(l => l.Path), result.ContentLocations);
Assert.Equal(entity.CoverImage, result.CoverImage); Assert.Equal(entity.CoverImage, result.CoverImage);
Assert.Equal(entity.ShouldSkipHiddenFilesAndDirectoriesDuringScan, result.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.Equal(entity.IsContentOnSsd, result.IsContentOnSsd); Assert.Equal(entity.IsContentOnSsd, result.IsContentOnSsd);
Assert.Equal(entity.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress); Assert.Equal(entity.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
Assert.Equal(entity.CompletionThresholdPercentage, result.CompletionThresholdPercentage); Assert.Equal(entity.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
@@ -190,6 +192,7 @@ public class LibraryEntityMappingTests
libraryType: LibraryType.Book, libraryType: LibraryType.Book,
contentLocations: ["C:/Books"], contentLocations: ["C:/Books"],
coverImage: "D:/cover.jpg", coverImage: "D:/cover.jpg",
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
pathTemplateParts: [firstPart, secondPart]); pathTemplateParts: [firstPart, secondPart]);
@@ -203,6 +206,7 @@ public class LibraryEntityMappingTests
Assert.Equal(entity.Title, result.Value.Title); Assert.Equal(entity.Title, result.Value.Title);
Assert.Equal(entity.LibraryType, result.Value.LibraryType); Assert.Equal(entity.LibraryType, result.Value.LibraryType);
Assert.Equal("D:/cover.jpg", result.Value.CoverImage.Value); Assert.Equal("D:/cover.jpg", result.Value.CoverImage.Value);
Assert.Equal(entity.ShouldSkipHiddenFilesAndDirectoriesDuringScan, result.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.Equal(entity.IsContentOnSsd, result.Value.IsContentOnSsd); Assert.Equal(entity.IsContentOnSsd, result.Value.IsContentOnSsd);
Assert.Equal(entity.ShouldTrackConsumptionProgress, result.Value.ConsumptionSettings.ShouldTrackConsumptionProgress); Assert.Equal(entity.ShouldTrackConsumptionProgress, result.Value.ConsumptionSettings.ShouldTrackConsumptionProgress);
Assert.Equal(entity.CompletionThresholdPercentage, result.Value.ConsumptionSettings.CompletionThresholdPercentage.HasValue ? result.Value.ConsumptionSettings.CompletionThresholdPercentage.Value : null); Assert.Equal(entity.CompletionThresholdPercentage, result.Value.ConsumptionSettings.CompletionThresholdPercentage.HasValue ? result.Value.ConsumptionSettings.CompletionThresholdPercentage.Value : null);
@@ -41,6 +41,7 @@ public class LibraryMappingTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
scanIds: [Guid.NewGuid()]); scanIds: [Guid.NewGuid()]);
// Act // Act
@@ -60,6 +61,7 @@ public class LibraryMappingTests
Assert.False(result.IsLocked); Assert.False(result.IsLocked);
Assert.True(result.CanDownloadMetadataFromWeb); Assert.True(result.CanDownloadMetadataFromWeb);
Assert.False(result.ShouldSaveMetadataInMediaDirectories); Assert.False(result.ShouldSaveMetadataInMediaDirectories);
Assert.True(result.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.Equal(library.IsContentOnSsd, result.IsContentOnSsd); Assert.Equal(library.IsContentOnSsd, result.IsContentOnSsd);
Assert.Equal(library.ConsumptionSettings.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress); Assert.Equal(library.ConsumptionSettings.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
Assert.Equal(library.ConsumptionSettings.CompletionThresholdPercentage.HasValue ? library.ConsumptionSettings.CompletionThresholdPercentage.Value : null, result.CompletionThresholdPercentage); Assert.Equal(library.ConsumptionSettings.CompletionThresholdPercentage.HasValue ? library.ConsumptionSettings.CompletionThresholdPercentage.Value : null, result.CompletionThresholdPercentage);
@@ -36,6 +36,7 @@ public class UpdateLibraryRequestMappingTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
shouldTrackConsumptionProgress: true, shouldTrackConsumptionProgress: true,
completionThresholdPercentage: 90); completionThresholdPercentage: 90);
@@ -54,6 +55,7 @@ public class UpdateLibraryRequestMappingTests
Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb); Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb);
Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories); Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories);
Assert.Equal(request.ShouldSkipUnchangedDirectoriesDuringScan, result.ShouldSkipUnchangedDirectoriesDuringScan); Assert.Equal(request.ShouldSkipUnchangedDirectoriesDuringScan, result.ShouldSkipUnchangedDirectoriesDuringScan);
Assert.Equal(request.ShouldSkipHiddenFilesAndDirectoriesDuringScan, result.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd); Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd);
Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress); Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage); Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
@@ -114,6 +114,25 @@ public class AddLibraryCommandHandlerTests
_mockDomainEventsQueue.Received(1).Enqueue(Arg.Any<LibrarySavedDomainEvent>()); _mockDomainEventsQueue.Received(1).Enqueue(Arg.Any<LibrarySavedDomainEvent>());
} }
[Fact]
public async Task HandleAsync_WhenHiddenFilesSettingIsAbsent_ShouldDefaultToNotSkippingHiddenFiles()
{
// Arrange
AddLibraryCommand command = _addLibraryCommandFixture.Create(shouldSkipHiddenFilesAndDirectoriesDuringScan: null);
LibraryEntity persistedLibrary = _libraryEntityFixture.Create(userId: _userId);
_mockLibraryRepository.GetByIdAsync(Arg.Any<Guid>(), cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(persistedLibrary));
// Act
Result<LibraryResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
await _mockLibraryRepository.Received(1).InsertAsync(
Arg.Is<LibraryEntity>(library => !library.ShouldSkipHiddenFilesAndDirectoriesDuringScan),
Arg.Any<CancellationToken>());
}
[Fact] [Fact]
public async Task HandleAsync_WhenThresholdIsSuppliedWhileEffectiveTrackingIsOff_ShouldReturnThresholdMustBeNullError() public async Task HandleAsync_WhenThresholdIsSuppliedWhileEffectiveTrackingIsOff_ShouldReturnThresholdMustBeNullError()
{ {
@@ -45,6 +45,7 @@ public class UpdateLibraryCommandHandlerTests
{ {
private readonly IUnitOfWork _mockUnitOfWork; private readonly IUnitOfWork _mockUnitOfWork;
private readonly ILibraryRepository _mockLibraryRepository; private readonly ILibraryRepository _mockLibraryRepository;
private readonly IDirectoryScanFingerprintRepository _mockDirectoryScanFingerprintRepository;
private readonly IAuthorizationService _mockAuthorizationService; private readonly IAuthorizationService _mockAuthorizationService;
private readonly ICurrentUserService _mockCurrentUserService; private readonly ICurrentUserService _mockCurrentUserService;
private readonly IDomainEventsQueue _mockDomainEventsQueue; private readonly IDomainEventsQueue _mockDomainEventsQueue;
@@ -70,6 +71,10 @@ public class UpdateLibraryCommandHandlerTests
_mockUnitOfWork.SaveChangesAsync(Arg.Any<CancellationToken>()).Returns(Result.Success); _mockUnitOfWork.SaveChangesAsync(Arg.Any<CancellationToken>()).Returns(Result.Success);
_mockLibraryRepository = Substitute.For<ILibraryRepository>(); _mockLibraryRepository = Substitute.For<ILibraryRepository>();
_mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository); _mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository);
_mockDirectoryScanFingerprintRepository = Substitute.For<IDirectoryScanFingerprintRepository>();
_mockDirectoryScanFingerprintRepository.DeleteByLibraryIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>())
.Returns(Result.Deleted);
_mockUnitOfWork.DirectoryScanFingerprintRepository.Returns(_mockDirectoryScanFingerprintRepository);
_mockAuthorizationService = Substitute.For<IAuthorizationService>(); _mockAuthorizationService = Substitute.For<IAuthorizationService>();
_mockCurrentUserService = Substitute.For<ICurrentUserService>(); _mockCurrentUserService = Substitute.For<ICurrentUserService>();
_mockDomainEventsQueue = Substitute.For<IDomainEventsQueue>(); _mockDomainEventsQueue = Substitute.For<IDomainEventsQueue>();
@@ -121,6 +126,101 @@ public class UpdateLibraryCommandHandlerTests
_mockDomainEventsQueue.Received(1).Enqueue(Arg.Any<LibrarySavedDomainEvent>()); _mockDomainEventsQueue.Received(1).Enqueue(Arg.Any<LibrarySavedDomainEvent>());
} }
[Theory]
[InlineData(true, false, false, false)] // Only the skip unchanged directories setting changes.
[InlineData(false, true, false, false)] // Only the skip hidden files and directories setting changes.
public async Task HandleAsync_WhenAScanScopeSettingChanges_ShouldDeleteTheDirectoryScanFingerprints(
bool commandShouldSkipUnchangedDirectories,
bool commandShouldSkipHiddenFilesAndDirectories,
bool existingShouldSkipUnchangedDirectories,
bool existingShouldSkipHiddenFilesAndDirectories)
{
// Arrange
UpdateLibraryCommand command = _updateLibraryCommandFixture.Create(
shouldSkipUnchangedDirectoriesDuringScan: commandShouldSkipUnchangedDirectories,
shouldSkipHiddenFilesAndDirectoriesDuringScan: commandShouldSkipHiddenFilesAndDirectories);
LibraryEntity existingLibrary = _libraryEntityFixture.Create(
id: command.Id,
userId: _userId,
shouldSkipUnchangedDirectoriesDuringScan: existingShouldSkipUnchangedDirectories,
shouldSkipHiddenFilesAndDirectoriesDuringScan: existingShouldSkipHiddenFilesAndDirectories);
existingLibrary.LibraryType = Enum.Parse<LibraryType>(command.LibraryType!);
_mockLibraryRepository.GetByIdAsync(command.Id, cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(existingLibrary));
// Act
Result<LibraryResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
await _mockDirectoryScanFingerprintRepository.Received(1).DeleteByLibraryIdAsync(command.Id, Arg.Any<CancellationToken>());
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenHiddenFilesSettingIsAbsent_ShouldKeepTheStoredValue()
{
// Arrange
UpdateLibraryCommand command = _updateLibraryCommandFixture.Create(shouldSkipHiddenFilesAndDirectoriesDuringScan: null);
LibraryEntity existingLibrary = _libraryEntityFixture.Create(
id: command.Id,
userId: _userId,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true);
existingLibrary.LibraryType = Enum.Parse<LibraryType>(command.LibraryType!);
_mockLibraryRepository.GetByIdAsync(command.Id, cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(existingLibrary));
// Act
Result<LibraryResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
await _mockLibraryRepository.Received(1).UpdateAsync(
Arg.Is<LibraryEntity>(library => library.ShouldSkipHiddenFilesAndDirectoriesDuringScan),
Arg.Any<CancellationToken>());
await _mockDirectoryScanFingerprintRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenScanScopeSettingsAreUnchanged_ShouldNotDeleteTheDirectoryScanFingerprints()
{
// Arrange
UpdateLibraryCommand command = _updateLibraryCommandFixture.Create();
LibraryEntity existingLibrary = _libraryEntityFixture.Create(id: command.Id, userId: _userId);
existingLibrary.LibraryType = Enum.Parse<LibraryType>(command.LibraryType!);
_mockLibraryRepository.GetByIdAsync(command.Id, cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(existingLibrary));
// Act
Result<LibraryResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
// Assert
Assert.False(result.IsFailure);
await _mockDirectoryScanFingerprintRepository.DidNotReceive().DeleteByLibraryIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenDeletingTheDirectoryScanFingerprintsFails_ShouldReturnTheErrorAndNotSave()
{
// Arrange
UpdateLibraryCommand command = _updateLibraryCommandFixture.Create(shouldSkipHiddenFilesAndDirectoriesDuringScan: true);
LibraryEntity existingLibrary = _libraryEntityFixture.Create(id: command.Id, userId: _userId);
existingLibrary.LibraryType = Enum.Parse<LibraryType>(command.LibraryType!);
_mockLibraryRepository.GetByIdAsync(command.Id, cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(existingLibrary));
Error deleteError = Error.Failure("Database.Error", "Failed to delete the directory scan fingerprints");
_mockDirectoryScanFingerprintRepository.DeleteByLibraryIdAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>())
.Returns(deleteError);
// Act
Result<LibraryResponse> result = await _sut.HandleAsync(command, CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(deleteError, result.FirstError);
await _mockUnitOfWork.DidNotReceive().SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact] [Fact]
public async Task HandleAsync_WhenThresholdIsSuppliedWhileStoredTrackingIsOff_ShouldReturnThresholdMustBeNullError() public async Task HandleAsync_WhenThresholdIsSuppliedWhileStoredTrackingIsOff_ShouldReturnThresholdMustBeNullError()
{ {
@@ -56,6 +56,7 @@ public class LibraryTests
canDownloadMetadataFromWeb: false, canDownloadMetadataFromWeb: false,
shouldSaveMetadataInMediaDirectories: true, shouldSaveMetadataInMediaDirectories: true,
shouldSkipUnchangedDirectoriesDuringScan: true, shouldSkipUnchangedDirectoriesDuringScan: true,
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
consumptionSettings, consumptionSettings,
LibraryPathTemplate.Empty(), LibraryPathTemplate.Empty(),
@@ -74,6 +75,7 @@ public class LibraryTests
Assert.False(result.Value.CanDownloadMetadataFromWeb); Assert.False(result.Value.CanDownloadMetadataFromWeb);
Assert.True(result.Value.ShouldSaveMetadataInMediaDirectories); Assert.True(result.Value.ShouldSaveMetadataInMediaDirectories);
Assert.True(result.Value.ShouldSkipUnchangedDirectoriesDuringScan); Assert.True(result.Value.ShouldSkipUnchangedDirectoriesDuringScan);
Assert.True(result.Value.ShouldSkipHiddenFilesAndDirectoriesDuringScan);
Assert.True(result.Value.IsContentOnSsd); Assert.True(result.Value.IsContentOnSsd);
Assert.Equal(consumptionSettings, result.Value.ConsumptionSettings); Assert.Equal(consumptionSettings, result.Value.ConsumptionSettings);
Assert.Equal(scanIds, result.Value.ScanIds); Assert.Equal(scanIds, result.Value.ScanIds);
@@ -99,6 +101,7 @@ public class LibraryTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: false,
isContentOnSsd: false, isContentOnSsd: false,
_libraryConsumptionSettingsFixture.Create(), _libraryConsumptionSettingsFixture.Create(),
LibraryPathTemplate.Empty(), LibraryPathTemplate.Empty(),
@@ -128,6 +131,7 @@ public class LibraryTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: false,
isContentOnSsd: false, isContentOnSsd: false,
_libraryConsumptionSettingsFixture.Create(), _libraryConsumptionSettingsFixture.Create(),
LibraryPathTemplate.Empty(), LibraryPathTemplate.Empty(),
@@ -166,6 +170,7 @@ public class LibraryTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: false,
isContentOnSsd: false, isContentOnSsd: false,
_libraryConsumptionSettingsFixture.Create(), _libraryConsumptionSettingsFixture.Create(),
LibraryPathTemplate.Empty(), LibraryPathTemplate.Empty(),
@@ -196,6 +201,7 @@ public class LibraryTests
canDownloadMetadataFromWeb: true, canDownloadMetadataFromWeb: true,
shouldSaveMetadataInMediaDirectories: false, shouldSaveMetadataInMediaDirectories: false,
shouldSkipUnchangedDirectoriesDuringScan: false, shouldSkipUnchangedDirectoriesDuringScan: false,
shouldSkipHiddenFilesAndDirectoriesDuringScan: false,
isContentOnSsd: false, isContentOnSsd: false,
_libraryConsumptionSettingsFixture.Create(), _libraryConsumptionSettingsFixture.Create(),
LibraryPathTemplate.Empty(), LibraryPathTemplate.Empty(),
@@ -179,6 +179,8 @@ public class MusicFileSystemDiscoveryJobTests
// Assert // Assert
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status); Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
_mockFileProviderService.Received(1).GetFilePaths(Arg.Any<FileSystemPathId>(), true);
_mockDirectoryProviderService.Received(1).GetSubdirectoryPaths(Arg.Any<FileSystemPathId>(), true);
await _mockStagingResultsRepository.Received(1).InsertRangeAsync( await _mockStagingResultsRepository.Received(1).InsertRangeAsync(
Arg.Is<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(entities => entities.Count == 1 Arg.Is<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(entities => entities.Count == 1
&& entities.First().Path == AUDIO_FILE_PATH && entities.First().Path == AUDIO_FILE_PATH
@@ -227,6 +229,25 @@ public class MusicFileSystemDiscoveryJobTests
Arg.Any<Func<object, Exception?, string>>()); Arg.Any<Func<object, Exception?, string>>());
} }
[Fact]
public async Task ExecuteAsync_WhenHiddenFilesAndDirectoriesAreSkipped_ShouldAskTheProvidersToExcludeThem()
{
// Arrange
SetupLibrary(shouldSkipHiddenFilesAndDirectoriesDuringScan: true);
SetupDirectory(ROOT_PATH, files: [AUDIO_FILE_PATH], subdirectories: [], shouldIncludeHiddenElements: false);
// Act
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
// Assert
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
_mockFileProviderService.Received(1).GetFilePaths(Arg.Any<FileSystemPathId>(), false);
_mockDirectoryProviderService.Received(1).GetSubdirectoryPaths(Arg.Any<FileSystemPathId>(), false);
await _mockStagingResultsRepository.Received(1).InsertRangeAsync(
Arg.Is<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(entities => entities.Count == 1 && entities.First().Path == AUDIO_FILE_PATH),
Arg.Any<CancellationToken>());
}
[Fact] [Fact]
public async Task ExecuteAsync_WhenTheSubdirectoryHasAudioFiles_ShouldTraverseIntoIt() public async Task ExecuteAsync_WhenTheSubdirectoryHasAudioFiles_ShouldTraverseIntoIt()
{ {
@@ -403,14 +424,16 @@ public class MusicFileSystemDiscoveryJobTests
/// Stubs the media library reader with a library whose single content location is the test root path. /// Stubs the media library reader with a library whose single content location is the test root path.
/// </summary> /// </summary>
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether the library skips the directories that have not changed since the last scan.</param> /// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether the library skips the directories that have not changed since the last scan.</param>
/// <param name="shouldSkipHiddenFilesAndDirectoriesDuringScan">Whether the library skips hidden files and directories.</param>
/// <param name="isContentOnSsd">Whether the content of the library is stored on a solid state drive.</param> /// <param name="isContentOnSsd">Whether the content of the library is stored on a solid state drive.</param>
private void SetupLibrary(bool shouldSkipUnchangedDirectoriesDuringScan = false, bool isContentOnSsd = false) private void SetupLibrary(bool shouldSkipUnchangedDirectoriesDuringScan = false, bool shouldSkipHiddenFilesAndDirectoriesDuringScan = false, bool isContentOnSsd = false)
{ {
LibraryEntity library = _libraryEntityFixture.Create( LibraryEntity library = _libraryEntityFixture.Create(
id: _libraryId.Value, id: _libraryId.Value,
libraryType: LibraryType.Music, libraryType: LibraryType.Music,
contentLocations: [ROOT_PATH], contentLocations: [ROOT_PATH],
shouldSkipUnchangedDirectoriesDuringScan: shouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan: shouldSkipUnchangedDirectoriesDuringScan,
shouldSkipHiddenFilesAndDirectoriesDuringScan: shouldSkipHiddenFilesAndDirectoriesDuringScan,
isContentOnSsd: isContentOnSsd); isContentOnSsd: isContentOnSsd);
_mockLibraryRepository.GetByIdAsync(Arg.Any<Guid>(), cancellationToken: Arg.Any<CancellationToken>()) _mockLibraryRepository.GetByIdAsync(Arg.Any<Guid>(), cancellationToken: Arg.Any<CancellationToken>())
.Returns(Result.From<LibraryEntity?>(library)); .Returns(Result.From<LibraryEntity?>(library));
@@ -422,11 +445,12 @@ public class MusicFileSystemDiscoveryJobTests
/// <param name="directory">The file system path of the directory.</param> /// <param name="directory">The file system path of the directory.</param>
/// <param name="files">The file system paths of the files of the directory.</param> /// <param name="files">The file system paths of the files of the directory.</param>
/// <param name="subdirectories">The file system paths of the subdirectories of the directory.</param> /// <param name="subdirectories">The file system paths of the subdirectories of the directory.</param>
private void SetupDirectory(string directory, string[] files, string[] subdirectories) /// <param name="shouldIncludeHiddenElements">Whether the providers are expected to include hidden elements.</param>
private void SetupDirectory(string directory, string[] files, string[] subdirectories, bool shouldIncludeHiddenElements = true)
{ {
_mockFileProviderService.GetFilePaths(Arg.Is<FileSystemPathId>(path => path.Path == directory), true) _mockFileProviderService.GetFilePaths(Arg.Is<FileSystemPathId>(path => path.Path == directory), shouldIncludeHiddenElements)
.Returns(Result.From<IEnumerable<FileSystemPathId>>([.. files.Select(file => PathId(file))])); .Returns(Result.From<IEnumerable<FileSystemPathId>>([.. files.Select(file => PathId(file))]));
_mockDirectoryProviderService.GetSubdirectoryPaths(Arg.Is<FileSystemPathId>(path => path.Path == directory), true) _mockDirectoryProviderService.GetSubdirectoryPaths(Arg.Is<FileSystemPathId>(path => path.Path == directory), shouldIncludeHiddenElements)
.Returns(Result.From<IEnumerable<FileSystemPathId>>([.. subdirectories.Select(subdirectoryPath => PathId(subdirectoryPath))])); .Returns(Result.From<IEnumerable<FileSystemPathId>>([.. subdirectories.Select(subdirectoryPath => PathId(subdirectoryPath))]));
} }
@@ -87,6 +87,7 @@ public class AddLibraryEndpointTests
{ {
// Arrange // Arrange
AddLibraryRequest request = _addLibraryRequestFixture.Create( AddLibraryRequest request = _addLibraryRequestFixture.Create(
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
shouldTrackConsumptionProgress: true, shouldTrackConsumptionProgress: true,
completionThresholdPercentage: 65); completionThresholdPercentage: 65);
@@ -109,6 +110,7 @@ public class AddLibraryEndpointTests
command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb && command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb &&
command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories && command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories &&
command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan && command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan &&
command.ShouldSkipHiddenFilesAndDirectoriesDuringScan == request.ShouldSkipHiddenFilesAndDirectoriesDuringScan &&
command.IsContentOnSsd == request.IsContentOnSsd && command.IsContentOnSsd == request.IsContentOnSsd &&
command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress && command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress &&
command.CompletionThresholdPercentage == request.CompletionThresholdPercentage), command.CompletionThresholdPercentage == request.CompletionThresholdPercentage),
@@ -87,6 +87,7 @@ public class UpdateLibraryEndpointTests
{ {
// Arrange // Arrange
UpdateLibraryRequest request = _updateLibraryRequestFixture.Create( UpdateLibraryRequest request = _updateLibraryRequestFixture.Create(
shouldSkipHiddenFilesAndDirectoriesDuringScan: true,
isContentOnSsd: true, isContentOnSsd: true,
shouldTrackConsumptionProgress: true, shouldTrackConsumptionProgress: true,
completionThresholdPercentage: 65); completionThresholdPercentage: 65);
@@ -110,6 +111,7 @@ public class UpdateLibraryEndpointTests
command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb && command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb &&
command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories && command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories &&
command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan && command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan &&
command.ShouldSkipHiddenFilesAndDirectoriesDuringScan == request.ShouldSkipHiddenFilesAndDirectoriesDuringScan &&
command.IsContentOnSsd == request.IsContentOnSsd && command.IsContentOnSsd == request.IsContentOnSsd &&
command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress && command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress &&
command.CompletionThresholdPercentage == request.CompletionThresholdPercentage), command.CompletionThresholdPercentage == request.CompletionThresholdPercentage),