mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Merge pull request #257 from BinaryAlley/feature/library-ssd-read-parallelism
Adds per-library SSD content setting to parallelize scan reads
This commit is contained in:
74 files changed
+4850
-1492
No files matched your search
@@ -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. |
|
||||
| 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. |
|
||||
| Path template | the type's ideal structure | Tells Lumina how your folders are arranged on disk. Unless you customize it, it holds the default template of the library type, which is exactly the structure Lumina expects. Optional, and explained in full below. |
|
||||
@@ -119,6 +120,8 @@ Creating a library only records where the media lives. To actually read it, you
|
||||
|
||||
Lumina is designed to be efficient and performant. The first scan of a library reads and indexes everything it finds, so it is the slowest one. Every scan after that compares what is on disk against the previous scan and only processes what is new or changed, so it is normally much faster. How long any scan takes also depends on what is enabled for the library: metadata and artwork providers that fetch data from the web add network time on top of reading the files, and they do it only for the items that need it.
|
||||
|
||||
How the scan reads the files depends on the hardware that stores them. A library whose content is on a solid state drive can discover and hash several files at the same time, so turn on **Content is on SSD** for it. A library on a mechanical hard drive should keep that setting off, because parallel reads make the drive seek back and forth and can make the scan slower. Metadata extraction and artwork resolution still read the files one at a time; this setting only changes file discovery and content hashing.
|
||||
|
||||
Scans run on the server in the background, so once one starts you can close the browser and come back later.
|
||||
|
||||
While a scan is running, its progress is shown live: how far along it is overall, how many items it has processed, and the operation it is currently on. A scan is queued before it starts, then runs, and ends up finished, cancelled or failed. You can cancel a running scan at any time, for one library or for all of them.
|
||||
@@ -190,6 +193,7 @@ These are per user settings, each user changes their own from the settings page
|
||||
|
||||
- **`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.
|
||||
- **`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.
|
||||
- **Deleting a library removes Lumina's catalogue for it.** The files remain, but the metadata and artwork Lumina held for that library do not. Consumption history and resume points are kept as records of what was consumed. The history shows the items as unavailable until you delete it. **Remove from continue watching** removes every resume point of the selected user, not only the ones from the deleted library.
|
||||
|
||||
@@ -65,6 +65,7 @@ POST api/v1/libraries
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": []
|
||||
@@ -92,6 +93,7 @@ POST api/v1/libraries
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [],
|
||||
@@ -130,6 +132,7 @@ GET api/v1/libraries
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [],
|
||||
@@ -169,6 +172,7 @@ GET api/v1/libraries/enabled
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [],
|
||||
@@ -207,6 +211,7 @@ GET api/v1/libraries/{id}
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [],
|
||||
@@ -238,6 +243,7 @@ PUT api/v1/libraries/{id}
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": []
|
||||
@@ -265,6 +271,7 @@ PUT api/v1/libraries/{id}
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [],
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# Architecture Decision Record (ADR): 0019 - SSD Aware Read Parallelism During Media Library Scans
|
||||
|
||||
## Status
|
||||
|
||||
**Accepted** (2026-10-30)
|
||||
|
||||
## Context
|
||||
|
||||
A media library scan performs two kinds of file system reads. Discovery reads directory entries and file metadata, and hashing samples file contents. Their throughput depends on the storage medium. A solid state drive serves concurrent reads with little penalty, while a mechanical hard drive pays a seek for every position change, so concurrent reads can reduce its throughput.
|
||||
|
||||
Lumina cannot determine the storage medium reliably. Drive type queries are platform specific, and they are unreliable for network, virtual, and removable volumes. The scan therefore needs an explicit input instead of an automatic guess.
|
||||
|
||||
Not every scan stage performs bulk local reads. Audio metadata extraction parses tag blocks, and metadata and artwork enrichment call remote providers. Those stages have their own constraints, which are part of this decision.
|
||||
|
||||
## Decision
|
||||
|
||||
Add an `IsContentOnSsd` boolean to the `Library` aggregate, **off by default**. It is stored in the `Libraries` table with a default value of `false` and exposed through the library form and API contracts.
|
||||
|
||||
The setting controls read parallelism in the two stages that perform bulk local reads:
|
||||
|
||||
- **File system discovery**: the book and music discovery jobs read the sizes and last write times of the files of each directory in parallel when the option is on, and sequentially when it is off. Discovered files and directory fingerprints are still merged and written to the repositories sequentially, because the repositories are not thread-safe.
|
||||
- **File hashing**: `MediaLibraryScanHashJob` reads `IsContentOnSsd` without loading the content location or path template graph, and passes it to `IFileHashService.HashFilesAsync`. The service uses `MaxDegreeOfParallelism = Environment.ProcessorCount` when the option is on, and `MaxDegreeOfParallelism = 1` when it is off.
|
||||
|
||||
The following stages keep their current sequencing:
|
||||
|
||||
- **Audio metadata extraction**: extraction and persistence are interleaved on one `IUnitOfWork` and `DbContext`, which is not thread-safe. Parallelizing it requires a bounded producer and consumer split, with extraction on worker threads and all repository writes on one thread.
|
||||
- **Metadata and artwork enrichment**: these stages are network bound, and the providers already have process-wide request throttles. Item level parallelism would mostly queue on those throttles, and it is a provider concurrency concern rather than a storage medium concern.
|
||||
|
||||
The setting does not change the stored catalogue or the result of a scan. It only changes how discovery and hashing read the files, so a change takes effect on the next scan and never requires a rehash of unchanged files.
|
||||
|
||||
## Consequences
|
||||
|
||||
### Positive Outcomes
|
||||
|
||||
| Aspect | Benefit |
|
||||
|---|---|
|
||||
| Explicit choice | The scan never guesses the storage medium from platform specific or unreliable drive queries |
|
||||
| Off by default | Existing libraries keep sequential reads, and mechanical drives are never slowed down by an upgrade |
|
||||
| Bounded memory | Parallel reads are merged before batching, so staging results and directory fingerprints keep their existing batch size and memory profile |
|
||||
| Cheap hashing lookup | The hashing job reads only the scalar setting, without tracking the library or loading its navigation properties |
|
||||
|
||||
### Risks and Tradeoffs
|
||||
|
||||
| Risk | Mitigation Strategy |
|
||||
|---|---|
|
||||
| A user enables the option on a mechanical drive | The option label and description state that it is meant for solid state drives, and the manual repeats the warning |
|
||||
| The option can be forgotten after moving a library to another drive | It is editable on the existing library, and it takes effect on the next scan |
|
||||
| The content locations of one library can be mixed across solid state and mechanical drives | The option describes the library as a whole. Keep it off when any content location is on a mechanical drive, or split the locations into separate libraries when the difference matters |
|
||||
| Parallel metadata reads on a directory with many files allocate the metadata array for that directory | Only one directory is processed at a time, and the array is merged into the existing bounded staging batches as soon as it is ready |
|
||||
| Metadata extraction and enrichment do not benefit from the setting | They are documented as separate stages with their own constraints, and the option description names only file discovery and content hashing |
|
||||
| Discovery reads and hashing run in parallel, but enrichment still waits on provider throttles | The setting is scoped to local read throughput and does not claim to speed up network bound stages |
|
||||
|
||||
## Alternatives Considered
|
||||
|
||||
### 1. Always read in parallel
|
||||
|
||||
Keep the previous `Environment.ProcessorCount` behavior for every scan and do not expose a setting.
|
||||
|
||||
**Rejected**: mechanical drives can become slower with concurrent reads.
|
||||
|
||||
### 2. Detect the storage medium automatically
|
||||
|
||||
Query the operating system for the drive type of each content location and choose the parallelism accordingly.
|
||||
|
||||
**Rejected**: the detection is platform specific, unreliable for network and virtual volumes, and would hide the choice from the user.
|
||||
|
||||
### 3. Parallelize metadata extraction and enrichment under the same setting
|
||||
|
||||
Use the same flag to parallelize audio metadata extraction, metadata enrichment, and artwork resolution.
|
||||
|
||||
**Rejected for now**: extraction needs a bounded producer and consumer refactor around the non-thread-safe `DbContext`, and enrichment is network bound behind process-wide provider throttles. Both are separate concerns from the read behavior of the storage medium.
|
||||
@@ -14,6 +14,7 @@ Content-Type: application/json
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [
|
||||
|
||||
@@ -16,6 +16,7 @@ Content-Type: application/json
|
||||
"canDownloadMetadataFromWeb": true,
|
||||
"shouldSaveMetadataInMediaDirectories": true,
|
||||
"shouldSkipUnchangedDirectoriesDuringScan": true,
|
||||
"isContentOnSsd": false,
|
||||
"shouldTrackConsumptionProgress": true,
|
||||
"completionThresholdPercentage": 100,
|
||||
"pathTemplateParts": [
|
||||
|
||||
+5
@@ -80,6 +80,11 @@ public class LibraryEntity : IStorageEntity, IAuditableEntity
|
||||
/// </summary>
|
||||
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; init; }
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public bool IsContentOnSsd { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the consumption progress of the media library items is tracked.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,10 +17,11 @@ public interface IFileHashService
|
||||
/// Hashes <paramref name="files"/> by sampling chunks from them.
|
||||
/// </summary>
|
||||
/// <param name="files">The collection of files to hash.</param>
|
||||
/// <param name="shouldParallelizeReads">Whether the files should be read in parallel. Parallel reads benefit solid state drives, while mechanical hard drives are faster with sequential reads.</param>
|
||||
/// <param name="callback">Callback to invoke during processing of elements.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>A collection of the hashed files, along with their hashes.</returns>
|
||||
Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> files, Func<Task> callback, CancellationToken cancellationToken);
|
||||
Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> files, bool shouldParallelizeReads, Func<Task> callback, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Computes the content hash of the file stored at <paramref name="filePath"/>, by sampling chunks from it.
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ public static class AddMediaLibraryRequestMapping
|
||||
request.CanDownloadMetadataFromWeb,
|
||||
request.ShouldSaveMetadataInMediaDirectories,
|
||||
request.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
request.IsContentOnSsd,
|
||||
request.ShouldTrackConsumptionProgress,
|
||||
request.CompletionThresholdPercentage,
|
||||
request.PathTemplateParts?.Select(part => new LibraryPathTemplatePartDto(part.Kind, part.Representation, part.IsOptional)).ToArray()
|
||||
|
||||
@@ -36,6 +36,7 @@ public static class LibraryEntityMapping
|
||||
repositoryEntity.CanDownloadMetadataFromWeb,
|
||||
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
|
||||
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
repositoryEntity.IsContentOnSsd,
|
||||
repositoryEntity.ShouldTrackConsumptionProgress,
|
||||
repositoryEntity.CompletionThresholdPercentage,
|
||||
[.. repositoryEntity.PathTemplateParts
|
||||
@@ -73,6 +74,7 @@ public static class LibraryEntityMapping
|
||||
repositoryEntity.CanDownloadMetadataFromWeb,
|
||||
repositoryEntity.ShouldSaveMetadataInMediaDirectories,
|
||||
repositoryEntity.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
repositoryEntity.IsContentOnSsd,
|
||||
consumptionSettings,
|
||||
pathTemplateResult.Value,
|
||||
[.. repositoryEntity.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id))]
|
||||
|
||||
@@ -39,6 +39,7 @@ public static class LibraryMapping
|
||||
CanDownloadMetadataFromWeb = domainEntity.CanDownloadMetadataFromWeb,
|
||||
ShouldSaveMetadataInMediaDirectories = domainEntity.ShouldSaveMetadataInMediaDirectories,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan = domainEntity.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
IsContentOnSsd = domainEntity.IsContentOnSsd,
|
||||
ShouldTrackConsumptionProgress = domainEntity.ConsumptionSettings.ShouldTrackConsumptionProgress,
|
||||
CompletionThresholdPercentage = domainEntity.ConsumptionSettings.CompletionThresholdPercentage.HasValue
|
||||
? domainEntity.ConsumptionSettings.CompletionThresholdPercentage.Value
|
||||
|
||||
+1
@@ -31,6 +31,7 @@ public static class UpdateLibraryRequestMapping
|
||||
request.CanDownloadMetadataFromWeb,
|
||||
request.ShouldSaveMetadataInMediaDirectories,
|
||||
request.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
request.IsContentOnSsd,
|
||||
request.ShouldTrackConsumptionProgress,
|
||||
request.CompletionThresholdPercentage,
|
||||
request.PathTemplateParts?.Select(part => new LibraryPathTemplatePartDto(part.Kind, part.Representation, part.IsOptional)).ToArray()
|
||||
|
||||
+2
@@ -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="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="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="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="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk.</param>
|
||||
@@ -32,6 +33,7 @@ public record AddLibraryCommand(
|
||||
bool CanDownloadMetadataFromWeb,
|
||||
bool ShouldSaveMetadataInMediaDirectories,
|
||||
bool ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool IsContentOnSsd,
|
||||
bool? ShouldTrackConsumptionProgress,
|
||||
int? CompletionThresholdPercentage,
|
||||
LibraryPathTemplatePartDto[]? PathTemplateParts
|
||||
|
||||
+1
@@ -147,6 +147,7 @@ public class AddLibraryCommandHandler : ICommandHandler<AddLibraryCommand, Resul
|
||||
command.CanDownloadMetadataFromWeb,
|
||||
command.ShouldSaveMetadataInMediaDirectories,
|
||||
command.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
command.IsContentOnSsd,
|
||||
consumptionSettings,
|
||||
pathTemplateResult.Value,
|
||||
[]
|
||||
|
||||
+2
@@ -21,6 +21,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="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="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="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="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk.</param>
|
||||
@@ -37,6 +38,7 @@ public record UpdateLibraryCommand(
|
||||
bool CanDownloadMetadataFromWeb,
|
||||
bool ShouldSaveMetadataInMediaDirectories,
|
||||
bool ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool IsContentOnSsd,
|
||||
bool? ShouldTrackConsumptionProgress,
|
||||
int? CompletionThresholdPercentage,
|
||||
LibraryPathTemplatePartDto[]? PathTemplateParts
|
||||
|
||||
+1
@@ -169,6 +169,7 @@ public class UpdateLibraryCommandHandler : ICommandHandler<UpdateLibraryCommand,
|
||||
command.CanDownloadMetadataFromWeb,
|
||||
command.ShouldSaveMetadataInMediaDirectories,
|
||||
command.ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
command.IsContentOnSsd,
|
||||
consumptionSettings,
|
||||
pathTemplateResult.Value,
|
||||
[.. getLibraryResult.Value.LibraryScans.Select(libraryScan => ScanId.Create(libraryScan.Id))]
|
||||
|
||||
@@ -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. Optional.</param>
|
||||
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not. Optional.</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. Optional.</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. Optional.</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="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.</param>
|
||||
@@ -30,6 +31,7 @@ public record AddLibraryRequest(
|
||||
bool CanDownloadMetadataFromWeb,
|
||||
bool ShouldSaveMetadataInMediaDirectories,
|
||||
bool ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool IsContentOnSsd,
|
||||
bool? ShouldTrackConsumptionProgress,
|
||||
int? CompletionThresholdPercentage,
|
||||
LibraryPathTemplatePartRequest[]? PathTemplateParts
|
||||
|
||||
@@ -19,6 +19,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. Optional.</param>
|
||||
/// <param name="ShouldSaveMetadataInMediaDirectories">Whether this media library should copy the downloaded metadata into the media library content locations, or not.
|
||||
/// <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. Optional.</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. Optional.</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="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.</param>
|
||||
@@ -35,6 +36,7 @@ public record class UpdateLibraryRequest(
|
||||
bool CanDownloadMetadataFromWeb,
|
||||
bool ShouldSaveMetadataInMediaDirectories,
|
||||
bool ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool IsContentOnSsd,
|
||||
bool? ShouldTrackConsumptionProgress,
|
||||
int? CompletionThresholdPercentage,
|
||||
LibraryPathTemplatePartRequest[]? PathTemplateParts
|
||||
|
||||
@@ -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="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="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="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="PathTemplateParts">The ordered parts of the template describing the structure of the media library on disk.</param>
|
||||
@@ -39,6 +40,7 @@ public record LibraryResponse(
|
||||
bool CanDownloadMetadataFromWeb,
|
||||
bool ShouldSaveMetadataInMediaDirectories,
|
||||
bool ShouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool IsContentOnSsd,
|
||||
bool ShouldTrackConsumptionProgress,
|
||||
int? CompletionThresholdPercentage,
|
||||
List<LibraryPathTemplatePartResponse> PathTemplateParts,
|
||||
|
||||
@@ -79,6 +79,10 @@ public class LibraryConfiguration : IEntityTypeConfiguration<LibraryEntity>
|
||||
.HasDefaultValue(null)
|
||||
.HasColumnOrder(17);
|
||||
|
||||
builder.Property(library => library.IsContentOnSsd)
|
||||
.HasDefaultValue(false)
|
||||
.HasColumnOrder(18);
|
||||
|
||||
// one user with many libraries
|
||||
builder.HasOne(library => library.User)
|
||||
.WithMany(user => user.Libraries)
|
||||
|
||||
Generated
+3902
File diff suppressed because it is too large.
Load diff
+30
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Lumina.DataAccess.Common.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddsIsContentOnSsdToLibraries : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsContentOnSsd",
|
||||
table: "Libraries",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: false)
|
||||
.Annotation("Relational:ColumnOrder", 18);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsContentOnSsd",
|
||||
table: "Libraries");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1521,6 +1521,12 @@ namespace Lumina.DataAccess.Common.Migrations
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnOrder(12);
|
||||
|
||||
b.Property<bool>("IsContentOnSsd")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
.HasDefaultValue(false)
|
||||
.HasColumnOrder(18);
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER")
|
||||
|
||||
+15
@@ -76,6 +76,12 @@ public class Library : AggregateRoot<LibraryId>
|
||||
/// </summary>
|
||||
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; private set; }
|
||||
|
||||
/// <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,
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public bool IsContentOnSsd { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the consumption settings of the media library.
|
||||
/// </summary>
|
||||
@@ -111,6 +117,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="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="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="pathTemplate">The template describing the structure of the media library on disk.</param>
|
||||
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
|
||||
@@ -126,6 +133,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
bool canDownloadMetadataFromWeb,
|
||||
bool shouldSaveMetadataInMediaDirectories,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool isContentOnSsd,
|
||||
LibraryConsumptionSettings consumptionSettings,
|
||||
LibraryPathTemplate pathTemplate,
|
||||
List<ScanId> scanIds) : base(id)
|
||||
@@ -140,6 +148,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb;
|
||||
ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories;
|
||||
ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan;
|
||||
IsContentOnSsd = isContentOnSsd;
|
||||
ConsumptionSettings = consumptionSettings;
|
||||
PathTemplate = pathTemplate;
|
||||
_scanIds = scanIds;
|
||||
@@ -158,6 +167,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="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="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="pathTemplate">The template describing the structure of the media library on disk.</param>
|
||||
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
|
||||
@@ -175,6 +185,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
bool canDownloadMetadataFromWeb,
|
||||
bool shouldSaveMetadataInMediaDirectories,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool isContentOnSsd,
|
||||
LibraryConsumptionSettings consumptionSettings,
|
||||
LibraryPathTemplate pathTemplate,
|
||||
List<ScanId> scanIds)
|
||||
@@ -200,6 +211,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
isContentOnSsd,
|
||||
consumptionSettings,
|
||||
pathTemplate,
|
||||
scanIds
|
||||
@@ -220,6 +232,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="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="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="pathTemplate">The template describing the structure of the media library on disk.</param>
|
||||
/// <param name="scanIds">The list of objects representing the unique identifier of scans of the media library.</param>
|
||||
@@ -238,6 +251,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
bool canDownloadMetadataFromWeb,
|
||||
bool shouldSaveMetadataInMediaDirectories,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan,
|
||||
bool isContentOnSsd,
|
||||
LibraryConsumptionSettings consumptionSettings,
|
||||
LibraryPathTemplate pathTemplate,
|
||||
List<ScanId> scanIds)
|
||||
@@ -263,6 +277,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
isContentOnSsd,
|
||||
consumptionSettings,
|
||||
pathTemplate,
|
||||
scanIds
|
||||
|
||||
+126
-33
@@ -15,11 +15,13 @@ using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Library
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Common;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -41,6 +43,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
StringComparer.OrdinalIgnoreCase
|
||||
);
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
private readonly ILogger<MusicFileSystemDiscoveryJob> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MusicFileSystemDiscoveryJob"/> class.
|
||||
@@ -49,9 +52,11 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
/// Injected factory for creating scopes in which services are requested.
|
||||
/// See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details.
|
||||
/// </param>
|
||||
public MusicFileSystemDiscoveryJob(IServiceScopeFactory serviceScopeFactory)
|
||||
/// <param name="logger">Injected logger for the media library scan job.</param>
|
||||
public MusicFileSystemDiscoveryJob(IServiceScopeFactory serviceScopeFactory, ILogger<MusicFileSystemDiscoveryJob> logger)
|
||||
{
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -116,6 +121,11 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch = [];
|
||||
List<DirectoryScanFingerprintEntity> fingerprintBatch = [];
|
||||
|
||||
// When the library content is stored on a solid state drive, the file system reads of the scan run in parallel.
|
||||
bool shouldParallelizeReads = domainLibraryResult.Value.IsContentOnSsd;
|
||||
if (shouldParallelizeReads)
|
||||
_logger.LogDebug("The content of the media library with Id '{LibraryId}' is stored on a solid state drive, so its file system reads will run in parallel.", LibraryId.Value);
|
||||
|
||||
// Get the files for each of the media library content locations.
|
||||
foreach (FileSystemPathId contentLocation in domainLibraryResult.Value.ContentLocations)
|
||||
{
|
||||
@@ -126,6 +136,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
fileProviderService,
|
||||
directoryProviderService,
|
||||
fingerprintsByPath is not null,
|
||||
shouldParallelizeReads,
|
||||
fingerprintsByPath,
|
||||
stagingBatch,
|
||||
fingerprintBatch,
|
||||
@@ -189,6 +200,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
/// <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="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="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="stagingBatch">The batch of discovered files that is written to the staging results when it reaches the batch size.</param>
|
||||
/// <param name="fingerprintBatch">The batch of directory scan fingerprints that is written to the storage medium when it reaches the batch size.</param>
|
||||
@@ -204,6 +216,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
IFileProviderService fileProviderService,
|
||||
IDirectoryProviderService directoryProviderService,
|
||||
bool shouldSkipUnchangedDirectories,
|
||||
bool shouldParallelizeReads,
|
||||
Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath,
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch,
|
||||
List<DirectoryScanFingerprintEntity> fingerprintBatch,
|
||||
@@ -258,40 +271,24 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
Result<IEnumerable<FileSystemPathId>> getFilesResult = fileProviderService.GetFilePaths(currentDirectory, true);
|
||||
if (getFilesResult.IsSuccess)
|
||||
{
|
||||
foreach (FileSystemPathId filePath in getFilesResult.Value)
|
||||
if (shouldParallelizeReads)
|
||||
await StageFilesInParallelAsync(getFilesResult.Value, fileProviderService, stagingBatch, stagingResultsRepository, cancellationToken).ConfigureAwait(false);
|
||||
else
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (!s_audioExtensions.Contains(Path.GetExtension(filePath.Path)))
|
||||
continue;
|
||||
|
||||
long size = 0;
|
||||
Result<long?> getSizeResult = fileProviderService.GetSize(filePath);
|
||||
if (getSizeResult.IsSuccess && getSizeResult.Value.HasValue)
|
||||
size = getSizeResult.Value.Value;
|
||||
|
||||
long ticks = 0;
|
||||
Result<Optional<DateTime>> getFileLastWriteTimeResult = fileProviderService.GetLastWriteTime(filePath);
|
||||
if (getFileLastWriteTimeResult.IsSuccess && getFileLastWriteTimeResult.Value.HasValue)
|
||||
ticks = getFileLastWriteTimeResult.Value.Value.Ticks;
|
||||
|
||||
stagingBatch.Add(new LibraryScanStagingResultsEntity()
|
||||
foreach (FileSystemPathId filePath in getFilesResult.Value)
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = filePath.Path,
|
||||
Size = size,
|
||||
Ticks = ticks,
|
||||
ContentHash = 0,
|
||||
PreviousContentHash = 0,
|
||||
NeedsRehash = true,
|
||||
IsNew = true
|
||||
});
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (!s_audioExtensions.Contains(Path.GetExtension(filePath.Path)))
|
||||
continue;
|
||||
|
||||
stagingBatch.Add(CreateStagingResult(filePath, fileProviderService));
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,6 +306,102 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the metadata of <paramref name="filePaths"/> in parallel and writes the discovered music files in batches to the staging results.
|
||||
/// </summary>
|
||||
/// <param name="filePaths">The file paths of the current directory.</param>
|
||||
/// <param name="fileProviderService">The service used to read the metadata of a file.</param>
|
||||
/// <param name="stagingBatch">The batch of discovered files that is written to the staging results when it reaches the batch size.</param>
|
||||
/// <param name="stagingResultsRepository">The repository used to write the discovered files to the staging results.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
private async Task StageFilesInParallelAsync(
|
||||
IEnumerable<FileSystemPathId> filePaths,
|
||||
IFileProviderService fileProviderService,
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch,
|
||||
ILibraryScanStagingResultsRepository stagingResultsRepository,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
List<FileSystemPathId> filesToProcess = [.. filePaths.Where(filePath => s_audioExtensions.Contains(Path.GetExtension(filePath.Path)))];
|
||||
LibraryScanStagingResultsEntity?[] discoveredFiles = new LibraryScanStagingResultsEntity?[filesToProcess.Count];
|
||||
ParallelOptions parallelOptions = new()
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
Parallel.For(0, filesToProcess.Count, parallelOptions, index =>
|
||||
{
|
||||
try
|
||||
{
|
||||
discoveredFiles[index] = CreateStagingResult(filesToProcess[index], fileProviderService);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
// A file might become inaccessible between enumeration and processing, so it is skipped.
|
||||
_logger.LogWarning(ex, "Failed to read the metadata of the music file '{Path}', so it is skipped for this scan.", filesToProcess[index].Path);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (AggregateException aggregateException)
|
||||
{
|
||||
// Parallel.For wraps the exceptions thrown by its body, so the real cause is rethrown here, to keep the reported scan failure meaningful.
|
||||
AggregateException flattenedException = aggregateException.Flatten();
|
||||
if (flattenedException.InnerExceptions.Count == 1)
|
||||
ExceptionDispatchInfo.Capture(flattenedException.InnerExceptions[0]).Throw();
|
||||
throw new AggregateException(string.Join("; ", flattenedException.InnerExceptions.Select(exception => exception.Message)), flattenedException.InnerExceptions);
|
||||
}
|
||||
|
||||
// The repository is not thread-safe, so the discovered files are written sequentially, in bounded batches.
|
||||
foreach (LibraryScanStagingResultsEntity? discoveredFile in discoveredFiles)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (discoveredFile is null)
|
||||
continue;
|
||||
stagingBatch.Add(discoveredFile);
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a staging result entity from a discovered music file.
|
||||
/// </summary>
|
||||
/// <param name="filePath">The discovered music file.</param>
|
||||
/// <param name="fileProviderService">The service used to read the metadata of a file.</param>
|
||||
/// <returns>The staging result entity of the file.</returns>
|
||||
private LibraryScanStagingResultsEntity CreateStagingResult(FileSystemPathId filePath, IFileProviderService fileProviderService)
|
||||
{
|
||||
long size = 0;
|
||||
Result<long?> getSizeResult = fileProviderService.GetSize(filePath);
|
||||
if (getSizeResult.IsSuccess && getSizeResult.Value.HasValue)
|
||||
size = getSizeResult.Value.Value;
|
||||
|
||||
long ticks = 0;
|
||||
Result<Optional<DateTime>> getFileLastWriteTimeResult = fileProviderService.GetLastWriteTime(filePath);
|
||||
if (getFileLastWriteTimeResult.IsSuccess && getFileLastWriteTimeResult.Value.HasValue)
|
||||
ticks = getFileLastWriteTimeResult.Value.Value.Ticks;
|
||||
|
||||
return new LibraryScanStagingResultsEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = filePath.Path,
|
||||
Size = size,
|
||||
Ticks = ticks,
|
||||
ContentHash = 0,
|
||||
PreviousContentHash = 0,
|
||||
NeedsRehash = true,
|
||||
IsNew = true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes a job progress update.
|
||||
/// </summary>
|
||||
|
||||
+32
-17
@@ -1,19 +1,19 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.MediaLibraryScanJobPayloads;
|
||||
using Lumina.Application.Common.Infrastructure.Security;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Services.Jobs;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.MediaLibraryScanJobPayloads;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Common;
|
||||
@@ -23,7 +23,7 @@ namespace Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Commo
|
||||
/// </summary>
|
||||
internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibraryScanHashJob
|
||||
{
|
||||
private const int HASHING_PAGE_SIZE = 1000; // the number of files that are hashed and written back in a single batch, keeping the peak memory bounded regardless of the library size
|
||||
private const int HASHING_PAGE_SIZE = 1000; // The number of files that are hashed and written back in a single batch, keeping the peak memory bounded regardless of the library size.
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
|
||||
/// <summary>
|
||||
@@ -49,9 +49,9 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
{
|
||||
try
|
||||
{
|
||||
// increment the number of parents that finished their execution and called this job (beware race conditions, jobs run in parallel)
|
||||
// Increment the number of parents that finished their execution and called this job (beware race conditions, jobs run in parallel).
|
||||
int parentsCompleted = Interlocked.Increment(ref parentsPayloadsExecuted);
|
||||
// only execute this job's payload when it has no parents, or when all the parents finished their execution
|
||||
// Only execute this job's payload when it has no parents, or when all the parents finished their execution.
|
||||
if (Parents.Count == 0 || parentsCompleted == Parents.Count)
|
||||
{
|
||||
// this needs to be wrapped in a task because even though this job is processed in a "fire and forget" async manner, it still does synchronous
|
||||
@@ -59,7 +59,7 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
Status = LibraryScanJobStatus.Running;
|
||||
// see docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details:
|
||||
// See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details:
|
||||
await using AsyncServiceScope asyncServiceScope = _serviceScopeFactory.CreateAsyncScope();
|
||||
IUnitOfWork unitOfWork = asyncServiceScope.ServiceProvider.GetService<IUnitOfWork>()!;
|
||||
IDomainEventPublisher domainEventPublisher = asyncServiceScope.ServiceProvider.GetService<IDomainEventPublisher>()!;
|
||||
@@ -74,7 +74,22 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
throw new InvalidOperationException(getFilesToHashCountResult.FirstError.Description);
|
||||
int totalFilesToHash = getFilesToHashCountResult.Value;
|
||||
|
||||
// set the initial progress of the scan job
|
||||
// Get the library only when there are files to hash, and only the scalar values needed to know whether its content is stored on a solid state drive,.
|
||||
// in which case the file reads run in parallel.
|
||||
bool shouldParallelizeReads = false;
|
||||
if (totalFilesToHash > 0)
|
||||
{
|
||||
Result<LibraryEntity?> getLibraryResult = await unitOfWork.LibraryRepository.GetByIdAsync(
|
||||
LibraryId.Value,
|
||||
shouldIncludeNavigationProperties: false,
|
||||
shouldTrackEntities: false,
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (getLibraryResult.IsFailure || getLibraryResult.Value is null)
|
||||
throw new InvalidOperationException(getLibraryResult.IsFailure ? getLibraryResult.FirstError.Description : "The media library was not found.");
|
||||
shouldParallelizeReads = getLibraryResult.Value.IsContentOnSsd;
|
||||
}
|
||||
|
||||
// Set the initial progress of the scan job.
|
||||
Result<Success> publishJobProgressResult = await PublishJobProgressAsync(domainEventPublisher, compositeKey, 0, totalFilesToHash, cancellationToken).ConfigureAwait(false);
|
||||
if (publishJobProgressResult.IsFailure)
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
@@ -84,7 +99,7 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
int processedFilesCount = 0;
|
||||
string? lastPath = null;
|
||||
|
||||
// process the files that need hashing in pages, keeping the peak memory bounded regardless of the library size
|
||||
// Process the files that need hashing in pages, keeping the peak memory bounded regardless of the library size.
|
||||
while (true)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -96,14 +111,14 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
if (filesToHashPage.Count == 0)
|
||||
break;
|
||||
|
||||
// hash the files of the current page in parallel, invoking the progress callback before each file
|
||||
List<HashedFileSystemFileDto> hashedFiles = await fileHashService.HashFilesAsync(filesToHashPage, async () =>
|
||||
// Hash the files of the current page in parallel, invoking the progress callback before each file.
|
||||
List<HashedFileSystemFileDto> hashedFiles = await fileHashService.HashFilesAsync(filesToHashPage, shouldParallelizeReads, async () =>
|
||||
{
|
||||
// check if enough time has passed since last update
|
||||
// Check if enough time has passed since last update.
|
||||
DateTime now = DateTime.UtcNow;
|
||||
if ((now - lastUpdateTime).TotalMilliseconds >= minUpdateIntervalMs)
|
||||
{
|
||||
// increment the number of processed elements progress
|
||||
// Increment the number of processed elements progress.
|
||||
publishJobProgressResult = await PublishJobProgressAsync(domainEventPublisher, compositeKey, Interlocked.Increment(ref processedFilesCount), totalFilesToHash, cancellationToken).ConfigureAwait(false);
|
||||
if (publishJobProgressResult.IsFailure)
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
@@ -111,7 +126,7 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
}
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// write the computed hashes back to the staging results
|
||||
// Write the computed hashes back to the staging results.
|
||||
Result<Updated> updateHashesResult = await unitOfWork.LibraryScanStagingResultsRepository.UpdateFileHashesAsync(ScanId.Value, hashedFiles, cancellationToken).ConfigureAwait(false);
|
||||
if (updateHashesResult.IsFailure)
|
||||
throw new InvalidOperationException(updateHashesResult.FirstError.Description);
|
||||
@@ -119,11 +134,11 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
lastPath = filesToHashPage[^1].Path;
|
||||
}
|
||||
|
||||
// this job finished, increment the number of processed jobs progress
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// call each linked child with the obtained payload
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
await child.ExecuteAsync(id, input, cancellationToken).ConfigureAwait(false);
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+137
-53
@@ -1,25 +1,26 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Events;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.Services.Jobs;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.Services.Jobs;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Common;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -31,7 +32,7 @@ namespace Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Writt
|
||||
/// </summary>
|
||||
internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksFileSystemDiscoveryJob
|
||||
{
|
||||
private const int STAGING_BATCH_SIZE = 1000; // the number of discovered files that are written to the staging results in a single batch, keeping the peak memory bounded regardless of the library size
|
||||
private const int STAGING_BATCH_SIZE = 1000; // The number of discovered files that are written to the staging results in a single batch, keeping the peak memory bounded regardless of the library size.
|
||||
private static readonly HashSet<string> s_bookExtensions = new(
|
||||
[
|
||||
".pdf", ".epub", ".mobi", ".azw", ".azw3",
|
||||
@@ -42,11 +43,12 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
);
|
||||
private static readonly EnumerationOptions s_enumerationOptions = 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,
|
||||
RecurseSubdirectories = false
|
||||
};
|
||||
private readonly IServiceScopeFactory _serviceScopeFactory;
|
||||
private readonly ILogger<BooksFileSystemDiscoveryJob> _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BooksFileSystemDiscoveryJob"/> class.
|
||||
@@ -55,9 +57,11 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
/// Injected factory for creating scopes in which services are requested.
|
||||
/// See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details.
|
||||
/// </param>
|
||||
public BooksFileSystemDiscoveryJob(IServiceScopeFactory serviceScopeFactory)
|
||||
/// <param name="logger">Injected logger for the media library scan job.</param>
|
||||
public BooksFileSystemDiscoveryJob(IServiceScopeFactory serviceScopeFactory, ILogger<BooksFileSystemDiscoveryJob> logger)
|
||||
{
|
||||
_serviceScopeFactory = serviceScopeFactory;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -71,34 +75,34 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
{
|
||||
try
|
||||
{
|
||||
// increment the number of parents that finished their execution and called this job (beware race conditions, jobs run in parallel)
|
||||
// Increment the number of parents that finished their execution and called this job (beware race conditions, jobs run in parallel).
|
||||
int parentsCompleted = Interlocked.Increment(ref parentsPayloadsExecuted);
|
||||
// only execute this job's payload when it has no parents, or when all the parents finished their execution
|
||||
if (Parents.Count == 0 || parentsCompleted == Parents.Count)
|
||||
{
|
||||
// this needs to be wrapped in a task because even though this job is processed in a "fire and forget" async manner, it still does synchronous
|
||||
// file system processing that takes time, and would block the processing of scan jobs in the in-memory queue
|
||||
// This needs to be wrapped in a task because even though this job is processed in a "fire and forget" async manner, it still does synchronous
|
||||
// file system processing that takes time, and would block the processing of scan jobs in the in-memory queue.
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
Status = LibraryScanJobStatus.Running;
|
||||
// see docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details:
|
||||
// See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0001.md for details:
|
||||
await using AsyncServiceScope asyncServiceScope = _serviceScopeFactory.CreateAsyncScope();
|
||||
IUnitOfWork unitOfWork = asyncServiceScope.ServiceProvider.GetService<IUnitOfWork>()!;
|
||||
IDomainEventPublisher domainEventPublisher = asyncServiceScope.ServiceProvider.GetService<IDomainEventPublisher>()!;
|
||||
|
||||
MediaLibraryScanCompositeId compositeKey = MediaLibraryScanCompositeId.Create(ScanId, UserId);
|
||||
|
||||
// get the library from the repository
|
||||
// Get the library from the repository.
|
||||
Result<LibraryEntity?> getLibraryResult = await unitOfWork.LibraryRepository.GetByIdAsync(LibraryId.Value, cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
if (getLibraryResult.IsFailure || getLibraryResult.Value is null)
|
||||
throw new InvalidOperationException(getLibraryResult.IsFailure ? getLibraryResult.FirstError.Description : "The media library was not found.");
|
||||
|
||||
// convert it to a domain object
|
||||
// Convert it to a domain object.
|
||||
Result<Library> domainLibraryResult = getLibraryResult.Value.ToDomainEntity();
|
||||
if (domainLibraryResult.IsFailure)
|
||||
throw new InvalidOperationException(domainLibraryResult.FirstError.Description);
|
||||
|
||||
// when the fast skip is enabled, load the directory scan fingerprints of the library, used to skip the directories that have not changed since the last scan
|
||||
// When the fast skip is enabled, load the directory scan fingerprints of the library, used to skip the directories that have not changed since the last scan.
|
||||
Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath = null;
|
||||
if (domainLibraryResult.Value.ShouldSkipUnchangedDirectoriesDuringScan)
|
||||
{
|
||||
@@ -108,7 +112,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
fingerprintsByPath = getFingerprintsResult.Value;
|
||||
}
|
||||
|
||||
// set the initial progress of the scan job
|
||||
// Set the initial progress of the scan job.
|
||||
Result<Success> publishJobProgressResult = await PublishJobProgressAsync(domainEventPublisher, compositeKey, 0, domainLibraryResult.Value.ContentLocations.Count, cancellationToken).ConfigureAwait(false);
|
||||
if (publishJobProgressResult.IsFailure)
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
@@ -120,7 +124,12 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch = [];
|
||||
List<DirectoryScanFingerprintEntity> fingerprintBatch = [];
|
||||
|
||||
// get the files for each of the media library content locations
|
||||
// When the library content is stored on a solid state drive, the file system reads of the scan run in parallel.
|
||||
bool shouldParallelizeReads = domainLibraryResult.Value.IsContentOnSsd;
|
||||
if (shouldParallelizeReads)
|
||||
_logger.LogDebug("The content of the media library with Id '{LibraryId}' is stored on a solid state drive, so its file system reads will run in parallel.", LibraryId.Value);
|
||||
|
||||
// Get the files for each of the media library content locations.
|
||||
foreach (FileSystemPathId contentLocation in domainLibraryResult.Value.ContentLocations)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -128,6 +137,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
await DiscoverContentLocationAsync(
|
||||
contentLocation.Path,
|
||||
fingerprintsByPath is not null,
|
||||
shouldParallelizeReads,
|
||||
fingerprintsByPath,
|
||||
stagingBatch,
|
||||
fingerprintBatch,
|
||||
@@ -136,7 +146,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
processedContentLocations++;
|
||||
|
||||
// increment the number of processed elements progress in a high-frequency counter with low overhead check
|
||||
// Increment the number of processed elements progress in a high-frequency counter with low overhead check.
|
||||
DateTime now = DateTime.UtcNow;
|
||||
if (now - lastHeartbeat >= heartbeatInterval)
|
||||
{
|
||||
@@ -148,7 +158,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
}
|
||||
}
|
||||
|
||||
// flush any remaining discovered files and directory scan fingerprints that did not reach the batch size
|
||||
// Flush any remaining discovered files and directory scan fingerprints that did not reach the batch size.
|
||||
if (stagingBatch.Count > 0)
|
||||
{
|
||||
Result<Created> insertResult = await unitOfWork.LibraryScanStagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
@@ -162,11 +172,11 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
throw new InvalidOperationException(upsertResult.FirstError.Description);
|
||||
}
|
||||
|
||||
// this job finished, increment the number of processed jobs progress
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// call each linked child with the obtained payload
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
await child.ExecuteAsync(id, input, cancellationToken).ConfigureAwait(false);
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
@@ -189,6 +199,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
/// </summary>
|
||||
/// <param name="rootDirectoryPath">The path of the root directory from which to start collecting files.</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="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="stagingBatch">The batch of discovered files that is written to the staging results when it reaches the batch size.</param>
|
||||
/// <param name="fingerprintBatch">The batch of directory scan fingerprints that is written to the storage medium when it reaches the batch size.</param>
|
||||
@@ -202,6 +213,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
private async Task DiscoverContentLocationAsync(
|
||||
string rootDirectoryPath,
|
||||
bool shouldSkipUnchangedDirectories,
|
||||
bool shouldParallelizeReads,
|
||||
Dictionary<string, DirectoryScanFingerprintEntity>? fingerprintsByPath,
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch,
|
||||
List<DirectoryScanFingerprintEntity> fingerprintBatch,
|
||||
@@ -212,14 +224,13 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
Queue<DirectoryInfo> directoryQueue = new();
|
||||
directoryQueue.Enqueue(new DirectoryInfo(rootDirectoryPath));
|
||||
|
||||
// use a breadth-first traversal iterative approach, instead of recursion, which is heavier on call frames and memory
|
||||
// and could result in stack overflow on deeply nested directories
|
||||
// Use a breadth-first traversal iterative approach, instead of recursion, which is heavier on call frames and memory and could result in stack overflow on deeply nested directories.
|
||||
while (directoryQueue.Count > 0)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
DirectoryInfo currentDirectory = directoryQueue.Dequeue();
|
||||
|
||||
// when the fast skip is enabled, skip the whole subtree of a directory whose last write time has not changed since the last scan
|
||||
// When the fast skip is enabled, skip the whole subtree of a directory whose last write time has not changed since the last scan.
|
||||
if (shouldSkipUnchangedDirectories)
|
||||
{
|
||||
DateTime currentLastWriteTimeUtc = currentDirectory.LastWriteTimeUtc;
|
||||
@@ -235,7 +246,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
Path = currentDirectory.FullName,
|
||||
LastWriteTimeUtc = currentLastWriteTimeUtc
|
||||
});
|
||||
// flush the collected directory scan fingerprints in bounded batches, so that the memory usage stays proportional to the batch size, no matter how many directories the library has
|
||||
// Flush the collected directory scan fingerprints in bounded batches, so that the memory usage stays proportional to the batch size, no matter how many directories the library has.
|
||||
if (fingerprintBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Updated> upsertFingerprintsResult = await directoryScanFingerprintRepository.UpsertRangeAsync(fingerprintBatch, cancellationToken).ConfigureAwait(false);
|
||||
@@ -245,62 +256,56 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
}
|
||||
}
|
||||
|
||||
// process the files of the current directory
|
||||
// Process the files of the current directory.
|
||||
IEnumerable<FileInfo>? files = null;
|
||||
try
|
||||
{
|
||||
files = currentDirectory.EnumerateFiles("*", s_enumerationOptions)
|
||||
.Where(file => s_bookExtensions.Contains(file.Extension));
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
_logger.LogWarning(ex, "Failed to enumerate the files of the directory '{DirectoryPath}', so its files are skipped for this scan.", currentDirectory.FullName);
|
||||
}
|
||||
|
||||
if (files is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (FileInfo file in files)
|
||||
if (shouldParallelizeReads)
|
||||
await StageFilesInParallelAsync(files, stagingBatch, stagingResultsRepository, cancellationToken).ConfigureAwait(false);
|
||||
else
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
stagingBatch.Add(new LibraryScanStagingResultsEntity()
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = file.FullName,
|
||||
Size = file.Length,
|
||||
Ticks = file.LastWriteTimeUtc.Ticks,
|
||||
ContentHash = 0,
|
||||
PreviousContentHash = 0,
|
||||
NeedsRehash = true,
|
||||
IsNew = true
|
||||
});
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
stagingBatch.Add(CreateStagingResult(file));
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
// a file might become inaccessible between enumeration and processing, so the remaining files of the directory are skipped
|
||||
Debug.WriteLine(ex.Message);
|
||||
// A file might become inaccessible between enumeration and processing, so the remaining files of the directory are skipped.
|
||||
_logger.LogWarning(ex, "Failed to read the metadata of the files of the directory '{DirectoryPath}', so the remaining files of the directory are skipped for this scan.", currentDirectory.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
// process the subdirectories - each new subdirectory is added to the same stack queue, for later processing
|
||||
// Process the subdirectories - each new subdirectory is added to the same stack queue, for later processing.
|
||||
IEnumerable<DirectoryInfo>? subdirectories = null;
|
||||
try
|
||||
{
|
||||
subdirectories = currentDirectory.EnumerateDirectories("*", s_enumerationOptions);
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
_logger.LogWarning(ex, "Failed to enumerate the subdirectories of the directory '{DirectoryPath}', so its subtree is skipped for this scan.", currentDirectory.FullName);
|
||||
}
|
||||
|
||||
if (subdirectories is not null)
|
||||
@@ -313,14 +318,93 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
directoryQueue.Enqueue(subdirectory);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
_logger.LogWarning(ex, "Failed to process the subdirectories of the directory '{DirectoryPath}', so the remaining subdirectories are skipped for this scan.", currentDirectory.FullName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the metadata of <paramref name="files"/> in parallel and writes the discovered files in batches to the staging results.
|
||||
/// </summary>
|
||||
/// <param name="files">The files of the current directory.</param>
|
||||
/// <param name="stagingBatch">The batch of discovered files that is written to the staging results when it reaches the batch size.</param>
|
||||
/// <param name="stagingResultsRepository">The repository used to write the discovered files to the staging results.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
internal async Task StageFilesInParallelAsync(IEnumerable<FileInfo> files, List<LibraryScanStagingResultsEntity> stagingBatch, ILibraryScanStagingResultsRepository stagingResultsRepository, CancellationToken cancellationToken)
|
||||
{
|
||||
List<FileInfo> filesToProcess = [.. files];
|
||||
LibraryScanStagingResultsEntity?[] discoveredFiles = new LibraryScanStagingResultsEntity?[filesToProcess.Count];
|
||||
ParallelOptions parallelOptions = new()
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
Parallel.For(0, filesToProcess.Count, parallelOptions, index =>
|
||||
{
|
||||
try
|
||||
{
|
||||
discoveredFiles[index] = CreateStagingResult(filesToProcess[index]);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
// A file might become inaccessible between enumeration and processing, so it is skipped.
|
||||
_logger.LogWarning(ex, "Failed to read the metadata of the book file '{Path}', so it is skipped for this scan.", filesToProcess[index].FullName);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (AggregateException aggregateException)
|
||||
{
|
||||
// Parallel.For wraps the exceptions thrown by its body, so the real cause is rethrown here, to keep the reported scan failure meaningful.
|
||||
AggregateException flattenedException = aggregateException.Flatten();
|
||||
if (flattenedException.InnerExceptions.Count == 1)
|
||||
ExceptionDispatchInfo.Capture(flattenedException.InnerExceptions[0]).Throw();
|
||||
throw new AggregateException(string.Join("; ", flattenedException.InnerExceptions.Select(exception => exception.Message)), flattenedException.InnerExceptions);
|
||||
}
|
||||
|
||||
// The repository is not thread-safe, so the discovered files are written sequentially, in bounded batches.
|
||||
foreach (LibraryScanStagingResultsEntity? discoveredFile in discoveredFiles)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
if (discoveredFile is null)
|
||||
continue;
|
||||
stagingBatch.Add(discoveredFile);
|
||||
if (stagingBatch.Count >= STAGING_BATCH_SIZE)
|
||||
{
|
||||
Result<Created> insertBatchResult = await stagingResultsRepository.InsertRangeAsync(stagingBatch, cancellationToken).ConfigureAwait(false);
|
||||
if (insertBatchResult.IsFailure)
|
||||
throw new InvalidOperationException(insertBatchResult.FirstError.Description);
|
||||
stagingBatch.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a staging result entity from a discovered file.
|
||||
/// </summary>
|
||||
/// <param name="file">The discovered file.</param>
|
||||
/// <returns>The staging result entity of the file.</returns>
|
||||
private LibraryScanStagingResultsEntity CreateStagingResult(FileInfo file)
|
||||
{
|
||||
return new LibraryScanStagingResultsEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = file.FullName,
|
||||
Size = file.Length,
|
||||
Ticks = file.LastWriteTimeUtc.Ticks,
|
||||
ContentHash = 0,
|
||||
PreviousContentHash = 0,
|
||||
NeedsRehash = true,
|
||||
IsNew = true
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes a job progress update.
|
||||
/// </summary>
|
||||
|
||||
@@ -27,36 +27,37 @@ internal class FileHashService : IFileHashService
|
||||
/// Hashes <paramref name="inputFiles"/> by sampling chunks from them.
|
||||
/// </summary>
|
||||
/// <param name="inputFiles">The collection of files to hash.</param>
|
||||
/// <param name="shouldParallelizeReads">Whether the files should be read in parallel. Parallel reads benefit solid state drives, while mechanical hard drives are faster with sequential reads.</param>
|
||||
/// <param name="callback">Callback to invoke during processing of elements.</param>
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
/// <returns>A collection of the hashed files, along with their hashes.</returns>
|
||||
public async Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> inputFiles, Func<Task> callback, CancellationToken cancellationToken)
|
||||
public async Task<List<HashedFileSystemFileDto>> HashFilesAsync(IReadOnlyCollection<HashedFileSystemFileDto> inputFiles, bool shouldParallelizeReads, Func<Task> callback, CancellationToken cancellationToken)
|
||||
{
|
||||
List<HashedFileSystemFileDto> outputFiles = [];
|
||||
object listLock = new();
|
||||
|
||||
// make use of all available processors
|
||||
// Solid state drives benefit from reading multiple files at once, while mechanical hard drives are faster with sequential reads because of their seek time.
|
||||
ParallelOptions parallelOptions = new()
|
||||
{
|
||||
CancellationToken = cancellationToken,
|
||||
MaxDegreeOfParallelism = Environment.ProcessorCount // TODO: make this configurable, such that parallelism can be turned off for mechanical hard drives
|
||||
MaxDegreeOfParallelism = shouldParallelizeReads ? Environment.ProcessorCount : 1
|
||||
};
|
||||
await Parallel.ForEachAsync(inputFiles, parallelOptions, async (file, cancellationToken) =>
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
// invoke the method that triggers progress reporting
|
||||
// Invoke the method that triggers progress reporting.
|
||||
await callback().ConfigureAwait(false);
|
||||
|
||||
ushort bufferSize = (ushort)Math.Min(DEFAULT_BUFFER_SIZE, file.Size);
|
||||
|
||||
// get the file hash and check if it differs from the one stored on previous scan
|
||||
// Get the file hash and check if it differs from the one stored on previous scan.
|
||||
ulong currentHash = file.Size == 0
|
||||
? s_emptyFileHash // precomputed constant: XxHash64 hash of zero-length input
|
||||
? s_emptyFileHash // Precomputed constant: XxHash64 hash of zero-length input.
|
||||
: ComputeFileHash(file.Path, file.Size, bufferSize);
|
||||
|
||||
// the decision of whether a file changed is already made before hashing, so all files that reach this point get their hash stored
|
||||
// The decision of whether a file changed is already made before hashing, so all files that reach this point get their hash stored.
|
||||
lock (listLock)
|
||||
outputFiles.Add(file with { CurrentHash = currentHash });
|
||||
}
|
||||
@@ -78,7 +79,7 @@ internal class FileHashService : IFileHashService
|
||||
{
|
||||
long fileSize = new FileInfo(filePath).Length;
|
||||
if (fileSize == 0)
|
||||
return s_emptyFileHash; // precomputed constant: XxHash64 hash of zero-length input
|
||||
return s_emptyFileHash; // Precomputed constant: XxHash64 hash of zero-length input.
|
||||
|
||||
ushort bufferSize = (ushort)Math.Min(DEFAULT_BUFFER_SIZE, fileSize);
|
||||
return ComputeFileHash(filePath, fileSize, bufferSize);
|
||||
@@ -92,46 +93,46 @@ internal class FileHashService : IFileHashService
|
||||
/// <param name="bufferSize">Sample window size (automatically clamped to file size).</param>
|
||||
private static unsafe ulong ComputeFileHash(string filePath, long fileSize, ushort bufferSize)
|
||||
{
|
||||
// create a memory-mapped file for efficient access to large files
|
||||
// Create a memory-mapped file for efficient access to large files.
|
||||
using MemoryMappedFile memoryMappedFile = MemoryMappedFile.CreateFromFile(filePath, FileMode.Open, null, 0, MemoryMappedFileAccess.Read);
|
||||
// create a view accessor to read from the memory-mapped file
|
||||
// Create a view accessor to read from the memory-mapped file.
|
||||
using MemoryMappedViewAccessor memoryMappedViewAccessor = memoryMappedFile.CreateViewAccessor(0, fileSize, MemoryMappedFileAccess.Read);
|
||||
|
||||
byte* memoryPointer = null;
|
||||
|
||||
try
|
||||
{
|
||||
// get a direct pointer to the memory-mapped file, for faster access
|
||||
// Get a direct pointer to the memory-mapped file, for faster access.
|
||||
memoryMappedViewAccessor.SafeMemoryMappedViewHandle.AcquirePointer(ref memoryPointer);
|
||||
|
||||
// get the thread-local hasher and reset it before use; resetting at entry (rather than at exit) ensures
|
||||
// the hasher is always in a clean state even if a previous call on this thread threw mid-computation
|
||||
// Get the thread-local hasher and reset it before use; resetting at entry (rather than at exit) ensures
|
||||
// the hasher is always in a clean state even if a previous call on this thread threw mid-computation.
|
||||
XxHash64 hasher = s_threadLocalHasher.Value!;
|
||||
hasher.Reset();
|
||||
|
||||
// allocate hash result buffer on the stack, to avoid heap allocation
|
||||
// Allocate hash result buffer on the stack, to avoid heap allocation.
|
||||
Span<byte> hashSpan = stackalloc byte[sizeof(ulong)];
|
||||
|
||||
// process only predefined sampled segments of the file, instead of the entire file
|
||||
// Process only predefined sampled segments of the file, instead of the entire file.
|
||||
foreach (long offset in GetByteBufferSampleOffsets(fileSize, bufferSize))
|
||||
{
|
||||
// calculate how many bytes to read (handle edge case at end of file, or when the file size is smaller than the buffer)
|
||||
// Calculate how many bytes to read (handle edge case at end of file, or when the file size is smaller than the buffer).
|
||||
ushort readSize = (ushort)Math.Min(bufferSize, fileSize - offset);
|
||||
// create a span directly over the memory-mapped region
|
||||
// Create a span directly over the memory-mapped region.
|
||||
ReadOnlySpan<byte> dataSpan = new(memoryPointer + offset, readSize);
|
||||
// update the hash with this chunk of data
|
||||
// Update the hash with this chunk of data.
|
||||
hasher.Append(dataSpan);
|
||||
}
|
||||
|
||||
// get the final hash value
|
||||
// Get the final hash value.
|
||||
if (!hasher.TryGetCurrentHash(hashSpan, out int bytesWritten) || bytesWritten != sizeof(ulong))
|
||||
throw new InvalidOperationException("Hash computation failed");
|
||||
// convert the hash byte span to a long, and return it
|
||||
// Convert the hash byte span to a long, and return it.
|
||||
return BitConverter.ToUInt64(hashSpan);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (memoryPointer is not null) // always release the pointer, to prevent memory leaks
|
||||
if (memoryPointer is not null) // Always release the pointer, to prevent memory leaks.
|
||||
memoryMappedViewAccessor.SafeMemoryMappedViewHandle.ReleasePointer();
|
||||
}
|
||||
}
|
||||
@@ -144,20 +145,20 @@ internal class FileHashService : IFileHashService
|
||||
/// <returns>An enumerable of byte offsets to sample from the file.</returns>
|
||||
private static IEnumerable<long> GetByteBufferSampleOffsets(long fileSize, ushort bufferSize)
|
||||
{
|
||||
// for small files, just read from the beginning
|
||||
// For small files, just read from the beginning.
|
||||
if (fileSize <= bufferSize * SAMPLE_COUNT)
|
||||
{
|
||||
yield return 0;
|
||||
yield break;
|
||||
}
|
||||
// for larger files, sample at strategic points:
|
||||
yield return 0; // beginning of the file
|
||||
yield return fileSize / 4; // quarter of the file
|
||||
yield return fileSize / 2; // half of the file
|
||||
yield return 3 * fileSize / 4; // three quarters of the file
|
||||
yield return Math.Max(0, fileSize - bufferSize); // end of the file (ensure we don't go past the end)
|
||||
// For larger files, sample at strategic points:
|
||||
yield return 0; // Beginning of the file.
|
||||
yield return fileSize / 4; // Quarter of the file.
|
||||
yield return fileSize / 2; // Half of the file.
|
||||
yield return 3 * fileSize / 4; // Three quarters of the file.
|
||||
yield return Math.Max(0, fileSize - bufferSize); // End of the file (ensure we don't go past the end).
|
||||
|
||||
// additional evenly spaced samples, if needed
|
||||
// Additional evenly spaced samples, if needed.
|
||||
long interval = fileSize / (SAMPLE_COUNT + 1);
|
||||
for (int i = 1; i <= SAMPLE_COUNT - 4; i++)
|
||||
yield return interval * i;
|
||||
|
||||
+4
@@ -37,6 +37,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: null
|
||||
@@ -51,6 +52,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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.");
|
||||
@@ -66,6 +68,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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk.");
|
||||
@@ -85,6 +88,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
|
||||
+3
@@ -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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk.");
|
||||
@@ -53,6 +54,7 @@ public class GetEnabledLibrariesEndpointSummary : Summary<GetEnabledLibrariesEnd
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
@@ -71,6 +73,7 @@ public class GetEnabledLibrariesEndpointSummary : Summary<GetEnabledLibrariesEnd
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: true,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
|
||||
+3
@@ -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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk.");
|
||||
@@ -53,6 +54,7 @@ public class GetLibrariesEndpointSummary : Summary<GetLibrariesEndpoint, EmptyRe
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
@@ -71,6 +73,7 @@ public class GetLibrariesEndpointSummary : Summary<GetLibrariesEndpoint, EmptyRe
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: true,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
|
||||
+2
@@ -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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk.");
|
||||
@@ -59,6 +60,7 @@ public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryR
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
|
||||
+4
@@ -39,6 +39,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: null
|
||||
@@ -55,6 +56,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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.");
|
||||
@@ -70,6 +72,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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk.");
|
||||
@@ -89,6 +92,7 @@ public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, Updat
|
||||
CanDownloadMetadataFromWeb: true,
|
||||
ShouldSaveMetadataInMediaDirectories: false,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
IsContentOnSsd: false,
|
||||
ShouldTrackConsumptionProgress: true,
|
||||
CompletionThresholdPercentage: 90,
|
||||
PathTemplateParts: [],
|
||||
|
||||
@@ -68,6 +68,11 @@ public class LibraryDto
|
||||
/// </summary>
|
||||
public bool ShouldSkipUnchangedDirectoriesDuringScan { get; set; } = false;
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
public bool IsContentOnSsd { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the consumption progress of the media library items is tracked, or not. When absent, the default of the library type is used on create, and the stored value is kept on update.
|
||||
/// </summary>
|
||||
|
||||
+4
@@ -31,6 +31,10 @@ 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.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.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.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.PathTemplateParts, "The ordered parts of the template describing the structure of the media library on disk. Optional, the ideal structure of the library type is used when absent.");
|
||||
|
||||
ExampleRequest = new LibraryDto();
|
||||
|
||||
|
||||
-135
@@ -1,135 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Resources.Views.Auth {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class ChangePassword {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal ChangePassword() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lumina.Presentation.Web.Core.Resources.Views.Auth.ChangePassword", typeof(ChangePassword).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Change Password.
|
||||
/// </summary>
|
||||
public static string ChangePasswordKey {
|
||||
get {
|
||||
return ResourceManager.GetString("ChangePasswordKey", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Current Password.
|
||||
/// </summary>
|
||||
public static string CurrentPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("CurrentPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enter your existing password to verify your identity.
|
||||
/// </summary>
|
||||
public static string DescriptionCurrentPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionCurrentPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password must be at least 8 characters and include letters, numbers, and symbols.
|
||||
/// </summary>
|
||||
public static string DescriptionNewPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionNewPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Re-enter your new password to ensure it matches.
|
||||
/// </summary>
|
||||
public static string DescriptionNewPasswordConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionNewPasswordConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New Password.
|
||||
/// </summary>
|
||||
public static string NewPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("NewPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New Password Confirm.
|
||||
/// </summary>
|
||||
public static string NewPasswordConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("NewPasswordConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password Changed.
|
||||
/// </summary>
|
||||
public static string PasswordChanged {
|
||||
get {
|
||||
return ResourceManager.GetString("PasswordChanged", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Resources.Views.Auth {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Login {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Login() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lumina.Presentation.Web.Core.Resources.Views.Auth.Login", typeof(Login).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Login.
|
||||
/// </summary>
|
||||
public static string LoginKey {
|
||||
get {
|
||||
return ResourceManager.GetString("LoginKey", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
public static string Password {
|
||||
get {
|
||||
return ResourceManager.GetString("Password", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Recover Password.
|
||||
/// </summary>
|
||||
public static string RecoverPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("RecoverPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TOTP Code.
|
||||
/// </summary>
|
||||
public static string TotpCode {
|
||||
get {
|
||||
return ResourceManager.GetString("TotpCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Username.
|
||||
/// </summary>
|
||||
public static string Username {
|
||||
get {
|
||||
return ResourceManager.GetString("Username", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Validate Code.
|
||||
/// </summary>
|
||||
public static string ValidateCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidateCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Resources.Views.Auth {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class RecoverPassword {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal RecoverPassword() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lumina.Presentation.Web.Core.Resources.Views.Auth.RecoverPassword", typeof(RecoverPassword).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Back To Login.
|
||||
/// </summary>
|
||||
public static string BackToLogin {
|
||||
get {
|
||||
return ResourceManager.GetString("BackToLogin", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Login.
|
||||
/// </summary>
|
||||
public static string Login {
|
||||
get {
|
||||
return ResourceManager.GetString("Login", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password Temporarily Reset.
|
||||
/// </summary>
|
||||
public static string PasswordTemporarilyReset {
|
||||
get {
|
||||
return ResourceManager.GetString("PasswordTemporarilyReset", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TOTP Code.
|
||||
/// </summary>
|
||||
public static string TotpCode {
|
||||
get {
|
||||
return ResourceManager.GetString("TotpCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Username.
|
||||
/// </summary>
|
||||
public static string Username {
|
||||
get {
|
||||
return ResourceManager.GetString("Username", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Validate Code.
|
||||
/// </summary>
|
||||
public static string ValidateCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ValidateCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Resources.Views.Auth {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Register {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Register() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lumina.Presentation.Web.Core.Resources.Views.Auth.Register", typeof(Register).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Account Created.
|
||||
/// </summary>
|
||||
public static string AccountCreated {
|
||||
get {
|
||||
return ResourceManager.GetString("AccountCreated", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Admin account registration.
|
||||
/// </summary>
|
||||
public static string AdminAccountRegistration {
|
||||
get {
|
||||
return ResourceManager.GetString("AdminAccountRegistration", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Recommended for account security and required for password recovery.
|
||||
/// </summary>
|
||||
public static string Description2Fa {
|
||||
get {
|
||||
return ResourceManager.GetString("Description2Fa", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password must be at least 8 characters and include letters, numbers, and symbols.
|
||||
/// </summary>
|
||||
public static string DescriptionPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Re-enter your password to ensure it matches.
|
||||
/// </summary>
|
||||
public static string DescriptionPasswordConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionPasswordConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Choose a unique username for your account (3-20 characters).
|
||||
/// </summary>
|
||||
public static string DescriptionUsername {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionUsername", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password recovery is allowed only if two factor authentication is enabled!.
|
||||
/// </summary>
|
||||
public static string DisclaimerTwoFactor {
|
||||
get {
|
||||
return ResourceManager.GetString("DisclaimerTwoFactor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enable two factor authentication.
|
||||
/// </summary>
|
||||
public static string EnableTwoFactorAuthentication {
|
||||
get {
|
||||
return ResourceManager.GetString("EnableTwoFactorAuthentication", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Login.
|
||||
/// </summary>
|
||||
public static string Login {
|
||||
get {
|
||||
return ResourceManager.GetString("Login", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
public static string Password {
|
||||
get {
|
||||
return ResourceManager.GetString("Password", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password Confirm.
|
||||
/// </summary>
|
||||
public static string PasswordConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("PasswordConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Register.
|
||||
/// </summary>
|
||||
public static string RegisterKey {
|
||||
get {
|
||||
return ResourceManager.GetString("RegisterKey", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Scan TOTP Code.
|
||||
/// </summary>
|
||||
public static string ScanTotpCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ScanTotpCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Username.
|
||||
/// </summary>
|
||||
public static string Username {
|
||||
get {
|
||||
return ResourceManager.GetString("Username", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-720
@@ -1,720 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Lumina.Presentation.Web.Core.Resources.Views.Library.Management {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Item {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Item() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Lumina.Presentation.Web.Core.Resources.Views.Library.Management.Item", typeof(Item).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Academic Paper.
|
||||
/// </summary>
|
||||
public static string AcademicPaper {
|
||||
get {
|
||||
return ResourceManager.GetString("AcademicPaper", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add directory.
|
||||
/// </summary>
|
||||
public static string AddDirectory {
|
||||
get {
|
||||
return ResourceManager.GetString("AddDirectory", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add image.
|
||||
/// </summary>
|
||||
public static string AddImage {
|
||||
get {
|
||||
return ResourceManager.GetString("AddImage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add New Library.
|
||||
/// </summary>
|
||||
public static string AddNewLibrary {
|
||||
get {
|
||||
return ResourceManager.GetString("AddNewLibrary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Advanced Settings.
|
||||
/// </summary>
|
||||
public static string AdvancedSettings {
|
||||
get {
|
||||
return ResourceManager.GetString("AdvancedSettings", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Anime.
|
||||
/// </summary>
|
||||
public static string Anime {
|
||||
get {
|
||||
return ResourceManager.GetString("Anime", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Audio Book.
|
||||
/// </summary>
|
||||
public static string AudioBook {
|
||||
get {
|
||||
return ResourceManager.GetString("AudioBook", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Audio Content.
|
||||
/// </summary>
|
||||
public static string AudioContent {
|
||||
get {
|
||||
return ResourceManager.GetString("AudioContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Back To Libraries.
|
||||
/// </summary>
|
||||
public static string BackToLibraries {
|
||||
get {
|
||||
return ResourceManager.GetString("BackToLibraries", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Book.
|
||||
/// </summary>
|
||||
public static string Book {
|
||||
get {
|
||||
return ResourceManager.GetString("Book", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Book Series.
|
||||
/// </summary>
|
||||
public static string BookSeries {
|
||||
get {
|
||||
return ResourceManager.GetString("BookSeries", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Comic Book.
|
||||
/// </summary>
|
||||
public static string ComicBook {
|
||||
get {
|
||||
return ResourceManager.GetString("ComicBook", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Comic Series.
|
||||
/// </summary>
|
||||
public static string ComicSeries {
|
||||
get {
|
||||
return ResourceManager.GetString("ComicSeries", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Concert.
|
||||
/// </summary>
|
||||
public static string Concert {
|
||||
get {
|
||||
return ResourceManager.GetString("Concert", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cover.
|
||||
/// </summary>
|
||||
public static string Cover {
|
||||
get {
|
||||
return ResourceManager.GetString("Cover", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cover Image.
|
||||
/// </summary>
|
||||
public static string CoverImage {
|
||||
get {
|
||||
return ResourceManager.GetString("CoverImage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select the image file that will be used as the cover for this library.
|
||||
/// </summary>
|
||||
public static string DescriptionCover {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionCover", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select the folders containing the media files of this library.
|
||||
/// </summary>
|
||||
public static string DescriptionDirectories {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionDirectories", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Whether this media library should get the metadata of it elements by downloading it from the Internet, or not..
|
||||
/// </summary>
|
||||
public static string DescriptionDownloadMetadataFromWeb {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionDownloadMetadataFromWeb", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Whether this media library is disabled or not. A disabled library is not displayed to the users, scanned, updated, etc..
|
||||
/// </summary>
|
||||
public static string DescriptionEnabled {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionEnabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Select the type of media content this library will contain.
|
||||
/// </summary>
|
||||
public static string DescriptionLibraryType {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionLibraryType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Whether this media library is locked or not. A locked library is displayed to the users, but it is never scanned, updated, modified, etc..
|
||||
/// </summary>
|
||||
public static string DescriptionLocked {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionLocked", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The metadata providers used to enrich the items of this library, in the order they are tried..
|
||||
/// </summary>
|
||||
public static string DescriptionMetadataProviders {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionMetadataProviders", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 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..
|
||||
/// </summary>
|
||||
public static string DescriptionShouldSaveMetadataInMediaDirectories {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionShouldSaveMetadataInMediaDirectories", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 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..
|
||||
/// </summary>
|
||||
public static string DescriptionShouldSkipUnchangedDirectoriesDuringScan {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionShouldSkipUnchangedDirectoriesDuringScan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A name to identify this library.
|
||||
/// </summary>
|
||||
public static string DescriptionTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("DescriptionTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Directories.
|
||||
/// </summary>
|
||||
public static string Directories {
|
||||
get {
|
||||
return ResourceManager.GetString("Directories", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Documentary.
|
||||
/// </summary>
|
||||
public static string Documentary {
|
||||
get {
|
||||
return ResourceManager.GetString("Documentary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Download Metadata From The Web.
|
||||
/// </summary>
|
||||
public static string DownloadMetadataFromWeb {
|
||||
get {
|
||||
return ResourceManager.GetString("DownloadMetadataFromWeb", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to E Book.
|
||||
/// </summary>
|
||||
public static string EBook {
|
||||
get {
|
||||
return ResourceManager.GetString("EBook", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Edit Library.
|
||||
/// </summary>
|
||||
public static string EditLibrary {
|
||||
get {
|
||||
return ResourceManager.GetString("EditLibrary", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enabled.
|
||||
/// </summary>
|
||||
public static string Enabled {
|
||||
get {
|
||||
return ResourceManager.GetString("Enabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Film Franchise.
|
||||
/// </summary>
|
||||
public static string FilmFranchise {
|
||||
get {
|
||||
return ResourceManager.GetString("FilmFranchise", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Film Series.
|
||||
/// </summary>
|
||||
public static string FilmSeries {
|
||||
get {
|
||||
return ResourceManager.GetString("FilmSeries", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to General Information.
|
||||
/// </summary>
|
||||
public static string GeneralInformation {
|
||||
get {
|
||||
return ResourceManager.GetString("GeneralInformation", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Graphic Novel.
|
||||
/// </summary>
|
||||
public static string GraphicNovel {
|
||||
get {
|
||||
return ResourceManager.GetString("GraphicNovel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Interview.
|
||||
/// </summary>
|
||||
public static string Interview {
|
||||
get {
|
||||
return ResourceManager.GetString("Interview", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Library Saved.
|
||||
/// </summary>
|
||||
public static string LibrarySaved {
|
||||
get {
|
||||
return ResourceManager.GetString("LibrarySaved", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Library Type.
|
||||
/// </summary>
|
||||
public static string LibraryType {
|
||||
get {
|
||||
return ResourceManager.GetString("LibraryType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Live Performance.
|
||||
/// </summary>
|
||||
public static string LivePerformance {
|
||||
get {
|
||||
return ResourceManager.GetString("LivePerformance", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Locked.
|
||||
/// </summary>
|
||||
public static string Locked {
|
||||
get {
|
||||
return ResourceManager.GetString("Locked", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Magazine.
|
||||
/// </summary>
|
||||
public static string Magazine {
|
||||
get {
|
||||
return ResourceManager.GetString("Magazine", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Manga.
|
||||
/// </summary>
|
||||
public static string Manga {
|
||||
get {
|
||||
return ResourceManager.GetString("Manga", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Metadata providers.
|
||||
/// </summary>
|
||||
public static string MetadataProviders {
|
||||
get {
|
||||
return ResourceManager.GetString("MetadataProviders", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Miscellaneous Content.
|
||||
/// </summary>
|
||||
public static string MiscellaneousContent {
|
||||
get {
|
||||
return ResourceManager.GetString("MiscellaneousContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Move down.
|
||||
/// </summary>
|
||||
public static string MoveDown {
|
||||
get {
|
||||
return ResourceManager.GetString("MoveDown", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Move up.
|
||||
/// </summary>
|
||||
public static string MoveUp {
|
||||
get {
|
||||
return ResourceManager.GetString("MoveUp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Movie.
|
||||
/// </summary>
|
||||
public static string Movie {
|
||||
get {
|
||||
return ResourceManager.GetString("Movie", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Music.
|
||||
/// </summary>
|
||||
public static string Music {
|
||||
get {
|
||||
return ResourceManager.GetString("Music", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
public static string Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Order.
|
||||
/// </summary>
|
||||
public static string Order {
|
||||
get {
|
||||
return ResourceManager.GetString("Order", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Order saved.
|
||||
/// </summary>
|
||||
public static string OrderSaved {
|
||||
get {
|
||||
return ResourceManager.GetString("OrderSaved", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Other.
|
||||
/// </summary>
|
||||
public static string Other {
|
||||
get {
|
||||
return ResourceManager.GetString("Other", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Personal.
|
||||
/// </summary>
|
||||
public static string Personal {
|
||||
get {
|
||||
return ResourceManager.GetString("Personal", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Photo Album.
|
||||
/// </summary>
|
||||
public static string PhotoAlbum {
|
||||
get {
|
||||
return ResourceManager.GetString("PhotoAlbum", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Podcast.
|
||||
/// </summary>
|
||||
public static string Podcast {
|
||||
get {
|
||||
return ResourceManager.GetString("Podcast", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Radio Show.
|
||||
/// </summary>
|
||||
public static string RadioShow {
|
||||
get {
|
||||
return ResourceManager.GetString("RadioShow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remix.
|
||||
/// </summary>
|
||||
public static string Remix {
|
||||
get {
|
||||
return ResourceManager.GetString("Remix", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
public static string Remove {
|
||||
get {
|
||||
return ResourceManager.GetString("Remove", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Save.
|
||||
/// </summary>
|
||||
public static string Save {
|
||||
get {
|
||||
return ResourceManager.GetString("Save", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Screenplay.
|
||||
/// </summary>
|
||||
public static string Screenplay {
|
||||
get {
|
||||
return ResourceManager.GetString("Screenplay", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sheet Music.
|
||||
/// </summary>
|
||||
public static string SheetMusic {
|
||||
get {
|
||||
return ResourceManager.GetString("SheetMusic", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Save Metadata In Media Directories.
|
||||
/// </summary>
|
||||
public static string ShouldSaveMetadataInMediaDirectories {
|
||||
get {
|
||||
return ResourceManager.GetString("ShouldSaveMetadataInMediaDirectories", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Skip Unchanged Directories During Scan.
|
||||
/// </summary>
|
||||
public static string ShouldSkipUnchangedDirectoriesDuringScan {
|
||||
get {
|
||||
return ResourceManager.GetString("ShouldSkipUnchangedDirectoriesDuringScan", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sound Effect.
|
||||
/// </summary>
|
||||
public static string Soundeffect {
|
||||
get {
|
||||
return ResourceManager.GetString("Soundeffect", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Title.
|
||||
/// </summary>
|
||||
public static string Title {
|
||||
get {
|
||||
return ResourceManager.GetString("Title", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tutorial.
|
||||
/// </summary>
|
||||
public static string Tutorial {
|
||||
get {
|
||||
return ResourceManager.GetString("Tutorial", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tv Show.
|
||||
/// </summary>
|
||||
public static string TvShow {
|
||||
get {
|
||||
return ResourceManager.GetString("TvShow", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Videoclip.
|
||||
/// </summary>
|
||||
public static string Videoclip {
|
||||
get {
|
||||
return ResourceManager.GetString("Videoclip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Video Content.
|
||||
/// </summary>
|
||||
public static string VideoContent {
|
||||
get {
|
||||
return ResourceManager.GetString("VideoContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Visual Content.
|
||||
/// </summary>
|
||||
public static string VisualContent {
|
||||
get {
|
||||
return ResourceManager.GetString("VisualContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Written Content.
|
||||
/// </summary>
|
||||
public static string WrittenContent {
|
||||
get {
|
||||
return ResourceManager.GetString("WrittenContent", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to YouTube.
|
||||
/// </summary>
|
||||
public static string YouTube {
|
||||
get {
|
||||
return ResourceManager.GetString("YouTube", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>ما إذا كانت مكتبة الوسائط هذه معطّلة أم لا. المكتبة المعطّلة لا تُعرض على المستخدمين ولا تُفحص ولا تُحدَّث وما إلى ذلك.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>يشير إلى ما إذا كان محتوى مكتبة الوسائط مخزناً على قرص حالة صلبة. عند التفعيل، تقرأ مرحلتا اكتشاف الملفات وحساب تجزئة المحتوى الملفات بالتوازي، مما يستفيد من زمن الاستجابة المنخفض لأقراص الحالة الصلبة. اتركه معطلاً لأقراص القرص الصلب الميكانيكية، حيث قد تقلل القراءات المتوازية من الأداء.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>حدد نوع محتوى الوسائط الذي ستحتويه هذه المكتبة</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>مقابلة</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>المحتوى على قرص SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>تم حفظ المكتبة</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Ob diese Medienbibliothek deaktiviert ist oder nicht. Eine deaktivierte Bibliothek wird den Benutzern nicht angezeigt, nicht gescannt, nicht aktualisiert, usw.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Ob der Inhalt der Medienbibliothek auf einer Solid State Drive gespeichert ist. Wenn aktiviert, lesen die Dateierkennung und das Hashen der Inhalte Dateien parallel, was die geringe Latenz von Solid State Drives nutzt. Für mechanische Festplatten deaktiviert lassen, da parallele Lesezugriffe die Leistung verringern können.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Wählen Sie die Art der Medieninhalte aus, die diese Bibliothek enthalten soll</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Interview</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Inhalt liegt auf SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Bibliothek Gespeichert</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Whether this media library is disabled or not. A disabled library is not displayed to the users, scanned, updated, etc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Whether the media library content is stored on a solid state drive. When enabled, the file discovery and content hashing stages read files in parallel, which takes advantage of the low latency of solid state drives. Leave it off for mechanical hard drives, where parallel reads can reduce performance.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Select the type of media content this library will contain</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Interview</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Content Is On SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Library Saved</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Si esta biblioteca multimedia está desactivada o no. Una biblioteca desactivada no se muestra a los usuarios, no se escanea, no se actualiza, etc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Indica si el contenido de la biblioteca multimedia está almacenado en una unidad de estado sólido. Cuando se activa, las etapas de descubrimiento de archivos y de cálculo de hash del contenido leen archivos en paralelo, aprovechando la baja latencia de las unidades de estado sólido. Déjalo desactivado para discos duros mecánicos, donde las lecturas en paralelo pueden reducir el rendimiento.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Selecciona el tipo de contenido multimedia que contendrá esta biblioteca</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Entrevista</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>El contenido está en SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Biblioteca Guardada</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Si cette médiathèque est désactivée ou non. Une bibliothèque désactivée n'est pas affichée aux utilisateurs, ni analysée, ni mise à jour, etc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Indique si le contenu de la médiathèque est stocké sur un disque SSD. Lorsque cette option est activée, les étapes de découverte des fichiers et de calcul des empreintes du contenu lisent les fichiers en parallèle, ce qui tire parti de la faible latence des disques SSD. Laissez-la désactivée pour les disques durs mécaniques, où les lectures parallèles peuvent réduire les performances.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Choisissez le type de contenu multimédia que contiendra cette bibliothèque</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Entretien</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Contenu sur SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Bibliothèque Enregistrée</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Se questa libreria multimediale è disabilitata o meno. Una libreria disabilitata non viene mostrata agli utenti, scansionata, aggiornata, ecc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Indica se il contenuto della libreria multimediale è archiviato su un'unità a stato solido. Quando è attiva, le fasi di individuazione dei file e di calcolo dell'hash del contenuto leggono i file in parallelo, sfruttando la bassa latenza delle unità a stato solido. Lasciarla disattivata per i dischi rigidi meccanici, dove le letture parallele possono ridurre le prestazioni.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Seleziona il tipo di contenuti multimediali che questa biblioteca conterrà</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Intervista</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Contenuto su SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Biblioteca Salvata</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>このメディアライブラリが無効になっているかどうか。無効化されたライブラリはユーザーに表示されず、スキャンされず、更新もされません。</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>メディアライブラリのコンテンツがソリッドステートドライブに保存されているかどうか。有効にすると、ファイル検出とコンテンツのハッシュ計算の段階で複数のファイルを並列で読み取り、ソリッドステートドライブの低遅延を活用します。並列読み取りがパフォーマンスを低下させる可能性があるメカニカルハードディスクでは無効のままにしてください。</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>この図書館に含める媒体コンテンツの種類を選択してください</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>インタビュー</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>コンテンツはSSD上にあります</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>ライブラリを保存しました</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Whether this media library is disabled or not. A disabled library is not displayed to the users, scanned, updated, etc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Whether the media library content is stored on a solid state drive. When enabled, the file discovery and content hashing stages read files in parallel, which takes advantage of the low latency of solid state drives. Leave it off for mechanical hard drives, where parallel reads can reduce performance.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Select the type of media content this library will contain</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Interview</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Content Is On SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Library Saved</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Dacă această bibliotecă media este dezactivată sau nu. O bibliotecă dezactivată nu este afișată utilizatorilor, scanată, actualizată, etc.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Stabilește dacă fișierele bibliotecii media se află pe un SSD. Când este activată, etapele de descoperire a fișierelor și de calculare a amprentelor conținutului citesc fișierele în paralel, valorificând latența redusă a unităților SSD. Lăsați-o dezactivată pentru hard disk-urile mecanice, unde citirile în paralel pot reduce performanța.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Selectează tipul de conținut media pe care îl va conține această bibliotecă</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Interviu</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Conținutul este pe SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Biblioteca A Fost Salvată</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>Чи вимкнена ця медіатека чи ні. Вимкнена бібліотека не відображається користувачам, не сканується, не оновлюється тощо.</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>Вказує, чи зберігається вміст медіатеки на твердотільному накопичувачі. Якщо ввімкнено, етапи виявлення файлів і обчислення хешу вмісту читають файли паралельно, використовуючи низьку затримку твердотільних накопичувачів. Залиште вимкненим для механічних жорстких дисків, де паралельне читання може знизити продуктивність.</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>Виберіть тип медіаконтенту, який міститиме ця бібліотека</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>Інтерв'ю</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>Вміст на SSD</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>Бібліотеку збережено</value>
|
||||
</data>
|
||||
|
||||
@@ -177,6 +177,9 @@
|
||||
<data name="DescriptionEnabled" xml:space="preserve">
|
||||
<value>此媒体库是否已禁用。禁用的库不会显示给用户,不会被扫描、更新等。</value>
|
||||
</data>
|
||||
<data name="DescriptionIsContentOnSsd" xml:space="preserve">
|
||||
<value>媒体库内容是否存储在固态硬盘上。启用后,文件发现和内容哈希计算阶段会并行读取文件,从而利用固态硬盘的低延迟。对于机械硬盘,请保持关闭,因为并行读取可能会降低性能。</value>
|
||||
</data>
|
||||
<data name="DescriptionLibraryType" xml:space="preserve">
|
||||
<value>选择这个图书馆将包含的媒体内容类型</value>
|
||||
</data>
|
||||
@@ -225,6 +228,9 @@
|
||||
<data name="Interview" xml:space="preserve">
|
||||
<value>访谈</value>
|
||||
</data>
|
||||
<data name="IsContentOnSsd" xml:space="preserve">
|
||||
<value>内容位于固态硬盘</value>
|
||||
</data>
|
||||
<data name="LibrarySaved" xml:space="preserve">
|
||||
<value>图书馆已保存</value>
|
||||
</data>
|
||||
|
||||
@@ -205,6 +205,18 @@
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSkipUnchangedDirectoriesDuringScan"]</small>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label asp-for="IsContentOnSsd">@_localizer["IsContentOnSsd"]:</label>
|
||||
</div>
|
||||
<div class="form-field">
|
||||
<label class="enlightenment-checkbox-label">
|
||||
<input type="checkbox" asp-for="IsContentOnSsd" class="enlightenment-checkbox-hidden" />
|
||||
<span class="enlightenment-checkbox"></span>
|
||||
</label>
|
||||
</div>
|
||||
<small class="form-label text-disabled form-description">@_localizer["DescriptionIsContentOnSsd"]</small>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-label">
|
||||
<label for="should-track-consumption-progress">@_localizer["ShouldTrackConsumptionProgress"]</label>:
|
||||
@@ -343,6 +355,7 @@
|
||||
const chkCanDownloadMetadataFromWeb = form.querySelector('[name="CanDownloadMetadataFromWeb"]');
|
||||
const chkShouldSaveMetadataInMediaDirectories = form.querySelector('[name="ShouldSaveMetadataInMediaDirectories"]');
|
||||
const chkShouldSkipUnchangedDirectoriesDuringScan = form.querySelector('[name="ShouldSkipUnchangedDirectoriesDuringScan"]');
|
||||
const chkIsContentOnSsd = form.querySelector('[name="IsContentOnSsd"]');
|
||||
const chkShouldTrackConsumptionProgress = form.querySelector('[name="ShouldTrackConsumptionProgress"]');
|
||||
const inputCompletionThresholdPercentage = form.querySelector('[name="CompletionThresholdPercentage"]');
|
||||
const completionThresholdValidation = document.getElementById('completion-threshold-validation');
|
||||
@@ -376,6 +389,7 @@
|
||||
CanDownloadMetadataFromWeb: chkCanDownloadMetadataFromWeb.checked,
|
||||
ShouldSaveMetadataInMediaDirectories: chkShouldSaveMetadataInMediaDirectories.checked,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan: chkShouldSkipUnchangedDirectoriesDuringScan.checked,
|
||||
IsContentOnSsd: chkIsContentOnSsd.checked,
|
||||
ShouldTrackConsumptionProgress: shouldTrackConsumptionProgress,
|
||||
// An empty threshold is sent as null: creating a library or enabling progress tracking uses the type default,
|
||||
// editing a library that already tracks progress keeps the stored threshold, and types without a default
|
||||
|
||||
@@ -47,31 +47,6 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Plugins.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Core\Resources\Views\Auth\ChangePassword.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>ChangePassword.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Core\Resources\Views\Auth\Login.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Login.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Core\Resources\Views\Auth\RecoverPassword.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>RecoverPassword.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Core\Resources\Views\Auth\Register.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Register.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Core\Resources\Views\Library\Management\Item.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Item.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -241,40 +216,6 @@
|
||||
<EmbeddedResource Update="Core\Resources\Views\Auth\Register.zh-CN.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.ar-SA.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.de-DE.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.en-US.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.es-ES.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.fr-FR.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.it-IT.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.ja-JP.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Item.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.ro-RO.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.uk-UA.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Library\Management\Item.zh-CN.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Core\Resources\Views\Shared\Components\FileSystemBrowser\Default.ar-SA.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -194,6 +194,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "architecture-decision-log",
|
||||
..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0016.md = ..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0016.md
|
||||
..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0017.md = ..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0017.md
|
||||
..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0018.md = ..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0018.md
|
||||
..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0019.md = ..\docs\technical\architecture\architecture-knowledge-management\architecture-decision-log\architecture-decision-record-0019.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "domain", "domain", "{3EE8EFDF-4D55-4EA3-BEE2-74D00CB50570}"
|
||||
|
||||
+3
@@ -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="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="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="completionThresholdPercentage">The percentage of a media library item that must be consumed for its session to be considered completed.</param>
|
||||
/// <param name="metadataProvidersConfigurationFingerprint">Optional. The fingerprint of the metadata provider configuration of the media library.</param>
|
||||
@@ -52,6 +53,7 @@ public class LibraryEntityFixture
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = true,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
bool isContentOnSsd = false,
|
||||
bool shouldTrackConsumptionProgress = false,
|
||||
int? completionThresholdPercentage = null,
|
||||
string? metadataProvidersConfigurationFingerprint = null,
|
||||
@@ -75,6 +77,7 @@ public class LibraryEntityFixture
|
||||
CanDownloadMetadataFromWeb = canDownloadMetadataFromWeb,
|
||||
ShouldSaveMetadataInMediaDirectories = shouldSaveMetadataInMediaDirectories,
|
||||
ShouldSkipUnchangedDirectoriesDuringScan = shouldSkipUnchangedDirectoriesDuringScan,
|
||||
IsContentOnSsd = isContentOnSsd,
|
||||
ShouldTrackConsumptionProgress = shouldTrackConsumptionProgress,
|
||||
CompletionThresholdPercentage = completionThresholdPercentage,
|
||||
MetadataProvidersConfigurationFingerprint = metadataProvidersConfigurationFingerprint,
|
||||
|
||||
+4
@@ -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="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="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="completionThresholdPercentage">Optional. The percentage of a media library item that must be consumed for its session to be considered completed.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
@@ -42,6 +43,7 @@ public class AddLibraryCommandFixture
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = true,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
bool isContentOnSsd = false,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
|
||||
@@ -57,6 +59,7 @@ public class AddLibraryCommandFixture
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
null
|
||||
@@ -70,6 +73,7 @@ public class AddLibraryCommandFixture
|
||||
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
|
||||
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
|
||||
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
|
||||
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
|
||||
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
+4
@@ -31,6 +31,7 @@ public class UpdateLibraryCommandFixture
|
||||
/// <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="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged 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="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="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
@@ -47,6 +48,7 @@ public class UpdateLibraryCommandFixture
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = true,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
bool isContentOnSsd = false,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
|
||||
@@ -64,6 +66,7 @@ public class UpdateLibraryCommandFixture
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
null
|
||||
@@ -79,6 +82,7 @@ public class UpdateLibraryCommandFixture
|
||||
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
|
||||
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
|
||||
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
|
||||
.RuleFor(x => x.IsContentOnSsd, isContentOnSsd)
|
||||
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
+3
@@ -28,6 +28,7 @@ public class AddLibraryRequestFixture
|
||||
/// <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="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged 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="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="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
@@ -42,6 +43,7 @@ public class AddLibraryRequestFixture
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
bool? isContentOnSsd = null,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
|
||||
@@ -56,6 +58,7 @@ public class AddLibraryRequestFixture
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
isContentOnSsd ?? false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
pathTemplateParts
|
||||
|
||||
+3
@@ -31,6 +31,7 @@ public class UpdateLibraryRequestFixture
|
||||
/// <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="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged 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="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="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
@@ -47,6 +48,7 @@ public class UpdateLibraryRequestFixture
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
bool? isContentOnSsd = null,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
|
||||
@@ -63,6 +65,7 @@ public class UpdateLibraryRequestFixture
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
isContentOnSsd ?? false,
|
||||
shouldTrackConsumptionProgress,
|
||||
completionThresholdPercentage,
|
||||
pathTemplateParts
|
||||
|
||||
+3
@@ -32,6 +32,7 @@ public class LibraryResponseFixture
|
||||
/// <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="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged 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="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="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
@@ -50,6 +51,7 @@ public class LibraryResponseFixture
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
bool? isContentOnSsd = null,
|
||||
bool? shouldTrackConsumptionProgress = null,
|
||||
int? completionThresholdPercentage = null,
|
||||
List<LibraryPathTemplatePartResponse>? pathTemplateParts = null,
|
||||
@@ -70,6 +72,7 @@ public class LibraryResponseFixture
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
isContentOnSsd ?? false,
|
||||
resolvedShouldTrackConsumptionProgress,
|
||||
resolvedCompletionThresholdPercentage,
|
||||
pathTemplateParts ?? [],
|
||||
|
||||
+4
@@ -43,6 +43,7 @@ public class LibraryFixture
|
||||
/// <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="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged 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="consumptionSettings">Optional. The consumption settings of the library.</param>
|
||||
/// <param name="scanIds">Optional. The scan Ids associated with the library.</param>
|
||||
/// <param name="pathTemplate">Optional. The path template of the library.</param>
|
||||
@@ -60,6 +61,7 @@ public class LibraryFixture
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = false,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
bool isContentOnSsd = false,
|
||||
LibraryConsumptionSettings? consumptionSettings = null,
|
||||
IEnumerable<Guid>? scanIds = null,
|
||||
LibraryPathTemplate? pathTemplate = null,
|
||||
@@ -91,6 +93,7 @@ public class LibraryFixture
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
isContentOnSsd,
|
||||
resolvedConsumptionSettings,
|
||||
pathTemplate ?? LibraryPathTemplate.Empty(),
|
||||
resolvedScanIds
|
||||
@@ -107,6 +110,7 @@ public class LibraryFixture
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
isContentOnSsd,
|
||||
resolvedConsumptionSettings,
|
||||
pathTemplate ?? LibraryPathTemplate.Empty(),
|
||||
resolvedScanIds
|
||||
|
||||
+25
@@ -148,6 +148,31 @@ public class LibraryRepositoryTests
|
||||
Assert.Null(storedLibrary.CompletionThresholdPercentage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task InsertAsync_WhenLibraryContentIsOnSsd_ShouldPersistTheSetting()
|
||||
{
|
||||
// Arrange
|
||||
using SqliteConnection anchorConnection = new($"Data Source=luminadataccess-libraryrepo-insert-ssd-{Guid.NewGuid()};Mode=Memory;Cache=Shared");
|
||||
anchorConnection.Open();
|
||||
Guid userId = Guid.NewGuid();
|
||||
DateTime utcNow = new(2025, 1, 1, 12, 0, 0, DateTimeKind.Utc);
|
||||
using LuminaDbContext context = CreateAuditedContext(anchorConnection, userId, utcNow);
|
||||
LibraryRepository sut = new(context);
|
||||
context.Users.Add(_userEntityFixture.Create(id: userId));
|
||||
LibraryEntity library = _libraryEntityFixture.Create(userId: userId, isContentOnSsd: true, contentLocations: []);
|
||||
|
||||
// Act
|
||||
Result<Created> result = await sut.InsertAsync(library, CancellationToken.None);
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
Assert.Equal(Result.Created, result.Value);
|
||||
LibraryEntity? storedLibrary = await context.Libraries.AsNoTracking().FirstOrDefaultAsync(candidate => candidate.Id == library.Id);
|
||||
Assert.NotNull(storedLibrary);
|
||||
Assert.True(storedLibrary!.IsContentOnSsd);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UpdateAsync_WhenConsumptionSettingsAreEnabled_ShouldPersistTheTrackingAndThreshold()
|
||||
{
|
||||
|
||||
+3
-2
@@ -81,7 +81,7 @@ public class BooksFileSystemDiscoveryJobTests
|
||||
_scanId = _scanIdFixture.Create();
|
||||
_userId = _userIdFixture.Create();
|
||||
_libraryId = _libraryIdFixture.Create();
|
||||
_sut = new BooksFileSystemDiscoveryJob(_mockServiceScopeFactory)
|
||||
_sut = new BooksFileSystemDiscoveryJob(_mockServiceScopeFactory, Substitute.For<Microsoft.Extensions.Logging.ILogger<BooksFileSystemDiscoveryJob>>())
|
||||
{
|
||||
ScanId = _scanId,
|
||||
UserId = _userId,
|
||||
@@ -105,7 +105,8 @@ public class BooksFileSystemDiscoveryJobTests
|
||||
title: "Test Library",
|
||||
libraryType: LibraryType.Book,
|
||||
contentLocations: [temporaryLibraryDirectory.Path],
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false);
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: true);
|
||||
_mockLibraryRepository.GetByIdAsync(_libraryId.Value, cancellationToken: Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<LibraryEntity?>(libraryEntity));
|
||||
_mockStagingResultsRepository.InsertRangeAsync(Arg.Any<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(), Arg.Any<CancellationToken>())
|
||||
|
||||
+39
-7
@@ -40,6 +40,7 @@ public class FileHashServiceTests
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(
|
||||
inputFiles,
|
||||
shouldParallelizeReads: true,
|
||||
() =>
|
||||
{
|
||||
callbackInvocationCount++;
|
||||
@@ -66,7 +67,7 @@ public class FileHashServiceTests
|
||||
List<HashedFileSystemFileDto> inputFiles = [_hashedFileSystemFileDtoFixture.Create(path: filePath, size: new FileInfo(filePath).Length, currentHash: 0, oldHash: 0, ticks: 0)];
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
HashedFileSystemFileDto hashedFile = Assert.Single(result);
|
||||
@@ -83,10 +84,10 @@ public class FileHashServiceTests
|
||||
List<HashedFileSystemFileDto> firstInputFiles = [_hashedFileSystemFileDtoFixture.Create(path: filePath, size: new FileInfo(filePath).Length, currentHash: 0, oldHash: 0, ticks: 0)];
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> firstResult = await _sut.HashFilesAsync(firstInputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> firstResult = await _sut.HashFilesAsync(firstInputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
await File.WriteAllTextAsync(filePath, "changed content");
|
||||
List<HashedFileSystemFileDto> secondInputFiles = [_hashedFileSystemFileDtoFixture.Create(path: filePath, size: new FileInfo(filePath).Length, currentHash: 0, oldHash: 0, ticks: 0)];
|
||||
List<HashedFileSystemFileDto> secondResult = await _sut.HashFilesAsync(secondInputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> secondResult = await _sut.HashFilesAsync(secondInputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.NotEqual(firstResult[0].CurrentHash, secondResult[0].CurrentHash);
|
||||
@@ -100,7 +101,7 @@ public class FileHashServiceTests
|
||||
List<HashedFileSystemFileDto> inputFiles = [_hashedFileSystemFileDtoFixture.Create(path: nonExistentFilePath, size: 100, currentHash: 0, oldHash: 0, ticks: 0)];
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(result);
|
||||
@@ -119,7 +120,7 @@ public class FileHashServiceTests
|
||||
];
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
HashedFileSystemFileDto hashedFile = Assert.Single(result);
|
||||
@@ -127,6 +128,37 @@ public class FileHashServiceTests
|
||||
Assert.NotEqual(0UL, hashedFile.CurrentHash);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HashFilesAsync_WhenReadsAreNotParallelized_ShouldHashAllFilesSequentially()
|
||||
{
|
||||
// Arrange
|
||||
using TemporaryTestDirectory temporaryTestDirectory = new();
|
||||
string filePath1 = temporaryTestDirectory.CreateFile("book1.pdf", "content of the first book");
|
||||
string filePath2 = temporaryTestDirectory.CreateFile("book2.pdf", "content of the second book");
|
||||
List<HashedFileSystemFileDto> inputFiles =
|
||||
[
|
||||
_hashedFileSystemFileDtoFixture.Create(path: filePath1, size: new FileInfo(filePath1).Length, currentHash: 0, oldHash: 0, ticks: 0),
|
||||
_hashedFileSystemFileDtoFixture.Create(path: filePath2, size: new FileInfo(filePath2).Length, currentHash: 0, oldHash: 0, ticks: 0)
|
||||
];
|
||||
int callbackInvocationCount = 0;
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(
|
||||
inputFiles,
|
||||
shouldParallelizeReads: false,
|
||||
() =>
|
||||
{
|
||||
callbackInvocationCount++;
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(2, result.Count);
|
||||
Assert.Equal(2, callbackInvocationCount);
|
||||
Assert.All(result, file => Assert.NotEqual(0UL, file.CurrentHash));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HashFilesAsync_WhenCancellationRequested_ShouldCancelOperation()
|
||||
{
|
||||
@@ -138,7 +170,7 @@ public class FileHashServiceTests
|
||||
cancellationTokenSource.Cancel();
|
||||
|
||||
// Act
|
||||
Task<List<HashedFileSystemFileDto>> operation = _sut.HashFilesAsync(inputFiles, () => Task.CompletedTask, cancellationTokenSource.Token);
|
||||
Task<List<HashedFileSystemFileDto>> operation = _sut.HashFilesAsync(inputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, cancellationTokenSource.Token);
|
||||
|
||||
// Assert
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => operation);
|
||||
@@ -182,7 +214,7 @@ public class FileHashServiceTests
|
||||
List<HashedFileSystemFileDto> inputFiles = [_hashedFileSystemFileDtoFixture.Create(path: filePath, size: new FileInfo(filePath).Length, currentHash: 0, oldHash: 0, ticks: 0)];
|
||||
|
||||
// Act
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, () => Task.CompletedTask, CancellationToken.None);
|
||||
List<HashedFileSystemFileDto> result = await _sut.HashFilesAsync(inputFiles, shouldParallelizeReads: true, () => Task.CompletedTask, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
HashedFileSystemFileDto hashedFile = Assert.Single(result);
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ public class AddMediaLibraryRequestMappingTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: true,
|
||||
shouldTrackConsumptionProgress: true,
|
||||
completionThresholdPercentage: 90
|
||||
);
|
||||
@@ -49,6 +50,7 @@ public class AddMediaLibraryRequestMappingTests
|
||||
Assert.Equal(request.IsLocked, result.IsLocked);
|
||||
Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb);
|
||||
Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd);
|
||||
Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
|
||||
Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
|
||||
}
|
||||
|
||||
+5
-1
@@ -32,7 +32,8 @@ public class LibraryEntityMappingTests
|
||||
title: "My Library",
|
||||
libraryType: LibraryType.Book,
|
||||
contentLocations: ["C:/Books", "D:/Media/Books"],
|
||||
coverImage: "D:/myPoster.jpg");
|
||||
coverImage: "D:/myPoster.jpg",
|
||||
isContentOnSsd: true);
|
||||
|
||||
// Act
|
||||
LibraryResponse result = entity.ToResponse();
|
||||
@@ -45,6 +46,7 @@ public class LibraryEntityMappingTests
|
||||
Assert.Equal(entity.LibraryType, result.LibraryType);
|
||||
Assert.Equal(entity.ContentLocations.Select(l => l.Path), result.ContentLocations);
|
||||
Assert.Equal(entity.CoverImage, result.CoverImage);
|
||||
Assert.Equal(entity.IsContentOnSsd, result.IsContentOnSsd);
|
||||
Assert.Equal(entity.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
|
||||
Assert.Equal(entity.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
|
||||
Assert.Equal(entity.CreatedOnUtc, result.CreatedOnUtc);
|
||||
@@ -188,6 +190,7 @@ public class LibraryEntityMappingTests
|
||||
libraryType: LibraryType.Book,
|
||||
contentLocations: ["C:/Books"],
|
||||
coverImage: "D:/cover.jpg",
|
||||
isContentOnSsd: true,
|
||||
pathTemplateParts: [firstPart, secondPart]);
|
||||
|
||||
// Act
|
||||
@@ -200,6 +203,7 @@ public class LibraryEntityMappingTests
|
||||
Assert.Equal(entity.Title, result.Value.Title);
|
||||
Assert.Equal(entity.LibraryType, result.Value.LibraryType);
|
||||
Assert.Equal("D:/cover.jpg", result.Value.CoverImage.Value);
|
||||
Assert.Equal(entity.IsContentOnSsd, result.Value.IsContentOnSsd);
|
||||
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(2, result.Value.PathTemplate.Parts.Count);
|
||||
|
||||
+1
@@ -60,6 +60,7 @@ public class LibraryMappingTests
|
||||
Assert.False(result.IsLocked);
|
||||
Assert.True(result.CanDownloadMetadataFromWeb);
|
||||
Assert.False(result.ShouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(library.IsContentOnSsd, result.IsContentOnSsd);
|
||||
Assert.Equal(library.ConsumptionSettings.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
|
||||
Assert.Equal(library.ConsumptionSettings.CompletionThresholdPercentage.HasValue ? library.ConsumptionSettings.CompletionThresholdPercentage.Value : null, result.CompletionThresholdPercentage);
|
||||
Assert.Equal(library.ScanIds.Select(scanId => scanId.Value), result.LibraryScans.Select(libraryScan => libraryScan.Id));
|
||||
|
||||
+2
@@ -32,6 +32,7 @@ public class UpdateLibraryRequestMappingTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: true,
|
||||
shouldTrackConsumptionProgress: true,
|
||||
completionThresholdPercentage: 90);
|
||||
|
||||
@@ -49,6 +50,7 @@ public class UpdateLibraryRequestMappingTests
|
||||
Assert.Equal(request.CanDownloadMetadataFromWeb, result.CanDownloadMetadataFromWeb);
|
||||
Assert.Equal(request.ShouldSaveMetadataInMediaDirectories, result.ShouldSaveMetadataInMediaDirectories);
|
||||
Assert.Equal(request.ShouldSkipUnchangedDirectoriesDuringScan, result.ShouldSkipUnchangedDirectoriesDuringScan);
|
||||
Assert.Equal(request.IsContentOnSsd, result.IsContentOnSsd);
|
||||
Assert.Equal(request.ShouldTrackConsumptionProgress, result.ShouldTrackConsumptionProgress);
|
||||
Assert.Equal(request.CompletionThresholdPercentage, result.CompletionThresholdPercentage);
|
||||
}
|
||||
|
||||
+18
@@ -62,6 +62,7 @@ public class LibraryConfigurationTests
|
||||
IProperty downloadMetadataProperty = entityType.GetProperty(nameof(LibraryEntity.CanDownloadMetadataFromWeb));
|
||||
IProperty shouldTrackConsumptionProgressProperty = entityType.GetProperty(nameof(LibraryEntity.ShouldTrackConsumptionProgress));
|
||||
IProperty completionThresholdPercentageProperty = entityType.GetProperty(nameof(LibraryEntity.CompletionThresholdPercentage));
|
||||
IProperty isContentOnSsdProperty = entityType.GetProperty(nameof(LibraryEntity.IsContentOnSsd));
|
||||
|
||||
// Assert
|
||||
Assert.False(titleProperty.IsNullable);
|
||||
@@ -76,6 +77,23 @@ public class LibraryConfigurationTests
|
||||
Assert.Equal(typeof(int?), completionThresholdPercentageProperty.ClrType);
|
||||
Assert.True(completionThresholdPercentageProperty.IsNullable);
|
||||
Assert.Null(completionThresholdPercentageProperty.GetDefaultValue());
|
||||
Assert.Equal(typeof(bool), isContentOnSsdProperty.ClrType);
|
||||
Assert.False(isContentOnSsdProperty.IsNullable);
|
||||
Assert.Equal(false, isContentOnSsdProperty.GetDefaultValue());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Configure_WhenApplied_ShouldConfigureSsdContentColumnOrder()
|
||||
{
|
||||
// Arrange
|
||||
IEntityType entityType = DesignTimeModel.FindEntityType(typeof(LibraryEntity))!;
|
||||
|
||||
// Act
|
||||
IProperty isContentOnSsdProperty = entityType.GetProperty(nameof(LibraryEntity.IsContentOnSsd));
|
||||
|
||||
// Assert
|
||||
Assert.Equal(18, isContentOnSsdProperty.GetColumnOrder());
|
||||
Assert.Equal(nameof(LibraryEntity.IsContentOnSsd), isContentOnSsdProperty.GetColumnName());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+6
@@ -56,6 +56,7 @@ public class LibraryTests
|
||||
canDownloadMetadataFromWeb: false,
|
||||
shouldSaveMetadataInMediaDirectories: true,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: true,
|
||||
isContentOnSsd: true,
|
||||
consumptionSettings,
|
||||
LibraryPathTemplate.Empty(),
|
||||
scanIds);
|
||||
@@ -73,6 +74,7 @@ public class LibraryTests
|
||||
Assert.False(result.Value.CanDownloadMetadataFromWeb);
|
||||
Assert.True(result.Value.ShouldSaveMetadataInMediaDirectories);
|
||||
Assert.True(result.Value.ShouldSkipUnchangedDirectoriesDuringScan);
|
||||
Assert.True(result.Value.IsContentOnSsd);
|
||||
Assert.Equal(consumptionSettings, result.Value.ConsumptionSettings);
|
||||
Assert.Equal(scanIds, result.Value.ScanIds);
|
||||
}
|
||||
@@ -97,6 +99,7 @@ public class LibraryTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: false,
|
||||
_libraryConsumptionSettingsFixture.Create(),
|
||||
LibraryPathTemplate.Empty(),
|
||||
scanIds);
|
||||
@@ -125,6 +128,7 @@ public class LibraryTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: false,
|
||||
_libraryConsumptionSettingsFixture.Create(),
|
||||
LibraryPathTemplate.Empty(),
|
||||
[]);
|
||||
@@ -162,6 +166,7 @@ public class LibraryTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: false,
|
||||
_libraryConsumptionSettingsFixture.Create(),
|
||||
LibraryPathTemplate.Empty(),
|
||||
[]);
|
||||
@@ -191,6 +196,7 @@ public class LibraryTests
|
||||
canDownloadMetadataFromWeb: true,
|
||||
shouldSaveMetadataInMediaDirectories: false,
|
||||
shouldSkipUnchangedDirectoriesDuringScan: false,
|
||||
isContentOnSsd: false,
|
||||
_libraryConsumptionSettingsFixture.Create(),
|
||||
LibraryPathTemplate.Empty(),
|
||||
[]);
|
||||
|
||||
+66
-3
@@ -19,10 +19,12 @@ using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.U
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Audio.Music;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -38,6 +40,7 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
{
|
||||
private const string ROOT_PATH = @"C:\Music";
|
||||
private const string AUDIO_FILE_PATH = @"C:\Music\song.mp3";
|
||||
private const string SECOND_AUDIO_FILE_PATH = @"C:\Music\other.mp3";
|
||||
private const string IMAGE_FILE_PATH = @"C:\Music\cover.jpg";
|
||||
|
||||
private readonly IServiceScopeFactory _mockServiceScopeFactory;
|
||||
@@ -50,6 +53,7 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
private readonly IFileProviderService _mockFileProviderService;
|
||||
private readonly IDirectoryProviderService _mockDirectoryProviderService;
|
||||
private readonly IDomainEventPublisher _mockDomainEventPublisher;
|
||||
private readonly ILogger<MusicFileSystemDiscoveryJob> _mockLogger;
|
||||
private readonly MusicFileSystemDiscoveryJob _sut;
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly DirectoryScanFingerprintEntityFixture _directoryScanFingerprintEntityFixture = new();
|
||||
@@ -101,7 +105,9 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
_libraryId = _libraryIdFixture.Create();
|
||||
_scanId = _scanIdFixture.Create();
|
||||
_userId = _userIdFixture.Create();
|
||||
_sut = new MusicFileSystemDiscoveryJob(_mockServiceScopeFactory)
|
||||
_mockLogger = Substitute.For<ILogger<MusicFileSystemDiscoveryJob>>();
|
||||
_mockLogger.IsEnabled(Arg.Any<LogLevel>()).Returns(true);
|
||||
_sut = new MusicFileSystemDiscoveryJob(_mockServiceScopeFactory, _mockLogger)
|
||||
{
|
||||
ScanId = _scanId,
|
||||
UserId = _userId,
|
||||
@@ -182,6 +188,45 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTheLibraryIsOnSsd_ShouldReadInParallelAndSkipFilesThatBecomeInaccessible()
|
||||
{
|
||||
// Arrange
|
||||
SetupLibrary(isContentOnSsd: true);
|
||||
SetupDirectory(ROOT_PATH, files: [AUDIO_FILE_PATH, SECOND_AUDIO_FILE_PATH, IMAGE_FILE_PATH], subdirectories: []);
|
||||
_mockFileProviderService.GetSize(Arg.Is<FileSystemPathId>(path => path.Path == AUDIO_FILE_PATH))
|
||||
.Returns(_ => throw new IOException("The file vanished between enumeration and processing"));
|
||||
_mockFileProviderService.GetSize(Arg.Is<FileSystemPathId>(path => path.Path == SECOND_AUDIO_FILE_PATH)).Returns(Result.From<long?>(1234L));
|
||||
_mockFileProviderService.GetLastWriteTime(Arg.Is<FileSystemPathId>(path => path.Path == SECOND_AUDIO_FILE_PATH))
|
||||
.Returns(Result.From(Optional<DateTime>.Some(new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc))));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
// The sequential path does not catch per-file IO exceptions, so completing here proves the parallel path was taken.
|
||||
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
|
||||
await _mockStagingResultsRepository.Received(1).InsertRangeAsync(
|
||||
Arg.Is<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(entities => entities.Count == 1
|
||||
&& entities.First().Path == SECOND_AUDIO_FILE_PATH
|
||||
&& entities.First().Size == 1234
|
||||
&& entities.First().LibraryScanId == _scanId.Value
|
||||
&& entities.First().NeedsRehash),
|
||||
Arg.Any<CancellationToken>());
|
||||
_mockLogger.Received(1).Log(
|
||||
LogLevel.Debug,
|
||||
Arg.Any<EventId>(),
|
||||
Arg.Is<object>(state => state.ToString()!.Contains("solid state drive", StringComparison.Ordinal)),
|
||||
Arg.Any<Exception?>(),
|
||||
Arg.Any<Func<object, Exception?, string>>());
|
||||
_mockLogger.Received(1).Log(
|
||||
LogLevel.Warning,
|
||||
Arg.Any<EventId>(),
|
||||
Arg.Is<object>(state => state.ToString()!.Contains(AUDIO_FILE_PATH, StringComparison.Ordinal)),
|
||||
Arg.Any<IOException>(),
|
||||
Arg.Any<Func<object, Exception?, string>>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTheSubdirectoryHasAudioFiles_ShouldTraverseIntoIt()
|
||||
{
|
||||
@@ -301,6 +346,22 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenAFileMetadataReadThrowsAnUnexpectedException_ShouldMarkJobAsFailed()
|
||||
{
|
||||
// Arrange
|
||||
SetupLibrary(isContentOnSsd: true);
|
||||
SetupDirectory(ROOT_PATH, files: [AUDIO_FILE_PATH], subdirectories: []);
|
||||
_mockFileProviderService.GetSize(Arg.Any<FileSystemPathId>()).Returns(_ => throw new InvalidOperationException("Unexpected defect"));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Failed, _sut.Status);
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTheFingerprintUpsertFails_ShouldMarkJobAsFailed()
|
||||
{
|
||||
@@ -342,13 +403,15 @@ public class MusicFileSystemDiscoveryJobTests
|
||||
/// Stubs the media library reader with a library whose single content location is the test root path.
|
||||
/// </summary>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether the library skips the directories that have not changed since the last scan.</param>
|
||||
private void SetupLibrary(bool shouldSkipUnchangedDirectoriesDuringScan = false)
|
||||
/// <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)
|
||||
{
|
||||
LibraryEntity library = _libraryEntityFixture.Create(
|
||||
id: _libraryId.Value,
|
||||
libraryType: LibraryType.Music,
|
||||
contentLocations: [ROOT_PATH],
|
||||
shouldSkipUnchangedDirectoriesDuringScan: shouldSkipUnchangedDirectoriesDuringScan);
|
||||
shouldSkipUnchangedDirectoriesDuringScan: shouldSkipUnchangedDirectoriesDuringScan,
|
||||
isContentOnSsd: isContentOnSsd);
|
||||
_mockLibraryRepository.GetByIdAsync(Arg.Any<Guid>(), cancellationToken: Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<LibraryEntity?>(library));
|
||||
}
|
||||
|
||||
+72
-8
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Common.Infrastructure.Models.DTO.MediaLibraryScanJobPayloads;
|
||||
@@ -13,6 +14,7 @@ using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggreg
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Fixtures.Common.Infrastructure.Models.DTO.MediaLibraryScanJobPayloads;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.Common;
|
||||
@@ -38,6 +40,7 @@ public class MediaLibraryScanHashJobTests
|
||||
private readonly IServiceScope _mockServiceScope;
|
||||
private readonly IServiceProvider _mockServiceProvider;
|
||||
private readonly IUnitOfWork _mockUnitOfWork;
|
||||
private readonly ILibraryRepository _mockLibraryRepository;
|
||||
private readonly ILibraryScanStagingResultsRepository _mockStagingResultsRepository;
|
||||
private readonly IDomainEventPublisher _mockDomainEventPublisher;
|
||||
private readonly IFileHashService _mockFileHashService;
|
||||
@@ -46,6 +49,7 @@ public class MediaLibraryScanHashJobTests
|
||||
private readonly UserIdFixture _userIdFixture = new();
|
||||
private readonly LibraryIdFixture _libraryIdFixture = new();
|
||||
private readonly HashedFileSystemFileDtoFixture _hashedFileSystemFileDtoFixture = new();
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly ScanId _scanId;
|
||||
private readonly UserId _userId;
|
||||
private readonly LibraryId _libraryId;
|
||||
@@ -63,7 +67,9 @@ public class MediaLibraryScanHashJobTests
|
||||
|
||||
_mockUnitOfWork = Substitute.For<IUnitOfWork>();
|
||||
_mockUnitOfWork.SaveChangesAsync(Arg.Any<CancellationToken>()).Returns(Result.Success);
|
||||
_mockLibraryRepository = Substitute.For<ILibraryRepository>();
|
||||
_mockStagingResultsRepository = Substitute.For<ILibraryScanStagingResultsRepository>();
|
||||
_mockUnitOfWork.LibraryRepository.Returns(_mockLibraryRepository);
|
||||
_mockUnitOfWork.LibraryScanStagingResultsRepository.Returns(_mockStagingResultsRepository);
|
||||
_mockServiceProvider.GetService(typeof(IUnitOfWork)).Returns(_mockUnitOfWork);
|
||||
|
||||
@@ -84,6 +90,9 @@ public class MediaLibraryScanHashJobTests
|
||||
UserId = _userId,
|
||||
LibraryId = _libraryId
|
||||
};
|
||||
|
||||
_mockLibraryRepository.GetByIdAsync(_libraryId.Value, Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<LibraryEntity?>(_libraryEntityFixture.Create(id: _libraryId.Value, userId: _userId.Value, isContentOnSsd: true)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,7 +106,7 @@ public class MediaLibraryScanHashJobTests
|
||||
.Returns(
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>(filesToHash),
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>([]));
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(callInfo => Task.FromResult(callInfo.Arg<IReadOnlyCollection<HashedFileSystemFileDto>>()
|
||||
.Select(file => file with { CurrentHash = 42UL })
|
||||
.ToList()));
|
||||
@@ -111,6 +120,7 @@ public class MediaLibraryScanHashJobTests
|
||||
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
|
||||
await _mockFileHashService.Received(1).HashFilesAsync(
|
||||
Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(),
|
||||
Arg.Is<bool>(shouldParallelizeReads => shouldParallelizeReads),
|
||||
Arg.Any<Func<Task>>(),
|
||||
Arg.Any<CancellationToken>());
|
||||
await _mockStagingResultsRepository.Received(1).UpdateFileHashesAsync(
|
||||
@@ -120,6 +130,59 @@ public class MediaLibraryScanHashJobTests
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanProgressChangedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenLibraryIsNotOnSsd_ShouldHashTheFilesSequentially()
|
||||
{
|
||||
// Arrange
|
||||
_mockLibraryRepository.GetByIdAsync(_libraryId.Value, Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From<LibraryEntity?>(_libraryEntityFixture.Create(id: _libraryId.Value, userId: _userId.Value, isContentOnSsd: false)));
|
||||
List<HashedFileSystemFileDto> filesToHash = [_hashedFileSystemFileDtoFixture.Create(path: "/books/book1.pdf")];
|
||||
_mockStagingResultsRepository.GetFilesToHashCountAsync(_scanId.Value, Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From(1));
|
||||
_mockStagingResultsRepository.GetFilesToHashPageAsync(_scanId.Value, Arg.Any<string?>(), Arg.Any<int>(), Arg.Any<CancellationToken>())
|
||||
.Returns(
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>(filesToHash),
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>([]));
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(callInfo => Task.FromResult(callInfo.Arg<IReadOnlyCollection<HashedFileSystemFileDto>>()
|
||||
.Select(file => file with { CurrentHash = 42UL })
|
||||
.ToList()));
|
||||
_mockStagingResultsRepository.UpdateFileHashesAsync(_scanId.Value, Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From(Result.Updated));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
|
||||
await _mockFileHashService.Received(1).HashFilesAsync(
|
||||
Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(),
|
||||
Arg.Is<bool>(shouldParallelizeReads => !shouldParallelizeReads),
|
||||
Arg.Any<Func<Task>>(),
|
||||
Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenGettingTheLibraryFails_ShouldMarkJobAsFailedAndPublishFailureEvent()
|
||||
{
|
||||
// Arrange
|
||||
_mockStagingResultsRepository.GetFilesToHashCountAsync(_scanId.Value, Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From(1));
|
||||
_mockLibraryRepository.GetByIdAsync(_libraryId.Value, Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>())
|
||||
.Returns(Error.Failure("Database.Error", "Failed to retrieve the library"));
|
||||
|
||||
// Act
|
||||
await _sut.ExecuteAsync(Guid.NewGuid(), new { }, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Failed, _sut.Status);
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent =>
|
||||
domainEvent.LibraryId == _libraryId
|
||||
&& domainEvent.MediaLibraryScanCompositeId.ScanId == _scanId
|
||||
&& domainEvent.MediaLibraryScanCompositeId.UserId == _userId), Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenNoFilesNeedHashing_ShouldCompleteWithoutHashing()
|
||||
{
|
||||
@@ -134,7 +197,8 @@ public class MediaLibraryScanHashJobTests
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Completed, _sut.Status);
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockLibraryRepository.DidNotReceive().GetByIdAsync(Arg.Any<Guid>(), Arg.Any<bool>(), Arg.Any<bool>(), Arg.Any<CancellationToken>());
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockStagingResultsRepository.DidNotReceive().UpdateFileHashesAsync(Arg.Any<Guid>(), Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<CancellationToken>());
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanProgressChangedDomainEvent>(domainEvent => domainEvent.LibraryId == _libraryId), Arg.Any<CancellationToken>());
|
||||
}
|
||||
@@ -151,7 +215,7 @@ public class MediaLibraryScanHashJobTests
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Failed, _sut.Status);
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent =>
|
||||
domainEvent.LibraryId == _libraryId
|
||||
&& domainEvent.MediaLibraryScanCompositeId.ScanId == _scanId
|
||||
@@ -187,7 +251,7 @@ public class MediaLibraryScanHashJobTests
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Failed, _sut.Status);
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockFileHashService.DidNotReceive().HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent =>
|
||||
domainEvent.LibraryId == _libraryId
|
||||
&& domainEvent.MediaLibraryScanCompositeId.ScanId == _scanId
|
||||
@@ -205,7 +269,7 @@ public class MediaLibraryScanHashJobTests
|
||||
.Returns(
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>(filesToHash),
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>([]));
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(callInfo => Task.FromResult(callInfo.Arg<IReadOnlyCollection<HashedFileSystemFileDto>>()
|
||||
.Select(file => file with { CurrentHash = 42UL })
|
||||
.ToList()));
|
||||
@@ -217,7 +281,7 @@ public class MediaLibraryScanHashJobTests
|
||||
|
||||
// Assert
|
||||
Assert.Equal(LibraryScanJobStatus.Failed, _sut.Status);
|
||||
await _mockFileHashService.Received(1).HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockFileHashService.Received(1).HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>());
|
||||
await _mockDomainEventPublisher.Received(1).PublishAsync(Arg.Is<LibraryScanFailedDomainEvent>(domainEvent =>
|
||||
domainEvent.LibraryId == _libraryId
|
||||
&& domainEvent.MediaLibraryScanCompositeId.ScanId == _scanId
|
||||
@@ -235,7 +299,7 @@ public class MediaLibraryScanHashJobTests
|
||||
.Returns(
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>(filesToHash),
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>([]));
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(async callInfo =>
|
||||
{
|
||||
await callInfo.Arg<Func<Task>>()();
|
||||
@@ -268,7 +332,7 @@ public class MediaLibraryScanHashJobTests
|
||||
.Returns(
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>(filesToHash),
|
||||
Result.From<IReadOnlyList<HashedFileSystemFileDto>>([]));
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
_mockFileHashService.HashFilesAsync(Arg.Any<IReadOnlyCollection<HashedFileSystemFileDto>>(), Arg.Any<bool>(), Arg.Any<Func<Task>>(), Arg.Any<CancellationToken>())
|
||||
.Returns(async callInfo =>
|
||||
{
|
||||
await Task.Delay(150);
|
||||
|
||||
+87
-1
@@ -2,6 +2,7 @@
|
||||
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Application.Common.DataAccess.Repositories.MediaLibrary;
|
||||
using Lumina.Application.Common.DataAccess.UoW;
|
||||
using Lumina.Application.Fixtures.Common.DataAccess.Entities.MediaLibrary.Management;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
@@ -15,10 +16,13 @@ using Lumina.Domain.Fixtures.Core.BoundedContexts.UserManagementBoundedContext.U
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using Lumina.Infrastructure.Core.MediaLibrary.Management.Scanning.Jobs.WrittenContent.Books;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NSubstitute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
@@ -38,7 +42,9 @@ public class BooksFileSystemDiscoveryJobTests
|
||||
private readonly ILibraryRepository _mockLibraryRepository;
|
||||
private readonly ILibraryScanStagingResultsRepository _mockStagingResultsRepository;
|
||||
private readonly IDomainEventPublisher _mockDomainEventPublisher;
|
||||
private readonly ILogger<BooksFileSystemDiscoveryJob> _mockLogger;
|
||||
private readonly BooksFileSystemDiscoveryJob _sut;
|
||||
private readonly LibraryEntityFixture _libraryEntityFixture = new();
|
||||
private readonly ScanIdFixture _scanIdFixture = new();
|
||||
private readonly UserIdFixture _userIdFixture = new();
|
||||
private readonly LibraryIdFixture _libraryIdFixture = new();
|
||||
@@ -73,7 +79,9 @@ public class BooksFileSystemDiscoveryJobTests
|
||||
_scanId = _scanIdFixture.Create();
|
||||
_userId = _userIdFixture.Create();
|
||||
_libraryId = _libraryIdFixture.Create();
|
||||
_sut = new BooksFileSystemDiscoveryJob(_mockServiceScopeFactory)
|
||||
_mockLogger = Substitute.For<ILogger<BooksFileSystemDiscoveryJob>>();
|
||||
_mockLogger.IsEnabled(Arg.Any<LogLevel>()).Returns(true);
|
||||
_sut = new BooksFileSystemDiscoveryJob(_mockServiceScopeFactory, _mockLogger)
|
||||
{
|
||||
ScanId = _scanId,
|
||||
UserId = _userId,
|
||||
@@ -130,4 +138,82 @@ public class BooksFileSystemDiscoveryJobTests
|
||||
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => operation);
|
||||
Assert.Equal(LibraryScanJobStatus.Canceled, _sut.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ExecuteAsync_WhenTheLibraryIsOnSsd_ShouldLogThatTheFileSystemReadsRunInParallel()
|
||||
{
|
||||
// Arrange
|
||||
string temporaryDirectoryPath = Path.Combine(Path.GetTempPath(), $"lumina-books-ssd-{Guid.NewGuid()}");
|
||||
Directory.CreateDirectory(temporaryDirectoryPath);
|
||||
File.WriteAllText(Path.Combine(temporaryDirectoryPath, "book.pdf"), "book content");
|
||||
try
|
||||
{
|
||||
LibraryEntity libraryEntity = _libraryEntityFixture.Create(
|
||||
id: _libraryId.Value,
|
||||
userId: _userId.Value,
|
||||
libraryType: LibraryType.Book,
|
||||
contentLocations: [temporaryDirectoryPath],
|
||||
isContentOnSsd: 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 == 1 && Path.GetFileName(entities.First().Path) == "book.pdf"),
|
||||
Arg.Any<CancellationToken>());
|
||||
_mockLogger.Received(1).Log(
|
||||
LogLevel.Debug,
|
||||
Arg.Any<EventId>(),
|
||||
Arg.Is<object>(state => state.ToString()!.Contains("solid state drive", StringComparison.Ordinal)),
|
||||
Arg.Any<Exception?>(),
|
||||
Arg.Any<Func<object, Exception?, string>>());
|
||||
}
|
||||
finally
|
||||
{
|
||||
Directory.Delete(temporaryDirectoryPath, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StageFilesInParallelAsync_WhenAFileVanishesBeforeItsMetadataIsRead_ShouldSkipItAndLogAWarning()
|
||||
{
|
||||
// Arrange
|
||||
FileInfo vanishedFile = new(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString(), "vanished.pdf"));
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch = [];
|
||||
|
||||
// Act
|
||||
await _sut.StageFilesInParallelAsync([vanishedFile], stagingBatch, _mockStagingResultsRepository, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(stagingBatch);
|
||||
await _mockStagingResultsRepository.DidNotReceive().InsertRangeAsync(Arg.Any<IReadOnlyCollection<LibraryScanStagingResultsEntity>>(), Arg.Any<CancellationToken>());
|
||||
_mockLogger.Received(1).Log(
|
||||
LogLevel.Warning,
|
||||
Arg.Any<EventId>(),
|
||||
Arg.Is<object>(state => state.ToString()!.Contains("vanished.pdf", StringComparison.Ordinal)),
|
||||
Arg.Any<IOException>(),
|
||||
Arg.Any<Func<object, Exception?, string>>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task StageFilesInParallelAsync_WhenAFileReadThrowsAnUnexpectedException_ShouldRethrowTheRealCause()
|
||||
{
|
||||
// Arrange
|
||||
List<LibraryScanStagingResultsEntity> stagingBatch = [];
|
||||
List<FileInfo> files = [null!];
|
||||
|
||||
// Act
|
||||
Exception exception = await Assert.ThrowsAsync<NullReferenceException>(() =>
|
||||
_sut.StageFilesInParallelAsync(files, stagingBatch, _mockStagingResultsRepository, CancellationToken.None));
|
||||
|
||||
// Assert
|
||||
// Parallel.For wraps the body exception in an AggregateException, which would otherwise be reported as "One or more errors occurred.".
|
||||
Assert.IsType<NullReferenceException>(exception);
|
||||
}
|
||||
}
|
||||
+2
@@ -87,6 +87,7 @@ public class AddLibraryEndpointTests
|
||||
{
|
||||
// Arrange
|
||||
AddLibraryRequest request = _addLibraryRequestFixture.Create(
|
||||
isContentOnSsd: true,
|
||||
shouldTrackConsumptionProgress: true,
|
||||
completionThresholdPercentage: 65);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
@@ -108,6 +109,7 @@ public class AddLibraryEndpointTests
|
||||
command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb &&
|
||||
command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories &&
|
||||
command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan &&
|
||||
command.IsContentOnSsd == request.IsContentOnSsd &&
|
||||
command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress &&
|
||||
command.CompletionThresholdPercentage == request.CompletionThresholdPercentage),
|
||||
Arg.Is(cancellationToken));
|
||||
|
||||
+2
@@ -87,6 +87,7 @@ public class UpdateLibraryEndpointTests
|
||||
{
|
||||
// Arrange
|
||||
UpdateLibraryRequest request = _updateLibraryRequestFixture.Create(
|
||||
isContentOnSsd: true,
|
||||
shouldTrackConsumptionProgress: true,
|
||||
completionThresholdPercentage: 65);
|
||||
CancellationToken cancellationToken = CancellationToken.None;
|
||||
@@ -110,6 +111,7 @@ public class UpdateLibraryEndpointTests
|
||||
command.CanDownloadMetadataFromWeb == request.CanDownloadMetadataFromWeb &&
|
||||
command.ShouldSaveMetadataInMediaDirectories == request.ShouldSaveMetadataInMediaDirectories &&
|
||||
command.ShouldSkipUnchangedDirectoriesDuringScan == request.ShouldSkipUnchangedDirectoriesDuringScan &&
|
||||
command.IsContentOnSsd == request.IsContentOnSsd &&
|
||||
command.ShouldTrackConsumptionProgress == request.ShouldTrackConsumptionProgress &&
|
||||
command.CompletionThresholdPercentage == request.CompletionThresholdPercentage),
|
||||
Arg.Is(cancellationToken));
|
||||
|
||||
Reference in new issue
Block a user