Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b3e0d9bc
authored
2021-08-06 14:57:57 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
d213eb78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
src/apps/doc/management/commands/folder_ltgt_process.py
src/apps/doc/management/commands/folder_ltgt_process.py
View file @
b3e0d9b
...
...
@@ -188,6 +188,12 @@ class Command(BaseCommand, LoggerMixin):
self
.
folder_log
.
error
(
'{0} [wb build error] [path={1}] [error={2}]'
.
format
(
self
.
log_base
,
excel_path
,
traceback
.
format_exc
()))
def
basename
(
self
,
path
):
# A basename() variant which first strips the trailing slash, if present.
# Thus we always get the last component of the path, even for directories.
sep
=
os
.
path
.
sep
+
(
os
.
path
.
altsep
or
''
)
return
os
.
path
.
basename
(
path
.
rstrip
(
sep
))
def
ocr_process
(
self
,
img_path
,
classify
,
all_res
,
seperate_dir
):
if
os
.
path
.
exists
(
img_path
):
# TODO 图片验证
...
...
@@ -225,7 +231,9 @@ class Command(BaseCommand, LoggerMixin):
if
ocr_data
.
get
(
'classify'
)
==
classify
:
if
seperate_dir
is
not
None
:
os
.
makedirs
(
seperate_dir
,
exist_ok
=
True
)
shutil
.
move
(
img_path
,
seperate_dir
)
real_dst
=
os
.
path
.
join
(
seperate_dir
,
self
.
basename
(
img_path
))
if
not
os
.
path
.
exists
(
real_dst
):
shutil
.
move
(
img_path
,
seperate_dir
)
if
classify
in
consts
.
LICENSE_CLASSIFY_SET_1
:
self
.
license1_process
(
ocr_data
,
all_res
,
classify
)
elif
classify
in
consts
.
LICENSE_CLASSIFY_SET_2
:
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment