fix bug
Showing
1 changed file
with
6 additions
and
5 deletions
| ... | @@ -102,7 +102,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -102,7 +102,7 @@ class Command(BaseCommand, LoggerMixin): |
| 102 | id_card_dict.pop('base64_img') | 102 | id_card_dict.pop('base64_img') |
| 103 | except Exception as e: | 103 | except Exception as e: |
| 104 | continue | 104 | continue |
| 105 | all_res.append(license_data) | 105 | all_res.extend(license_data) |
| 106 | 106 | ||
| 107 | def license2_process(self, ocr_data, all_res, classify, img_path): | 107 | def license2_process(self, ocr_data, all_res, classify, img_path): |
| 108 | pid, _, _, _, _, _ = consts.LICENSE_CLASSIFY_MAPPING.get(classify) | 108 | pid, _, _, _, _, _ = consts.LICENSE_CLASSIFY_MAPPING.get(classify) |
| ... | @@ -238,6 +238,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -238,6 +238,7 @@ class Command(BaseCommand, LoggerMixin): |
| 238 | self.license1_process(ocr_data, all_res, classify) | 238 | self.license1_process(ocr_data, all_res, classify) |
| 239 | elif classify in consts.LICENSE_CLASSIFY_SET_2: | 239 | elif classify in consts.LICENSE_CLASSIFY_SET_2: |
| 240 | self.license2_process(ocr_data, all_res, classify, img_path) | 240 | self.license2_process(ocr_data, all_res, classify, img_path) |
| 241 | break | ||
| 241 | else: | 242 | else: |
| 242 | self.folder_log.warn('{0} [ocr failed] [img_path={1}]'.format(self.log_base, img_path)) | 243 | self.folder_log.warn('{0} [ocr failed] [img_path={1}]'.format(self.log_base, img_path)) |
| 243 | 244 | ||
| ... | @@ -300,9 +301,9 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -300,9 +301,9 @@ class Command(BaseCommand, LoggerMixin): |
| 300 | all_res = [] | 301 | all_res = [] |
| 301 | for img_path in img_path_list: | 302 | for img_path in img_path_list: |
| 302 | self.ocr_process(img_path, classify, all_res, seperate_dir) | 303 | self.ocr_process(img_path, classify, all_res, seperate_dir) |
| 303 | if len(all_res) > 0: | 304 | # if len(all_res) > 0: |
| 304 | self.res_process(all_res, excel_path, classify) | 305 | self.res_process(all_res, excel_path, classify) |
| 305 | return all_res | 306 | return all_res |
| 306 | 307 | ||
| 307 | def pdf_process(self, name, path, classify, img_output_dir, wb_output_dir, pdf_output_dir, seperate_dir): | 308 | def pdf_process(self, name, path, classify, img_output_dir, wb_output_dir, pdf_output_dir, seperate_dir): |
| 308 | if os.path.exists(path): | 309 | if os.path.exists(path): |
| ... | @@ -365,7 +366,7 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -365,7 +366,7 @@ class Command(BaseCommand, LoggerMixin): |
| 365 | if classify in self.ltgt_classify_mapping: | 366 | if classify in self.ltgt_classify_mapping: |
| 366 | rebuild_res = self.ltgt_process([path], self.ltgt_classify_mapping[classify], excel_path, path) | 367 | rebuild_res = self.ltgt_process([path], self.ltgt_classify_mapping[classify], excel_path, path) |
| 367 | else: | 368 | else: |
| 368 | rebuild_res = self.images_process([img_save_path], classify, excel_path, seperate_path) | 369 | rebuild_res = self.images_process([path], classify, excel_path, seperate_path) |
| 369 | shutil.move(path, img_save_path) | 370 | shutil.move(path, img_save_path) |
| 370 | return rebuild_res | 371 | return rebuild_res |
| 371 | 372 | ... | ... |
-
Please register or sign in to post a comment