From 499ef4b4b6075e898b6162d2ae7e27400dc22a98 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Mon, 8 Nov 2021 22:55:25 +0000 Subject: [PATCH 01/13] EFCore 6 --- Accord/Accord.Imaging/Accord.Imaging.csproj | 2 +- .../Damselfly.Core.DbModels.csproj | 14 ++++++------- .../Damselfly.Core.Interfaces.csproj | 2 +- .../Damselfly.Core.Utils.csproj | 2 +- Damselfly.Core/Damselfly.Core.csproj | 20 +++++++++---------- .../Damselfly.ML.AccordFace.csproj | 2 +- .../Damselfly.ML.AzureFace.csproj | 2 +- .../Damselfly.ML.EmguFace.csproj | 2 +- .../Damselfly.ML.ObjectDetection.csproj | 4 ++-- .../Damselfly.Migrations.Postgres.csproj | 2 +- .../Damselfly.Migrations.Sqlite.csproj | 2 +- Damselfly.Web/Damselfly.Web.csproj | 12 +++++------ 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Accord/Accord.Imaging/Accord.Imaging.csproj b/Accord/Accord.Imaging/Accord.Imaging.csproj index d36159cb..50431d90 100644 --- a/Accord/Accord.Imaging/Accord.Imaging.csproj +++ b/Accord/Accord.Imaging/Accord.Imaging.csproj @@ -30,7 +30,7 @@ - + diff --git a/Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj b/Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj index 8baa07d7..2281c1d9 100644 --- a/Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj +++ b/Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj @@ -1,19 +1,19 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + diff --git a/Damselfly.Core.Interfaces/Damselfly.Core.Interfaces.csproj b/Damselfly.Core.Interfaces/Damselfly.Core.Interfaces.csproj index 84baaba7..329a8e21 100644 --- a/Damselfly.Core.Interfaces/Damselfly.Core.Interfaces.csproj +++ b/Damselfly.Core.Interfaces/Damselfly.Core.Interfaces.csproj @@ -3,7 +3,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Core.Utils/Damselfly.Core.Utils.csproj b/Damselfly.Core.Utils/Damselfly.Core.Utils.csproj index 247f8db2..d282d200 100644 --- a/Damselfly.Core.Utils/Damselfly.Core.Utils.csproj +++ b/Damselfly.Core.Utils/Damselfly.Core.Utils.csproj @@ -4,7 +4,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Core/Damselfly.Core.csproj b/Damselfly.Core/Damselfly.Core.csproj index 255cc217..2816834b 100644 --- a/Damselfly.Core/Damselfly.Core.csproj +++ b/Damselfly.Core/Damselfly.Core.csproj @@ -5,14 +5,14 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -26,14 +26,14 @@ - - - - + + + + - + diff --git a/Damselfly.ML.AccordFace/Damselfly.ML.AccordFace.csproj b/Damselfly.ML.AccordFace/Damselfly.ML.AccordFace.csproj index e208d497..8c498876 100644 --- a/Damselfly.ML.AccordFace/Damselfly.ML.AccordFace.csproj +++ b/Damselfly.ML.AccordFace/Damselfly.ML.AccordFace.csproj @@ -6,7 +6,7 @@ - + diff --git a/Damselfly.ML.AzureFace/Damselfly.ML.AzureFace.csproj b/Damselfly.ML.AzureFace/Damselfly.ML.AzureFace.csproj index 598c3200..1474335b 100644 --- a/Damselfly.ML.AzureFace/Damselfly.ML.AzureFace.csproj +++ b/Damselfly.ML.AzureFace/Damselfly.ML.AzureFace.csproj @@ -12,6 +12,6 @@ - + diff --git a/Damselfly.ML.EmguFace/Damselfly.ML.EmguFace.csproj b/Damselfly.ML.EmguFace/Damselfly.ML.EmguFace.csproj index 6a350459..223f8749 100644 --- a/Damselfly.ML.EmguFace/Damselfly.ML.EmguFace.csproj +++ b/Damselfly.ML.EmguFace/Damselfly.ML.EmguFace.csproj @@ -11,7 +11,7 @@ - + diff --git a/Damselfly.ML.ObjectDetection.ML/Damselfly.ML.ObjectDetection.csproj b/Damselfly.ML.ObjectDetection.ML/Damselfly.ML.ObjectDetection.csproj index 7a01e3a2..7efee596 100644 --- a/Damselfly.ML.ObjectDetection.ML/Damselfly.ML.ObjectDetection.csproj +++ b/Damselfly.ML.ObjectDetection.ML/Damselfly.ML.ObjectDetection.csproj @@ -6,11 +6,11 @@ - + - + diff --git a/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj b/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj index f39ca597..fc46ee87 100644 --- a/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj +++ b/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj @@ -2,7 +2,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj index c8eb6c02..441fc831 100644 --- a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj +++ b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj @@ -10,7 +10,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Web/Damselfly.Web.csproj b/Damselfly.Web/Damselfly.Web.csproj index 6a917acc..f34c86b5 100644 --- a/Damselfly.Web/Damselfly.Web.csproj +++ b/Damselfly.Web/Damselfly.Web.csproj @@ -75,7 +75,7 @@ - + @@ -84,17 +84,17 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - + \ No newline at end of file From d94b91e056d2b6a4c9cbcee248854975a3cc2da4 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Tue, 9 Nov 2021 00:18:26 +0000 Subject: [PATCH 02/13] Tabs --- Damselfly.Web/Pages/AboutPage.razor | 7 +- Damselfly.Web/Shared/About.razor | 103 +++++++--------------------- Damselfly.Web/Shared/Info.razor | 71 +++++++++++++++++++ Damselfly.Web/Shared/Stats.razor | 45 +++++++----- Damselfly.Web/Shared/Toolbar.razor | 2 +- Damselfly.Web/wwwroot/css/site.css | 23 +------ 6 files changed, 127 insertions(+), 124 deletions(-) create mode 100644 Damselfly.Web/Shared/Info.razor diff --git a/Damselfly.Web/Pages/AboutPage.razor b/Damselfly.Web/Pages/AboutPage.razor index 3cbfd41e..d1667e11 100644 --- a/Damselfly.Web/Pages/AboutPage.razor +++ b/Damselfly.Web/Pages/AboutPage.razor @@ -1,11 +1,8 @@ -@page "/about" +@page "/info" @inject ViewDataService ViewDataService -
- - -
+ @code { protected override void OnAfterRender(bool firstRender) diff --git a/Damselfly.Web/Shared/About.razor b/Damselfly.Web/Shared/About.razor index 03316c60..0bbaa671 100644 --- a/Damselfly.Web/Shared/About.razor +++ b/Damselfly.Web/Shared/About.razor @@ -1,84 +1,29 @@ @using System -@using Damselfly.Web.Shared -@inject IJSRuntime JsRuntime -@inject Damselfly.Core.Interfaces.IImageProcessorFactory imFactory -@implements IDisposable - -
-
- -
-

Damselfly v@Version © 2019-@DateTime.Now.Year Mark Otway, All rights reserved.

-

Server-based Digital Asset Management system

- -
-
-

Damselfly Desktop

- @if (FileExporter != null && FileExporter.IsDesktopHosted) - { -

Running in the Damselfly Desktop container, v@FileExporter.DesktopVersion

- } - - -

Credits/Thanks

-

- Powered by Blazor. - GUI Elements by MudBlazor. - Icons by Font-Awesome. - Image Processing by SkiaSharp - and SixLabors ImageSharp - and ImageMagick . - Face Detection by EmguCV and Accord.Net. - Facial recognition by Azure Cognitive Services Face API. - Object Detection based on MentalStack's code. - ExifTool @ExifService.ExifToolVer by Phil Harvey. - Dominant Colour calculation by Jelle Vergeer. -

- -

Want to Support Damselfly?

- -

- Damselfly is free, open-source software. But if you find it useful, and fancy buying me a coffee or a slice of pizza, that would - be appreciated! -
- Buy Me A Coffee -

-
-
-

Stats:

- -
-
-

Task Statuses:

- - - - View Server Logs +

Credits/Thanks

+

+ Powered by Blazor. + GUI Elements by MudBlazor. + Icons by Font-Awesome. + Image Processing by SkiaSharp + and SixLabors ImageSharp + and ImageMagick . + Face Detection by EmguCV and Accord.Net. + Facial recognition by Azure Cognitive Services Face API. + Object Detection based on MentalStack's code. + ExifTool @ExifService.ExifToolVer by Phil Harvey. + Dominant Colour calculation by Jelle Vergeer. +

+

Want to Support Damselfly?

+ +

+ Damselfly is free, open-source software. But if you find it useful, and fancy buying me a coffee or a slice of pizza, that would + be appreciated! +
+ Buy Me A Coffee +

+@code { - @code { - private LocalFileExporter FileExporter; - - public string Version - { - get - { - return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } - - protected override void OnAfterRender(bool firstRender) - { - if (firstRender) - { - FileExporter.OnChange += StateHasChanged; - } - } - - public void Dispose() - { - FileExporter.OnChange -= StateHasChanged; - } - } +} diff --git a/Damselfly.Web/Shared/Info.razor b/Damselfly.Web/Shared/Info.razor new file mode 100644 index 00000000..9a75fd8f --- /dev/null +++ b/Damselfly.Web/Shared/Info.razor @@ -0,0 +1,71 @@ +@using System +@using Damselfly.Web.Shared +@inject IJSRuntime JsRuntime +@inject Damselfly.Core.Interfaces.IImageProcessorFactory imFactory +@implements IDisposable + + + +
+
+ +
+

Damselfly v@Version © 2019-@DateTime.Now.Year Mark Otway, All rights reserved.

+

Server-based Digital Asset Management system

+ + + + @if (FileExporter != null && FileExporter.IsDesktopHosted) + { +

Running in the Damselfly Desktop container, v@FileExporter.DesktopVersion

+ } + else + { +

+ The Damselfly Desktop app is a special container app which gives you closer integration between + Damselfly and your desktop computer. When you run Damselfly in the app, you can copy photos directly + from the server to a local folder of your choice, instantly, without needing to download or extract + them, and preserving the folder structure from the server. +

+ } + + +
+ + + + + + + +

Task Statuses:

+ + View Server Logs +
+
+
+ +@code { + private LocalFileExporter FileExporter; + + public string Version + { + get + { + return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + FileExporter.OnChange += StateHasChanged; + } + } + + public void Dispose() + { + FileExporter.OnChange -= StateHasChanged; + } +} diff --git a/Damselfly.Web/Shared/Stats.razor b/Damselfly.Web/Shared/Stats.razor index 9f2d3fbb..e0c361bd 100644 --- a/Damselfly.Web/Shared/Stats.razor +++ b/Damselfly.Web/Shared/Stats.razor @@ -4,24 +4,33 @@ @if (StatsReady) { - - - - - - - - - - - - - - - @if (!string.IsNullOrEmpty(AzureMonthlyTransactions)) - { - - } + + + + + + + + + + + + + + + + + + @if (!string.IsNullOrEmpty(AzureMonthlyTransactions)) + { + + } + + + + + +
.Net Version:@Environment.Version
OS Version:@Environment.OSVersion
Process Architecture:@System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture
Processor Count:@Environment.ProcessorCount
Indexed Folders:@TotalFolders
Indexed Images:@TotalImages
Indexed Tags/Keywords:@TotalTags
Pending MetaData Scans:@PendingImages
Pending Thumbnails:@PendingThumbs
Pending AI Scans:@PendingAIScans
Images with Keyword Updates:@PendingKeywordImages (total keywords: @PendingKeywordOps)
Objects Recognised:@ObjectsRecognised
Faces Found:@PeopleFound
People Identified:@PeopleIdentified
Azure Transactions:@AzureMonthlyTransactions

System

.Net Version:@Environment.Version
OS Version:@Environment.OSVersion
Process Architecture:@System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture
Processor Count:@Environment.ProcessorCount

Photo Collection

Folders:@TotalFolders
Images:@TotalImages
Tags/Keywords:@TotalTags
Recognised Objects:@ObjectsRecognised
Faces:@PeopleFound
People Identified:@PeopleIdentified
Azure Transactions:@AzureMonthlyTransactions

Process Queue

Pending MetaData Scans:@PendingImages
Pending Thumbnails:@PendingThumbs
Pending AI Scans:@PendingAIScans
Pending Keyword Updates:@PendingKeywordImages (total keywords: @PendingKeywordOps)
} else diff --git a/Damselfly.Web/Shared/Toolbar.razor b/Damselfly.Web/Shared/Toolbar.razor index aeecda46..c6a7bea9 100644 --- a/Damselfly.Web/Shared/Toolbar.razor +++ b/Damselfly.Web/Shared/Toolbar.razor @@ -26,7 +26,7 @@ { try { - NavigationManager.NavigateTo("/about"); + NavigationManager.NavigateTo("/info"); } catch (Exception ex) { diff --git a/Damselfly.Web/wwwroot/css/site.css b/Damselfly.Web/wwwroot/css/site.css index 6e09a2c3..f5cdd509 100644 --- a/Damselfly.Web/wwwroot/css/site.css +++ b/Damselfly.Web/wwwroot/css/site.css @@ -837,30 +837,16 @@ f align-content: center; } -.damselfly-about { +.damselfly-info { display: flex; flex-direction: column; - justify-content: center; padding: 10px; display: flex; order: 3; flex: 1; padding: 5px; margin: 5px; -} - -.damselfly-aboutcolumn { - display: flex; - flex-direction: row; - flex: 1 0 auto; - margin: 5px; -} - -.damselfly-aboutcolumncontent { - flex: 1; - justify-content: flex-start; - padding: 5px; - border-radius: 3px; + overflow-y: auto; } .damselfly-imagenav { @@ -1534,11 +1520,6 @@ hr.separator { height: 50px; } -.damselfly-about { - overflow-y: auto; - flex-direction: column; -} - .objects-box { display: inherit; position: absolute; From 24d102ca41232cf8711e9b9140a2c1ce00fcbac6 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Tue, 9 Nov 2021 23:07:58 +0000 Subject: [PATCH 03/13] About restyle. --- Damselfly.Core/Damselfly.Core.csproj | 2 +- .../Services/FolderWatcherService.cs | 3 ++ .../Damselfly.ML.ImageClassification.csproj | 6 ++-- .../Damselfly.Migrations.Postgres.csproj | 4 +-- .../Damselfly.Migrations.Sqlite.csproj | 2 +- Damselfly.Web/Damselfly.Web.csproj | 2 +- Damselfly.Web/Shared/About.razor | 30 ++++++++++++++++--- Damselfly.Web/Shared/Info.razor | 23 ++++---------- 8 files changed, 42 insertions(+), 30 deletions(-) diff --git a/Damselfly.Core/Damselfly.Core.csproj b/Damselfly.Core/Damselfly.Core.csproj index 2816834b..cddcd8ee 100644 --- a/Damselfly.Core/Damselfly.Core.csproj +++ b/Damselfly.Core/Damselfly.Core.csproj @@ -35,7 +35,7 @@ - +
diff --git a/Damselfly.Core/Services/FolderWatcherService.cs b/Damselfly.Core/Services/FolderWatcherService.cs index 3c585440..9f685973 100644 --- a/Damselfly.Core/Services/FolderWatcherService.cs +++ b/Damselfly.Core/Services/FolderWatcherService.cs @@ -68,6 +68,9 @@ private async Task FolderQueueProcessor() var uniqueFolders = folders.Distinct(StringComparer.OrdinalIgnoreCase); var pendingFolders = db.Folders.Where(f => uniqueFolders.Contains(f.Path)).ToList(); + // Call this method synchronously, we don't want to continue otherwise + // we'll end up with race conditions as the timer triggers while + // the method is completing. _indexingService.MarkFoldersForScan(pendingFolders).Wait(); } } diff --git a/Damselfly.ML.ImageClassification/Damselfly.ML.ImageClassification.csproj b/Damselfly.ML.ImageClassification/Damselfly.ML.ImageClassification.csproj index db2f3f0e..83d02a6c 100644 --- a/Damselfly.ML.ImageClassification/Damselfly.ML.ImageClassification.csproj +++ b/Damselfly.ML.ImageClassification/Damselfly.ML.ImageClassification.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj b/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj index fc46ee87..9ca29ba9 100644 --- a/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj +++ b/Damselfly.Migrations.Postgres/Damselfly.Migrations.Postgres.csproj @@ -1,7 +1,7 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj index 441fc831..6f395e0c 100644 --- a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj +++ b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj @@ -9,7 +9,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/Damselfly.Web/Damselfly.Web.csproj b/Damselfly.Web/Damselfly.Web.csproj index f34c86b5..4ddd680c 100644 --- a/Damselfly.Web/Damselfly.Web.csproj +++ b/Damselfly.Web/Damselfly.Web.csproj @@ -76,7 +76,7 @@ - + diff --git a/Damselfly.Web/Shared/About.razor b/Damselfly.Web/Shared/About.razor index 0bbaa671..28b11ec5 100644 --- a/Damselfly.Web/Shared/About.razor +++ b/Damselfly.Web/Shared/About.razor @@ -1,7 +1,13 @@ @using System
-

Credits/Thanks

+
+ +
+

Damselfly v@Version © 2019-@DateTime.Now.Year Mark Otway, All rights reserved.

+

Server-based Digital Asset Management system

+
+

Credits/Thanks

Powered by Blazor. GUI Elements by MudBlazor. @@ -15,15 +21,31 @@ ExifTool @ExifService.ExifToolVer by Phil Harvey. Dominant Colour calculation by Jelle Vergeer.

+

Documentation and Updates

+

+ For documentation etc, see the Damselfly Github Page. + For information, updates and other news about Damselfly: +

    +
  • Twitter
  • +
  • Reddit
  • +
+

Want to Support Damselfly?

Damselfly is free, open-source software. But if you find it useful, and fancy buying me a coffee or a slice of pizza, that would be appreciated! -
- Buy Me A Coffee +

+ Buy Me A Coffee +

@code { - + public string Version + { + get + { + return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } } diff --git a/Damselfly.Web/Shared/Info.razor b/Damselfly.Web/Shared/Info.razor index 9a75fd8f..c0075e93 100644 --- a/Damselfly.Web/Shared/Info.razor +++ b/Damselfly.Web/Shared/Info.razor @@ -7,13 +7,11 @@
-
- -
-

Damselfly v@Version © 2019-@DateTime.Now.Year Mark Otway, All rights reserved.

-

Server-based Digital Asset Management system

- +

Configuration Settings

+ + + @if (FileExporter != null && FileExporter.IsDesktopHosted) { @@ -31,10 +29,7 @@ - - - - + @@ -48,14 +43,6 @@ @code { private LocalFileExporter FileExporter; - public string Version - { - get - { - return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } - protected override void OnAfterRender(bool firstRender) { if (firstRender) From e551f320d460c33d9ad3ef2e9c1540f9aab17c53 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Wed, 10 Nov 2021 23:02:45 +0000 Subject: [PATCH 04/13] Fix rescan update for folders --- Damselfly.Core/Services/ImageRecognitionService.cs | 2 +- Damselfly.Migrations.Sqlite/SqlLiteModel.cs | 6 +++--- Damselfly.Web/Shared/Info.razor | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Damselfly.Core/Services/ImageRecognitionService.cs b/Damselfly.Core/Services/ImageRecognitionService.cs index 61878ed0..b76e1a62 100644 --- a/Damselfly.Core/Services/ImageRecognitionService.cs +++ b/Damselfly.Core/Services/ImageRecognitionService.cs @@ -567,8 +567,8 @@ public async Task MarkFolderForScan(Folder folder) using var db = new ImageContext(); var queryable = db.ImageMetaData.Where(img => img.Image.FolderId == folder.FolderId); - int updated = await db.BatchUpdate(queryable, x => new ImageMetaData { AILastUpdated = null }); + int updated = await db.BatchUpdate(queryable, x => new ImageMetaData { AILastUpdated = null }); _statusService.StatusText = $"Folder {folder.Name} ({updated} images) flagged for AI reprocessing."; _workService.HandleNewJobs(this); diff --git a/Damselfly.Migrations.Sqlite/SqlLiteModel.cs b/Damselfly.Migrations.Sqlite/SqlLiteModel.cs index bfc21401..f162586c 100644 --- a/Damselfly.Migrations.Sqlite/SqlLiteModel.cs +++ b/Damselfly.Migrations.Sqlite/SqlLiteModel.cs @@ -249,14 +249,14 @@ public Task BulkInsertOrUpdate(BaseDBModel db, DbSet collection, Lis public async Task BatchDelete(IQueryable query) where T : class { - // TODO Use bulk delete here? + // TODO Try/Catch here? return await query.DeleteAsync(); } public async Task BatchUpdate(IQueryable query, Expression> updateExpression) where T : class { - // TODO Use bulk delete here? - return await query.BatchUpdateAsync( updateExpression ); + // TODO Try/Catch here? + return await query.UpdateAsync( updateExpression ); } private string Sanitize( string input ) diff --git a/Damselfly.Web/Shared/Info.razor b/Damselfly.Web/Shared/Info.razor index c0075e93..f81c6d2d 100644 --- a/Damselfly.Web/Shared/Info.razor +++ b/Damselfly.Web/Shared/Info.razor @@ -7,7 +7,7 @@
-

Configuration Settings

+

Damselfly Information

From fa9730dea0f5386c8fc4b819dc77d37eb48943af Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Thu, 11 Nov 2021 12:21:42 +0000 Subject: [PATCH 05/13] Logging --- .../ImageSharpProcessor.cs | 4 ++ .../SkiaSharpProcessor.cs | 12 ++++-- Damselfly.Core/Services/ThumbnailService.cs | 40 ++++++++++--------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Damselfly.Core.ImageProcessing/ImageSharpProcessor.cs b/Damselfly.Core.ImageProcessing/ImageSharpProcessor.cs index 3ceaa88c..10e7f4fd 100644 --- a/Damselfly.Core.ImageProcessing/ImageSharpProcessor.cs +++ b/Damselfly.Core.ImageProcessing/ImageSharpProcessor.cs @@ -201,6 +201,8 @@ public async Task CreateThumbs(FileInfo source, IDictionary< public async Task GetCroppedFile( FileInfo source, int x, int y, int width, int height, FileInfo destFile ) { + Stopwatch watch = new Stopwatch("ImageSharpCrop"); + // Image.Load(string path) is a shortcut for our default type. // Other pixel formats use Image.Load(string path)) using var image = Image.Load(source.FullName); @@ -209,6 +211,8 @@ public async Task GetCroppedFile( FileInfo source, int x, int y, int width, int image.Mutate(x => x.AutoOrient()); image.Mutate(x => x.Crop( rect )); await image.SaveAsync(destFile.FullName); + + watch.Stop(); } /// diff --git a/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs b/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs index aad20f4a..b75f4d85 100644 --- a/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs +++ b/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs @@ -152,11 +152,11 @@ public Task CreateThumbs(FileInfo source, IDictionary public Task GetCroppedFile(FileInfo source, int x, int y, int width, int height, FileInfo dest) { + Stopwatch watch = new Stopwatch("SkiaSharpCrop"); + try { - SKCodec codec = SKCodec.Create(source.FullName); - SKImageInfo info = codec.Info; - using SKBitmap sourceBitmap = SKBitmap.Decode(codec); + using SKBitmap sourceBitmap = SKBitmap.Decode(source.FullName); // setup crop rect var cropRect = new SKRectI(x, y, x + width, y + height); @@ -168,9 +168,13 @@ public Task GetCroppedFile(FileInfo source, int x, int y, int width, int height, } catch (Exception ex) { - Logging.Log($"Exception during Crop processing: {ex.Message}"); + Logging.Log($"Exception during Skia Crop processing: {ex.Message}"); throw; } + finally + { + watch.Stop(); + } return Task.CompletedTask; } diff --git a/Damselfly.Core/Services/ThumbnailService.cs b/Damselfly.Core/Services/ThumbnailService.cs index 2e9cbf72..8f6bbd8b 100644 --- a/Damselfly.Core/Services/ThumbnailService.cs +++ b/Damselfly.Core/Services/ThumbnailService.cs @@ -414,34 +414,38 @@ public async Task GetFaceThumbNail( ImageObject face ) string faceDir = Path.Combine(_thumbnailRootFolder, "_FaceThumbs"); var image = await _imageCache.GetCachedImage(face.ImageId); var file = new FileInfo(image.FullPath); - var imagePath = new FileInfo(GetThumbPath(file, ThumbSize.Large)); - destFile = new FileInfo($"{faceDir}/face_{face.PersonId}.jpg"); + var thumbPath = new FileInfo(GetThumbPath(file, ThumbSize.Large)); - if (!System.IO.Directory.Exists(faceDir)) + if (thumbPath.Exists) { - Logging.Log($"Created folder for face thumbnails: {faceDir}"); - System.IO.Directory.CreateDirectory(faceDir); - } + destFile = new FileInfo($"{faceDir}/face_{face.PersonId}.jpg"); - if (!destFile.Exists) - { - Logging.LogVerbose($"Generating face thumb for {face.PersonId} from file {imagePath}..."); + if (!System.IO.Directory.Exists(faceDir)) + { + Logging.Log($"Created folder for face thumbnails: {faceDir}"); + System.IO.Directory.CreateDirectory(faceDir); + } - MetaDataService.GetImageSize(imagePath.FullName, out var thumbWidth, out var thumbHeight); + if (!destFile.Exists) + { + Logging.Log($"Generating face thumb for {face.PersonId} from file {thumbPath}..."); - Logging.LogTrace($"Loaded {imagePath.FullName} - {thumbWidth} x {thumbHeight}"); + MetaDataService.GetImageSize(thumbPath.FullName, out var thumbWidth, out var thumbHeight); - (var x, var y, var width, var height) = ScaleDownRect(image, thumbWidth, thumbHeight, - face.RectX, face.RectY, face.RectWidth, face.RectHeight); + Logging.LogTrace($"Loaded {thumbPath.FullName} - {thumbWidth} x {thumbHeight}"); - Logging.LogTrace($"Cropping face at {x}, {y}, w:{width}, h:{height}"); + (var x, var y, var width, var height) = ScaleDownRect(image, thumbWidth, thumbHeight, + face.RectX, face.RectY, face.RectWidth, face.RectHeight); - await _imageProcessingService.GetCroppedFile(imagePath, x, y, width, height, destFile); + Logging.LogTrace($"Cropping face at {x}, {y}, w:{width}, h:{height}"); - destFile.Refresh(); + await _imageProcessingService.GetCroppedFile(thumbPath, x, y, width, height, destFile); - if (!destFile.Exists) - destFile = null; + destFile.Refresh(); + + if (!destFile.Exists) + destFile = null; + } } } catch( Exception ex ) From 48e790784f55dacbeab809e4f1b23cf6e7cb5599 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Thu, 11 Nov 2021 23:16:56 +0000 Subject: [PATCH 06/13] Fix favourite tags, and add recently-used tags to tag list --- .../SkiaSharpProcessor.cs | 2 +- Damselfly.Core/Services/ExifService.cs | 31 ++++++++ Damselfly.Core/Services/ThumbnailService.cs | 2 + Damselfly.Web/Shared/Images/TagList.razor | 79 ++++++++++++------- 4 files changed, 86 insertions(+), 28 deletions(-) diff --git a/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs b/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs index b75f4d85..01b5b739 100644 --- a/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs +++ b/Damselfly.Core.ImageProcessing/SkiaSharpProcessor.cs @@ -168,7 +168,7 @@ public Task GetCroppedFile(FileInfo source, int x, int y, int width, int height, } catch (Exception ex) { - Logging.Log($"Exception during Skia Crop processing: {ex.Message}"); + Logging.LogError($"Exception during Skia Crop processing: {ex.Message}"); throw; } finally diff --git a/Damselfly.Core/Services/ExifService.cs b/Damselfly.Core/Services/ExifService.cs index 21825d99..94224484 100644 --- a/Damselfly.Core/Services/ExifService.cs +++ b/Damselfly.Core/Services/ExifService.cs @@ -29,7 +29,9 @@ public class ExifService : IProcessJobFactory private readonly WorkService _workService; public List FavouriteTags { get; private set; } = new List(); + public List RecentTags { get; private set; } = new List(); public event Action OnFavouritesChanged; + public event Action OnRecentsChanged; private const int s_exifWriteDelay = 15; private void NotifyFavouritesChanged() @@ -37,6 +39,11 @@ private void NotifyFavouritesChanged() OnFavouritesChanged?.Invoke(); } + private void NotifyRecentsChanged() + { + OnRecentsChanged?.Invoke(); + } + public ExifService( StatusService statusService, WorkService workService, IndexingService indexingService, ImageCache imageCache ) { @@ -46,6 +53,7 @@ public ExifService( StatusService statusService, WorkService workService, _workService = workService; GetExifToolVersion(); + LoadFavouriteTagsAsync().Wait(); _workService.AddJobSource(this); } @@ -94,6 +102,27 @@ public async Task UpdateTagsAsync(Image image, List addTags, List + /// Add most-recent tags to the list + /// + /// + private void AddRecentTags( ICollection recentTags ) + { + const int maxRecents = 5; + + var newRecent = recentTags.Concat(RecentTags) + .Except( FavouriteTags.Select( x => x.Keyword )) + .Distinct() + .Take( maxRecents ).ToList(); + + RecentTags.Clear(); + RecentTags.AddRange(newRecent); + + NotifyRecentsChanged(); + + // TODO: Would be nice to persist these to config too + } + /// /// Takes an image and a set of keywords, and writes them to the DB queue for /// keywords to be added. These will then be processed asynchronously. @@ -166,6 +195,8 @@ public async Task UpdateTagsAsync(Image[] images, List addTags, List GetFaceThumbNail( ImageObject face ) destFile = null; } } + else + Logging.LogWarning($"Unable to generate face thumb from {thumbPath} - file does not exist."); } catch( Exception ex ) { diff --git a/Damselfly.Web/Shared/Images/TagList.razor b/Damselfly.Web/Shared/Images/TagList.razor index 228af4af..0ad76f1a 100644 --- a/Damselfly.Web/Shared/Images/TagList.razor +++ b/Damselfly.Web/Shared/Images/TagList.razor @@ -26,32 +26,55 @@ @if (ShowFavourites) { -
- @if (iptcService.FavouriteTags != null && iptcService.FavouriteTags.Any()) +
+ @if (iptcService.FavouriteTags != null && iptcService.FavouriteTags.Any()) + { + @foreach (var tag in iptcService.FavouriteTags) + { + @if (CurrentImages != null && CurrentImages.Any()) { - @foreach (var tag in iptcService.FavouriteTags) - { - @if (CurrentImages != null && CurrentImages.Any()) - { -
ShowContextMenu(args, tag, true)) @oncontextmenu:preventDefault="true"> - -
-
-
@tag.Keyword
-
- } - else - { -
ShowContextMenu(args, tag, true )) @oncontextmenu:preventDefault="true"> -
@tag.Keyword
-
- } - } +
ShowContextMenu(args, tag, true)) @oncontextmenu:preventDefault="true"> + +
+
+
@tag.Keyword
+
} -
+ else + { +
ShowContextMenu(args, tag, true )) @oncontextmenu:preventDefault="true"> +
@tag.Keyword
+
+ } + } + } + + @if (iptcService.RecentTags != null && iptcService.RecentTags.Any()) + { + @foreach (var tag in iptcService.RecentTags) + { + @if (CurrentImages != null && CurrentImages.Any()) + { +
+ +
+
+
@tag
+
+ } + else + { +
+
@tag
+
+ } + } + } +
} @if (ShowImageKeywords) @@ -161,9 +184,9 @@ StateHasChanged(); } - private void QuickAddTag(Tag tag) + private void QuickAddTag(string tag) { - var tagsToAdd = new List { tag.Keyword }; + var tagsToAdd = new List { tag }; _ = WriteNewTags( tagsToAdd ); } @@ -246,6 +269,7 @@ // TODO: Dispose selectionService.OnSelectionChanged += SelectionChanged; iptcService.OnFavouritesChanged += FavouritesChanged; + iptcService.OnRecentsChanged += FavouritesChanged; SelectionChanged(); } else @@ -282,6 +306,7 @@ { selectionService.OnSelectionChanged -= SelectionChanged; iptcService.OnFavouritesChanged -= FavouritesChanged; + iptcService.OnRecentsChanged -= FavouritesChanged; navContext.OnChange += NavigationChanged; } @@ -331,7 +356,7 @@ { case 0: NavigationManager.NavigateTo($"/?tagid={tag.TagId}"); break; case 1: await iptcService.ToggleFavourite(tag); break; - case 2: QuickAddTag(tag); break; + case 2: QuickAddTag(tag.Keyword); break; case 3: DeleteTag(tag); break; } }); From e02fcbffc8e5a9c56b6ce1272fc9d6cf8138bad8 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Thu, 11 Nov 2021 23:17:11 +0000 Subject: [PATCH 07/13] Enable TieredPGO for performance --- damselfly-entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/damselfly-entrypoint.sh b/damselfly-entrypoint.sh index f73d9a8d..01949dff 100644 --- a/damselfly-entrypoint.sh +++ b/damselfly-entrypoint.sh @@ -12,6 +12,10 @@ fi; echo "Preparing to start Damselfly...." echo " ./Damselfly.Web /pictures --config=/config --thumbs=/thumbs ${cmdlineargs}" +# Let's turn this on for extra performance. +# https://devblogs.microsoft.com/dotnet/announcing-net-6/#dynamic-pgo +export DOTNET_TieredPGO=1 + cd /app ./Damselfly.Web /pictures --config=/config --thumbs=/thumbs ${cmdlineargs} From 9b90e9073d92572c90324f0774bbe158b286a3fb Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Fri, 12 Nov 2021 22:40:41 +0000 Subject: [PATCH 08/13] User specific tag favourites and config --- .../UserTagFavouritesService.cs | 63 +++++++++++++++++++ Damselfly.Core/Services/ExifService.cs | 31 ++------- Damselfly.Web/Shared/Images/TagList.razor | 9 +-- Damselfly.Web/Startup.cs | 1 + 4 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 Damselfly.Core/ScopedServices/UserTagFavouritesService.cs diff --git a/Damselfly.Core/ScopedServices/UserTagFavouritesService.cs b/Damselfly.Core/ScopedServices/UserTagFavouritesService.cs new file mode 100644 index 00000000..c1515000 --- /dev/null +++ b/Damselfly.Core/ScopedServices/UserTagFavouritesService.cs @@ -0,0 +1,63 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using Damselfly.Core.Services; +using Damselfly.Core.DbModels; + +namespace Damselfly.Core.ScopedServices +{ + public class UserTagFavouritesService : IDisposable + { + private readonly ExifService _exifService; + private readonly UserConfigService _configService; + + public event Action OnRecentsChanged; + public List RecentTags { get; private set; } = new List(); + + public UserTagFavouritesService(ExifService exifService, UserConfigService configService) + { + _configService = configService; + _exifService = exifService; + + _exifService.OnUserTagsAdded += AddRecentTags; + + string recents = configService.Get("FavouriteTags"); + + if( ! string.IsNullOrEmpty( recents ) ) + { + RecentTags.AddRange(recents.Split(",").Select(x => x.Trim()).ToList()); + } + } + + private void NotifyRecentsChanged() + { + OnRecentsChanged?.Invoke(); + } + + /// + /// Add most-recent tags to the list + /// + /// + private void AddRecentTags(ICollection recentTags ) + { + const int maxRecents = 5; + + var newRecent = recentTags.Concat(RecentTags) + .Except(_exifService.FavouriteTags.Select(x => x.Keyword)) + .Distinct() + .Take(maxRecents).ToList(); + + RecentTags.Clear(); + RecentTags.AddRange(newRecent); + + _configService.Set("FavouriteTags", string.Join(",",RecentTags)); + NotifyRecentsChanged(); + } + + public void Dispose() + { + _exifService.OnUserTagsAdded -= AddRecentTags; + } + } +} + diff --git a/Damselfly.Core/Services/ExifService.cs b/Damselfly.Core/Services/ExifService.cs index 94224484..8e528cea 100644 --- a/Damselfly.Core/Services/ExifService.cs +++ b/Damselfly.Core/Services/ExifService.cs @@ -29,9 +29,8 @@ public class ExifService : IProcessJobFactory private readonly WorkService _workService; public List FavouriteTags { get; private set; } = new List(); - public List RecentTags { get; private set; } = new List(); public event Action OnFavouritesChanged; - public event Action OnRecentsChanged; + public event Action> OnUserTagsAdded; private const int s_exifWriteDelay = 15; private void NotifyFavouritesChanged() @@ -39,9 +38,9 @@ private void NotifyFavouritesChanged() OnFavouritesChanged?.Invoke(); } - private void NotifyRecentsChanged() + private void NotifyUserTagsAdded( List tagsAdded ) { - OnRecentsChanged?.Invoke(); + OnUserTagsAdded?.Invoke(tagsAdded); } public ExifService( StatusService statusService, WorkService workService, @@ -102,26 +101,7 @@ public async Task UpdateTagsAsync(Image image, List addTags, List - /// Add most-recent tags to the list - ///
- /// - private void AddRecentTags( ICollection recentTags ) - { - const int maxRecents = 5; - - var newRecent = recentTags.Concat(RecentTags) - .Except( FavouriteTags.Select( x => x.Keyword )) - .Distinct() - .Take( maxRecents ).ToList(); - - RecentTags.Clear(); - RecentTags.AddRange(newRecent); - - NotifyRecentsChanged(); - - // TODO: Would be nice to persist these to config too - } + /// /// Takes an image and a set of keywords, and writes them to the DB queue for @@ -195,7 +175,8 @@ public async Task UpdateTagsAsync(Image[] images, List addTags, List(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); } private void SetupPolicies(AuthorizationOptions config, IServiceCollection services) From 4e4c8f7d9ceb059989b39e91b913b06152bb6261 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Sun, 14 Nov 2021 22:56:34 +0000 Subject: [PATCH 09/13] Fix settings --- Damselfly.Core/Damselfly.Core.csproj | 6 +-- .../Damselfly.Migrations.Sqlite.csproj | 2 +- Damselfly.Web/Damselfly.Web.csproj | 4 +- Damselfly.Web/Shared/Config.razor | 54 ++++++++++--------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/Damselfly.Core/Damselfly.Core.csproj b/Damselfly.Core/Damselfly.Core.csproj index cddcd8ee..1b01e435 100644 --- a/Damselfly.Core/Damselfly.Core.csproj +++ b/Damselfly.Core/Damselfly.Core.csproj @@ -23,8 +23,8 @@ - - + + @@ -34,7 +34,7 @@ - + diff --git a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj index 6f395e0c..9a35f83f 100644 --- a/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj +++ b/Damselfly.Migrations.Sqlite/Damselfly.Migrations.Sqlite.csproj @@ -8,7 +8,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Damselfly.Web/Damselfly.Web.csproj b/Damselfly.Web/Damselfly.Web.csproj index 4ddd680c..415aabbf 100644 --- a/Damselfly.Web/Damselfly.Web.csproj +++ b/Damselfly.Web/Damselfly.Web.csproj @@ -77,11 +77,11 @@ - + - + diff --git a/Damselfly.Web/Shared/Config.razor b/Damselfly.Web/Shared/Config.razor index 52e05dd8..93cc21e1 100644 --- a/Damselfly.Web/Shared/Config.razor +++ b/Damselfly.Web/Shared/Config.razor @@ -25,35 +25,37 @@ -
-

Settings for @auth.User.Identity.Name

-
-
- - @foreach (var choice in themeService.Themes) - { - - @choice.Name.Transform(To.SentenceCase) - - } - + +
+

Settings for @auth.User.Identity.Name

+
+
+ + @foreach (var choice in themeService.Themes) + { + + @choice.Name.Transform(To.SentenceCase) + + } + +
-
-
-
- - @foreach (var choice in new[] { 100, 90, 75, 50, 25 }) - { - - @choice.ToString() - - } - +
+
+ + @foreach (var choice in new[] { 100, 90, 75, 50, 25 }) + { + + @choice.ToString() + + } + +
+
- -
+
From a81cee43c5acf0c623bbf927846db9e982d2af35 Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Sun, 14 Nov 2021 23:13:22 +0000 Subject: [PATCH 10/13] Revert Skiasharp --- Damselfly.Core/Damselfly.Core.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Damselfly.Core/Damselfly.Core.csproj b/Damselfly.Core/Damselfly.Core.csproj index 1b01e435..cee7063e 100644 --- a/Damselfly.Core/Damselfly.Core.csproj +++ b/Damselfly.Core/Damselfly.Core.csproj @@ -23,8 +23,8 @@ - - + + From 5c632bb199793b8799f8907899f7c4cee6be5fbb Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Sun, 14 Nov 2021 23:36:48 +0000 Subject: [PATCH 11/13] Change priority --- Damselfly.Core/Services/ExifService.cs | 2 +- Damselfly.Core/Services/IndexingService.cs | 2 +- Damselfly.Core/Services/MetaDataService.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Damselfly.Core/Services/ExifService.cs b/Damselfly.Core/Services/ExifService.cs index 8e528cea..b6c9a11a 100644 --- a/Damselfly.Core/Services/ExifService.cs +++ b/Damselfly.Core/Services/ExifService.cs @@ -491,7 +491,7 @@ public async Task Process() } } - public int Priority => 3; + public int Priority => 1; public async Task> GetPendingJobs(int maxCount) { diff --git a/Damselfly.Core/Services/IndexingService.cs b/Damselfly.Core/Services/IndexingService.cs index 3f88b829..d64cc229 100644 --- a/Damselfly.Core/Services/IndexingService.cs +++ b/Damselfly.Core/Services/IndexingService.cs @@ -475,7 +475,7 @@ public async Task Process() } } - public int Priority => 1; + public int Priority => 2; public async Task> GetPendingJobs( int maxCount ) { diff --git a/Damselfly.Core/Services/MetaDataService.cs b/Damselfly.Core/Services/MetaDataService.cs index 9be8404b..252d996f 100644 --- a/Damselfly.Core/Services/MetaDataService.cs +++ b/Damselfly.Core/Services/MetaDataService.cs @@ -745,7 +745,7 @@ public async Task Process() } } - public int Priority => 2; + public int Priority => 3; public async Task> GetPendingJobs(int maxJobs) { From ea6a25c9837f8956da6cbb5135d853e27d0a314b Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Mon, 15 Nov 2021 08:35:08 +0000 Subject: [PATCH 12/13] Priorities --- Damselfly.Core.Interfaces/IProcessJob.cs | 13 ++++++++++++- Damselfly.Core/Services/ExifService.cs | 3 ++- Damselfly.Core/Services/ImageRecognitionService.cs | 3 ++- Damselfly.Core/Services/IndexingService.cs | 3 ++- Damselfly.Core/Services/MetaDataService.cs | 3 ++- Damselfly.Core/Services/ThumbnailService.cs | 3 ++- Damselfly.Core/Services/WorkService.cs | 2 +- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Damselfly.Core.Interfaces/IProcessJob.cs b/Damselfly.Core.Interfaces/IProcessJob.cs index 591a8926..fbb5876a 100644 --- a/Damselfly.Core.Interfaces/IProcessJob.cs +++ b/Damselfly.Core.Interfaces/IProcessJob.cs @@ -4,17 +4,28 @@ namespace Damselfly.Core.Interfaces { + public enum JobPriorities + { + FullIndexing = 0, + ExifService = 1, + Indexing = 2, + Metadata = 3, + Thumbnails = 4, + ImageRecognition = 5 + }; + public interface IProcessJob { Task Process(); bool CanProcess { get; } string Description { get; } + JobPriorities Priority { get; } } public interface IProcessJobFactory { Task> GetPendingJobs( int maxJobs ); - int Priority { get; } + JobPriorities Priority { get; } } } diff --git a/Damselfly.Core/Services/ExifService.cs b/Damselfly.Core/Services/ExifService.cs index b6c9a11a..77a5d026 100644 --- a/Damselfly.Core/Services/ExifService.cs +++ b/Damselfly.Core/Services/ExifService.cs @@ -484,6 +484,7 @@ public class ExifProcess : IProcessJob public ExifService Service { get; set; } public bool CanProcess => true; public string Description => "Keyword Updates"; + public JobPriorities Priority => JobPriorities.ExifService; public async Task Process() { @@ -491,7 +492,7 @@ public async Task Process() } } - public int Priority => 1; + public JobPriorities Priority => JobPriorities.ExifService; public async Task> GetPendingJobs(int maxCount) { diff --git a/Damselfly.Core/Services/ImageRecognitionService.cs b/Damselfly.Core/Services/ImageRecognitionService.cs index b76e1a62..9aa0ddc4 100644 --- a/Damselfly.Core/Services/ImageRecognitionService.cs +++ b/Damselfly.Core/Services/ImageRecognitionService.cs @@ -603,6 +603,7 @@ public class AIProcess : IProcessJob public int ImageId { get; set; } public ImageRecognitionService Service { get; set; } public string Description => "AI processing"; + public JobPriorities Priority => JobPriorities.ImageRecognition; public async Task Process() { @@ -612,7 +613,7 @@ public async Task Process() public bool CanProcess { get { return true; } } } - public int Priority => 5; + public JobPriorities Priority => JobPriorities.ImageRecognition; public async Task> GetPendingJobs( int maxJobs ) { diff --git a/Damselfly.Core/Services/IndexingService.cs b/Damselfly.Core/Services/IndexingService.cs index d64cc229..438a4b39 100644 --- a/Damselfly.Core/Services/IndexingService.cs +++ b/Damselfly.Core/Services/IndexingService.cs @@ -465,6 +465,7 @@ public class IndexProcess : IProcessJob public IndexingService Service { get; set; } public bool CanProcess => true; public string Description { get; set; } + public JobPriorities Priority => IsFullIndex ? JobPriorities.FullIndexing : JobPriorities.Indexing; public async Task Process() { @@ -475,7 +476,7 @@ public async Task Process() } } - public int Priority => 2; + public JobPriorities Priority => JobPriorities.Indexing; public async Task> GetPendingJobs( int maxCount ) { diff --git a/Damselfly.Core/Services/MetaDataService.cs b/Damselfly.Core/Services/MetaDataService.cs index 252d996f..f54d3423 100644 --- a/Damselfly.Core/Services/MetaDataService.cs +++ b/Damselfly.Core/Services/MetaDataService.cs @@ -738,6 +738,7 @@ public class MetadataProcess : IProcessJob public MetaDataService Service { get; set; } public bool CanProcess => true; public string Description => "Metadata scanning"; + public JobPriorities Priority => JobPriorities.Metadata; public async Task Process() { @@ -745,7 +746,7 @@ public async Task Process() } } - public int Priority => 3; + public JobPriorities Priority => JobPriorities.Metadata; public async Task> GetPendingJobs(int maxJobs) { diff --git a/Damselfly.Core/Services/ThumbnailService.cs b/Damselfly.Core/Services/ThumbnailService.cs index f6c99fd8..a6baf8c6 100644 --- a/Damselfly.Core/Services/ThumbnailService.cs +++ b/Damselfly.Core/Services/ThumbnailService.cs @@ -635,6 +635,7 @@ public class ThumbProcess : IProcessJob public ThumbnailService Service { get; set; } public bool CanProcess => true; public string Description => "Thumbnail generation"; + public JobPriorities Priority => JobPriorities.Thumbnails; public async Task Process() { @@ -642,7 +643,7 @@ public async Task Process() } } - public int Priority => 4; + public JobPriorities Priority => JobPriorities.Thumbnails; public async Task> GetPendingJobs( int maxJobs ) { diff --git a/Damselfly.Core/Services/WorkService.cs b/Damselfly.Core/Services/WorkService.cs index 3bfa0877..c34d3f8c 100644 --- a/Damselfly.Core/Services/WorkService.cs +++ b/Damselfly.Core/Services/WorkService.cs @@ -216,7 +216,7 @@ private bool PopulateJobsForService(IProcessJobFactory source, int maxCount) foreach (var job in jobs) { - _jobQueue.Enqueue(job, source.Priority); + _jobQueue.Enqueue(job, (int)job.Priority); newJobs = true; } } From 5c0b33118fcc1b52c9e783dcf63f834d5f2c47de Mon Sep 17 00:00:00 2001 From: Mark Otway Date: Mon, 15 Nov 2021 18:53:13 +0000 Subject: [PATCH 13/13] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e70b4523..24ba9a38 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.0 +2.7.0