Release v0.6.37: isolate image capture and OCR, fingerprint history duplicates
This commit is contained in:
+18
-2
@@ -536,7 +536,10 @@ void App::scheduleHistoryOcr(const Settings &config)
|
||||
if (!entry.image || (entry.ocrState != 1 && entry.ocrProfile == profile)) continue;
|
||||
try
|
||||
{
|
||||
auto text = recognizeText(history->load(entry.id), config);
|
||||
auto text = history->recognizeImage(entry.id, config, [this, &profile] {
|
||||
std::lock_guard lock(jobsMutex);
|
||||
return stop || ocrProfile(historyOcrSettings) != profile;
|
||||
});
|
||||
std::lock_guard lock(jobsMutex);
|
||||
if (stop || ocrProfile(historyOcrSettings) != profile) continue;
|
||||
if (history->saveOcr(entry.id, text, config))
|
||||
@@ -1585,6 +1588,17 @@ void App::captureHistory()
|
||||
for (auto &name : config.excluded)
|
||||
if (lower(name) == lower(app))
|
||||
return;
|
||||
if (IsClipboardFormatAvailable(CF_DIB) || IsClipboardFormatAvailable(CF_DIBV5) ||
|
||||
IsClipboardFormatAvailable(CF_BITMAP) ||
|
||||
IsClipboardFormatAvailable(RegisterClipboardFormatW(L"PNG")))
|
||||
{
|
||||
if (history->captureImage(sequence, app, config))
|
||||
{
|
||||
scheduleHistoryOcr(config);
|
||||
PostMessageW(window, HistoryMessage, 0, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
auto clip = readClipboard(window, (size_t)config.maxImageMiB * 1024 * 1024);
|
||||
if (sequence != GetClipboardSequenceNumber())
|
||||
return;
|
||||
@@ -1622,7 +1636,9 @@ void App::recognizeEntry(std::wstring id)
|
||||
try
|
||||
{
|
||||
auto cached = history->ocrText(id, ocrProfile(config));
|
||||
auto text = cached ? *cached : recognizeText(history->load(id), config);
|
||||
auto text = cached ? *cached : history->recognizeImage(id, config, [this] {
|
||||
std::lock_guard lock(jobsMutex); return stop;
|
||||
});
|
||||
if (!cached) history->saveOcr(id, text, config);
|
||||
if (text.empty())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user