diff --git a/docs/manual/managing-libraries/index.md b/docs/manual/managing-libraries/index.md index bffb60d9..cd6b9cca 100644 --- a/docs/manual/managing-libraries/index.md +++ b/docs/manual/managing-libraries/index.md @@ -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. -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 @@ -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)). | | 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 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. | | 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. | @@ -195,7 +196,8 @@ These are per user settings, each user changes their own from the settings page ## 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. -- **`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. - **`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. diff --git a/docs/technical/api/library/management/Api.Libraries.md b/docs/technical/api/library/management/Api.Libraries.md index b3e75170..39aeb88e 100644 --- a/docs/technical/api/library/management/Api.Libraries.md +++ b/docs/technical/api/library/management/Api.Libraries.md @@ -65,6 +65,7 @@ POST api/v1/libraries "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "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 @@ -108,6 +109,7 @@ The `metadataProviders`, `artworkProviders` and `bookReaders` lists configure th "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, @@ -147,6 +149,7 @@ GET api/v1/libraries "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, @@ -187,6 +190,7 @@ GET api/v1/libraries/enabled "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, @@ -226,6 +230,7 @@ GET api/v1/libraries/{id} "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, @@ -257,6 +262,7 @@ PUT api/v1/libraries/{id} "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "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. -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 @@ -297,6 +303,7 @@ The `metadataProviders`, `artworkProviders` and `bookReaders` lists work as for "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, diff --git a/docs/technical/requests/library/management/AddLibrary.http b/docs/technical/requests/library/management/AddLibrary.http index 0a141063..9e26e421 100644 --- a/docs/technical/requests/library/management/AddLibrary.http +++ b/docs/technical/requests/library/management/AddLibrary.http @@ -14,6 +14,7 @@ Content-Type: application/json "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, diff --git a/docs/technical/requests/library/management/UpdateLibrary.http b/docs/technical/requests/library/management/UpdateLibrary.http index 5fc86f8d..2ecc563c 100644 --- a/docs/technical/requests/library/management/UpdateLibrary.http +++ b/docs/technical/requests/library/management/UpdateLibrary.http @@ -15,6 +15,7 @@ Content-Type: application/json "canDownloadMetadataFromWeb": true, "shouldSaveMetadataInMediaDirectories": true, "shouldSkipUnchangedDirectoriesDuringScan": true, + "shouldSkipHiddenFilesAndDirectoriesDuringScan": false, "isContentOnSsd": false, "shouldTrackConsumptionProgress": true, "completionThresholdPercentage": 100, diff --git a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs index 54642985..45cf33a0 100644 --- a/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs +++ b/src/Lumina.Application/Common/DataAccess/Entities/MediaLibrary/Management/LibraryEntity.cs @@ -80,6 +80,11 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity /// public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; } + /// + /// Gets whether hidden files and directories are skipped during the scan of the media library. + /// + public bool ShouldSkipHiddenFilesAndDirectoriesDuringScan { get; init; } + /// /// 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. /// diff --git a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/IDirectoryScanFingerprintRepository.cs b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/IDirectoryScanFingerprintRepository.cs index 9bd6a205..f841639e 100644 --- a/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/IDirectoryScanFingerprintRepository.cs +++ b/src/Lumina.Application/Common/DataAccess/Repositories/MediaLibrary/IDirectoryScanFingerprintRepository.cs @@ -23,6 +23,14 @@ public interface IDirectoryScanFingerprintRepository : IRepositoryAn containing either a path mapped dictionary of directory scan fingerprints, or an error. Task>> GetMappedByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); + /// + /// Deletes all the directory scan fingerprints of the media library identified by . + /// + /// The unique identifier of the library whose directory scan fingerprints are deleted. + /// Cancellation token that can be used to stop the execution. + /// An representing either a successful operation, or an error. + Task> DeleteByLibraryIdAsync(Guid libraryId, CancellationToken cancellationToken); + /// /// Inserts or updates the provided directory scan fingerprints in the storage medium. /// diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs index b9044904..72179010 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/AddMediaLibraryRequestMapping.cs @@ -34,6 +34,7 @@ public static class AddMediaLibraryRequestMapping request.CanDownloadMetadataFromWeb, request.ShouldSaveMetadataInMediaDirectories, request.ShouldSkipUnchangedDirectoriesDuringScan, + request.ShouldSkipHiddenFilesAndDirectoriesDuringScan, request.IsContentOnSsd, request.ShouldTrackConsumptionProgress, request.CompletionThresholdPercentage, diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs index aed072db..02e518fe 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryEntityMapping.cs @@ -36,6 +36,7 @@ public static class LibraryEntityMapping repositoryEntity.CanDownloadMetadataFromWeb, repositoryEntity.ShouldSaveMetadataInMediaDirectories, repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan, + repositoryEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan, repositoryEntity.IsContentOnSsd, repositoryEntity.ShouldTrackConsumptionProgress, repositoryEntity.CompletionThresholdPercentage, @@ -74,6 +75,7 @@ public static class LibraryEntityMapping repositoryEntity.CanDownloadMetadataFromWeb, repositoryEntity.ShouldSaveMetadataInMediaDirectories, repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan, + repositoryEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan, repositoryEntity.IsContentOnSsd, consumptionSettings, pathTemplateResult.Value, diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs index 66fb8536..ff1c6010 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/LibraryMapping.cs @@ -38,6 +38,7 @@ public static class LibraryMapping CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb, ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories, ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan, + ShouldSkipHiddenFilesAndDirectoriesDuringScan = domainEntity.ShouldSkipHiddenFilesAndDirectoriesDuringScan, IsContentOnSsd = domainEntity.IsContentOnSsd, ShouldTrackConsumptionProgress = domainEntity.ConsumptionSettings.ShouldTrackConsumptionProgress, CompletionThresholdPercentage = domainEntity.ConsumptionSettings.CompletionThresholdPercentage.HasValue diff --git a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs index 75add9b6..d0a855d0 100644 --- a/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs +++ b/src/Lumina.Application/Common/Mapping/MediaLibrary/Management/UpdateLibraryRequestMapping.cs @@ -35,6 +35,7 @@ public static class UpdateLibraryRequestMapping request.CanDownloadMetadataFromWeb, request.ShouldSaveMetadataInMediaDirectories, request.ShouldSkipUnchangedDirectoriesDuringScan, + request.ShouldSkipHiddenFilesAndDirectoriesDuringScan, request.IsContentOnSsd, request.ShouldTrackConsumptionProgress, request.CompletionThresholdPercentage, diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs index 92600e28..bf6e6e92 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommand.cs @@ -18,6 +18,7 @@ namespace Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary; /// Whether this media library should update the metadata of its elements from the web, or not. /// Whether this media library should copy the downloaded metadata into the media library content locations, or not. /// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. +/// Whether this media library should skip hidden files and directories during the scan, or not. When absent, the default is off. /// 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. /// Whether the consumption progress of the media library items should be tracked, or not. When absent, the default of the library type is used. /// The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the default of the library type is used on creation. @@ -36,6 +37,7 @@ public record AddLibraryCommand( bool CanDownloadMetadataFromWeb, bool ShouldSaveMetadataInMediaDirectories, bool ShouldSkipUnchangedDirectoriesDuringScan, + bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan, bool IsContentOnSsd, bool? ShouldTrackConsumptionProgress, int? CompletionThresholdPercentage, diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs index 2f6232dd..56b5bea8 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/AddLibrary/AddLibraryCommandHandler.cs @@ -147,6 +147,7 @@ public class AddLibraryCommandHandler : ICommandHandlerWhether this media library should update the metadata of its elements from the web, or not. /// Whether this media library should copy the downloaded metadata into the media library content locations, or not. /// Whether this media library should skip the directories whose contents have not changed since the last scan, during the scan, or not. +/// Whether this media library should skip hidden files and directories during the scan, or not. When absent, the stored value is kept. /// 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. /// Whether the consumption progress of the media library items should be tracked, or not. When absent, the stored value is kept. /// The percentage of a media library item that must be consumed for its session to be considered completed. When absent, the stored value is kept. @@ -39,6 +40,7 @@ public record UpdateLibraryCommand( bool CanDownloadMetadataFromWeb, bool ShouldSaveMetadataInMediaDirectories, bool ShouldSkipUnchangedDirectoriesDuringScan, + bool? ShouldSkipHiddenFilesAndDirectoriesDuringScan, bool IsContentOnSsd, bool? ShouldTrackConsumptionProgress, int? CompletionThresholdPercentage, diff --git a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs index 84209f82..87203440 100644 --- a/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs +++ b/src/Lumina.Application/Core/MediaLibrary/Management/Commands/UpdateLibrary/UpdateLibraryCommandHandler.cs @@ -114,6 +114,13 @@ public class UpdateLibraryCommandHandler : ICommandHandler