mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 桌面端支持搜索图片 OCR 文本 https://github.com/siyuan-note/siyuan/issues/3470
This commit is contained in:
parent
14e4f7bb5e
commit
9788cce4b0
2 changed files with 12 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue