Skip to content

Commit

Permalink
Release 2.0.2
Browse files Browse the repository at this point in the history
修复在离线OCR不可用的机器上有可能在线OCR也不可用的问题
  • Loading branch information
huaiyinfeilong committed Jun 1, 2023
1 parent 3241c1b commit 371f1cd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions addon/doc/zh_CN/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@

## 升级日志

### Version 2.0.2

* 修复在离线OCR不可用的机器上在线OCR可能也无法使用的问题。

### Version 2.0.1

* 修复在网络代理环境中不稳定的问题。
Expand Down
8 changes: 7 additions & 1 deletion addon/globalPlugins/xyOCR/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def __init__(self):
self.ocr_list.append(BaiduGeneralOcr())
self.ocr_list.append(BaiduAccurateOcr())
for ocr in self.ocr_list:
ocr.initRecognizer()
try:
ocr.initRecognizer()
except Exception as e:
# 初始化引擎失败,从引擎列表中移除有问题的引擎,并继续初始化后续引擎
log.debug(f"初始化OCR引擎失败:{e}")
self.ocr_list.remove(ocr)
continue
# 配置文件中的引擎索引若大于实际索引范围,则设置引擎索引为0,这种超出情况可能出现于拷贝用户配置到另一台不支持x64环境的机器中运行
index = config.conf["xinyiOcr"]["engine"] \
if config.conf["xinyiOcr"]["engine"] < len(self.ocr_list) else 0
Expand Down
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _(arg):
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description": _("Aggregating various offline and online OCR services"),
# version
"addon_version": "2.0.1",
"addon_version": "2.0.2",
# Author(s)
"addon_author": "huaiyinfeilong <huaiyinfeilong@163.com>",
# URL for the add-on documentation support
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Any comments and suggestions are welcome to communicate:

## Upgrade log

### Version 2.0.2

*Fix the issue where online OCR may also be unavailable on machines where offline OCR is not available.

### Version 2.0.1

* Fix instability in network proxy environment.
Expand Down

0 comments on commit 371f1cd

Please sign in to comment.