summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--Server.csproj4
-rw-r--r--Services/OcrService.cs6
3 files changed, 8 insertions, 4 deletions
diff --git a/Dockerfile b/Dockerfile
index a93e994..55a86db 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,7 +7,7 @@ RUN dotnet publish -o out
FROM mcr.microsoft.com/dotnet/aspnet:10.0@sha256:ccdca44cd4f256d50187f920dc8ccc2a9ea7a8a4597ac1d51e08fddb2e3b3205
RUN apt update
-RUN apt install -y imagemagick
+RUN apt install -y imagemagick tesseract-ocr tesseract-ocr-eng
RUN apt clean
RUN rm -rf /var/lib/apt/lists/*
WORKDIR /App
diff --git a/Server.csproj b/Server.csproj
index f733581..e435946 100644
--- a/Server.csproj
+++ b/Server.csproj
@@ -6,9 +6,9 @@
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>HyperBooru</AssemblyName>
<RootNamespace>HyperBooru</RootNamespace>
- <AssemblyVersion>0.10.0.0</AssemblyVersion>
+ <AssemblyVersion>0.11.0.0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
- <Version>0.10-alpha</Version>
+ <Version>0.11-alpha</Version>
<UserSecretsId>2907567f-4640-4581-8f4d-0977952d26bd</UserSecretsId>
</PropertyGroup>
diff --git a/Services/OcrService.cs b/Services/OcrService.cs
index 40905aa..d43db2e 100644
--- a/Services/OcrService.cs
+++ b/Services/OcrService.cs
@@ -8,6 +8,8 @@ using Tesseract;
namespace HyperBooru.Services;
public class OcrService : IHostedService {
+ private readonly string[] InvalidMimeTypes = [ "image/heic", "image/webp" ];
+
private readonly TimeSpan ProcessInterval = TimeSpan.FromMinutes(30);
private readonly TimeSpan StartupDelay = TimeSpan.FromSeconds(30);
@@ -65,10 +67,12 @@ public class OcrService : IHostedService {
using var db = dbFactory.CreateDbContext();
Guid[] guids = db.Media
+ .AsNoTracking()
.Include(m => m.CurrentUploadedFile)
.Include(m => m.OcrData)
.Where(m => m.OcrData == null)
- .Where(m => m.CurrentUploadedFile.MimeType.Contains("image/"))
+ .Where(m => m.CurrentUploadedFile!.MimeType.Contains("image/"))
+ .Where(m => !InvalidMimeTypes.Contains(m.CurrentUploadedFile!.MimeType))
.Select(m => m.Guid)
.ToArray();
db.Dispose();