🎨 桌面端支持搜索图片 OCR 文本 https://github.com/siyuan-note/siyuan/issues/3470

This commit is contained in:
Liang Ding 2023-01-16 16:16:34 +08:00
parent 14e4f7bb5e
commit 9788cce4b0
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 1 deletions

View file

@ -636,11 +636,18 @@ func UnusedAssets() (ret []string) {
}
}
// 排除文件注解和对应文件
var toRemoves []string
for asset, _ := range assetsPathMap {
if strings.HasSuffix(asset, ".sya") {
// 排除文件注解和对应文件
toRemoves = append(toRemoves, asset, strings.TrimSuffix(asset, ".sya"))
continue
}
if strings.HasSuffix(asset, "ocr-texts.json") {
// 排除 OCR 结果文本
toRemoves = append(toRemoves, asset)
continue
}
}
for _, toRemove := range toRemoves {

View file

@ -259,6 +259,10 @@ func getTesseractVer() (ret string) {
cmd := exec.Command("tesseract", "--version")
gulu.CmdAttr(cmd)
data, err := cmd.CombinedOutput()
if nil != err {
logging.LogWarnf("tesseract-ocr not found: %s", err)
}
logging.LogWarnf("tesseract --version: %s", string(data))
if nil == err && strings.HasPrefix(string(data), "tesseract v") {
parts := bytes.Split(data, []byte("\n"))
if 0 < len(parts) {