mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 23:01:10 +00:00
Replaces the job queue with a scan queue that executes one media library scan at a time, in the order in which the scans were queued, so several libraries requested at once no longer run one complete job chain each on the thread pool shared with the web server. Keeps queued scans Pending and cancellable, reports them as queued, and cancels the executing scan and the queued ones when the user cancels all scans. A media library type without a scanner now fails its own scan instead of leaving it stuck Pending, without stopping the scans queued behind it. Makes the file system discovery job the only top level job of a scan graph, so awaiting it completes the whole scan, and leaves one logical processor free for the rest of the process while discovery and hashing read files in parallel. Removes the per job Task.Run wrappers, links the scan cancellation with the host shutdown token in the scan processor, updates the ADR amendments, API documentation, manual, web client and tests, and normalizes the comments of the touched files.
11 KiB
11 KiB
Lumina API
- Lumina API
Library
Add Library
Add Library Request
POST api/v1/libraries
{
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": []
}
Add Library Response
201 Created
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
}
Get Libraries
Get Libraries Request
GET api/v1/libraries
Get Libraries Response
200 Ok
[
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
}
]
Get Enabled Libraries
Get Enabled Libraries Request
GET api/v1/libraries/enabled
Get Enabled Libraries Response
200 Ok
[
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
}
]
Get Library
Get Library Request
GET api/v1/libraries/{id}
Get Library Response
200 Ok
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
}
Update Library
Update Library Request
PUT api/v1/libraries/{id}
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": []
}
Update Library Response
200 Ok
{
"id": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"title": "Books",
"libraryType": "Book",
"contentLocations": [
"/media/books"
],
"coverImage": null,
"isEnabled": true,
"isLocked": false,
"canDownloadMetadataFromWeb": true,
"shouldSaveMetadataInMediaDirectories": true,
"shouldSkipUnchangedDirectoriesDuringScan": true,
"isContentOnSsd": false,
"shouldTrackConsumptionProgress": true,
"completionThresholdPercentage": 100,
"pathTemplateParts": [],
"createdOnUtc": "2025-01-01T12:00:00.0000000Z",
"updatedOnUtc": null
}
Delete Library
Delete Library Request
DELETE api/v1/libraries/{id}
Delete Library Response
200 Ok
Scan Libraries
Scan Libraries Request
POST api/v1/libraries/scans
Scan Libraries Response
200 Ok
[
{
"scanId": "e7a2c9f4-6b3d-4f80-9e3a-2c1b0d8a4f56",
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a"
}
]
Scan Library
Scan Library Request
POST api/v1/libraries/{id}/scans
Scan Library Response
200 Ok
{
"scanId": "e7a2c9f4-6b3d-4f80-9e3a-2c1b0d8a4f56",
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a"
}
Get Running Library Scans
Get Running Library Scans Request
GET api/v1/libraries/scans/running
Get Running Library Scans Response
200 Ok
[
{
"scanId": "e7a2c9f4-6b3d-4f80-9e3a-2c1b0d8a4f56",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"totalJobs": 5,
"completedJobs": 2,
"currentJobProgress": {
"completedItems": 10,
"totalItems": 50,
"currentOperation": "Reading file system",
"progressPercentage": 20.0
},
"status": "Running",
"overallProgressPercentage": 40.0
},
{
"scanId": "0b5f8d21-9c3e-4a7b-8f6d-1e2a3b4c5d6e",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"libraryId": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a",
"totalJobs": 0,
"completedJobs": 0,
"currentJobProgress": {
"completedItems": 0,
"totalItems": 0,
"currentOperation": "Queued",
"progressPercentage": 0.0
},
"status": "Pending",
"overallProgressPercentage": 0.0
}
]
Queued scans are reported here too, with no jobs prepared yet, because media library scans are executed one at a time and a scan that was queued can wait for the scans ahead of it to finish before it starts.
Get Library Scan Progress
Get Library Scan Progress Request
GET api/v1/libraries/{libraryId}/scans/{scanId}/progress
Get Library Scan Progress Response
200 Ok
{
"scanId": "e7a2c9f4-6b3d-4f80-9e3a-2c1b0d8a4f56",
"userId": "2cff0c0f-3a67-4e30-b94f-f4e948a3b64f",
"libraryId": "3b3a19f3-1f5a-4d5a-9a3a-5c5a4a3a2a1a",
"totalJobs": 5,
"completedJobs": 2,
"currentJobProgress": {
"completedItems": 10,
"totalItems": 50,
"currentOperation": "Reading file system",
"progressPercentage": 20.0
},
"status": "Running",
"overallProgressPercentage": 40.0
}
Cancel Libraries Scan
Cancel Libraries Scan Request
POST api/v1/libraries/scans/cancel
Cancel Libraries Scan Response
204 No Content
Cancel Library Scan
Cancel Library Scan Request
POST api/v1/libraries/{libraryId}/scans/{scanId}/cancel
Cancel Library Scan Response
204 No Content
Get Library Path Template Parts
Get Library Path Template Parts Request
GET api/v1/libraries/path-template-parts/{libraryType}
Get Library Path Template Parts Response
200 Ok
{
"parts": [
{
"kind": "Artist",
"valueType": "Text",
"defaultRepresentation": "{0}",
"isOptionalByDefault": false
},
{
"kind": "DiscNumber",
"valueType": "Integer",
"defaultRepresentation": "{0:00}",
"isOptionalByDefault": true
}
],
"defaultTemplateParts": [
{
"kind": "Artist",
"representation": "{0}",
"isOptional": false
}
]
}