12319785 by 周伟奇

fix ltgt

1 parent 82e1a38f
......@@ -386,12 +386,16 @@ class Command(BaseCommand, LoggerMixin):
for name in true_file_set:
path = os.path.join(input_dir, name)
try:
if os.path.isfile(path):
if not os.path.exists(path):
self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
continue
elif os.path.isfile(path):
self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
if name.endswith('.pdf') or name.endswith('.PDF'):
result = self.pdf_process(name, path, img_output_dir, wb_output_dir,
pdf_output_dir)
elif name.endswith('.tif') or name.endswith('.TIF'):
elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
name.endswith('.TIFF'):
result = self.tif_process(name, path, img_output_dir, wb_output_dir,
tiff_output_dir)
else:
......
......@@ -561,6 +561,7 @@ class Command(BaseCommand, LoggerMixin):
}
else:
rebuild_res = self.images_process([path], classify, excel_path, seperate_path_map)
if os.path.exists(path):
shutil.move(path, img_save_path)
return rebuild_res
......@@ -690,12 +691,16 @@ class Command(BaseCommand, LoggerMixin):
path = os.path.join(input_dir, name)
try:
if os.path.isfile(path):
if not os.path.exists(path):
self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
continue
elif os.path.isfile(path):
self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
if name.endswith('.pdf') or name.endswith('.PDF'):
result = self.pdf_process(name, path, classify, img_output_dir, wb_output_dir,
pdf_output_dir, seperate_dir_map)
elif name.endswith('.tif') or name.endswith('.TIF'):
elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
name.endswith('.TIFF'):
if classify == consts.CONTRACT_CLASSIFY:
raise LTGTException('e-contract must be pdf')
result = self.tif_process(name, path, classify, img_output_dir, wb_output_dir,
......
......@@ -340,11 +340,15 @@ class Command(BaseCommand, LoggerMixin):
path = os.path.join(input_dir, name)
try:
if os.path.isfile(path):
if not os.path.exists(path):
self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
continue
elif os.path.isfile(path):
self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
if name.endswith('.pdf') or name.endswith('.PDF'):
self.pdf_process(name, path, classify, img_output_dir, wb_output_dir, pdf_output_dir)
elif name.endswith('.tif') or name.endswith('.TIF'):
elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
name.endswith('.TIFF'):
self.tif_process(name, path, classify, img_output_dir, wb_output_dir, tiff_output_dir)
else:
self.img_process(name, path, classify, wb_output_dir, img_output_dir, pdf_output_dir)
......
......@@ -585,11 +585,15 @@ class Command(BaseCommand, LoggerMixin):
path = os.path.join(input_dir, name)
try:
if os.path.isfile(path):
if not os.path.exists(path):
self.folder_log.info('{0} [path is not exists] [path={1}]'.format(self.log_base, path))
continue
elif os.path.isfile(path):
self.folder_log.info('{0} [file start] [path={1}]'.format(self.log_base, path))
if name.endswith('.pdf') or name.endswith('.PDF'):
self.pdf_process(name, path, img_output_dir, wb_output_dir, pdf_output_dir)
elif name.endswith('.tif') or name.endswith('.TIF'):
elif name.endswith('.tif') or name.endswith('.TIF') or name.endswith('.tiff') or \
name.endswith('.TIFF'):
self.tif_process(name, path, img_output_dir, wb_output_dir, tiff_output_dir)
else:
self.folder_log.info('{0} [path is not pdf or tif] [path={1}]'.format(
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!