|
|
|
@ -225,9 +225,7 @@ def unpack_pictures_zip(file: UploadFile, time):
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
print(f"Accepted {file.filename} at {time} into processing")
|
|
|
|
print(f"Accepted {file.filename} at {time} into processing")
|
|
|
|
os.chdir(DATA_LOCATION)
|
|
|
|
os.makedirs(os.path.join(DATA_LOCATION, "processing"), exist_ok=True)
|
|
|
|
os.makedirs("processing", exist_ok=True)
|
|
|
|
|
|
|
|
os.chdir("processing")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# using private ._file field is a dirty hack, but
|
|
|
|
# using private ._file field is a dirty hack, but
|
|
|
|
# SpooledTemporaryFile does not implement seekable
|
|
|
|
# SpooledTemporaryFile does not implement seekable
|
|
|
|
@ -236,7 +234,10 @@ def unpack_pictures_zip(file: UploadFile, time):
|
|
|
|
with zipfile.ZipFile(file.file._file) as photo_zip:
|
|
|
|
with zipfile.ZipFile(file.file._file) as photo_zip:
|
|
|
|
problem_files = photo_zip.testzip()
|
|
|
|
problem_files = photo_zip.testzip()
|
|
|
|
if problem_files is not None:
|
|
|
|
if problem_files is not None:
|
|
|
|
print(f"Errors in {file.filename} accepted at {time}: {problem_files}")
|
|
|
|
print(f"Errors in {file.filename} from {time} at {problem_files}")
|
|
|
|
photo_zip.extractall()
|
|
|
|
photo_zip.extractall(path=os.path.join(DATA_LOCATION, "processing"))
|
|
|
|
photo_zip.close()
|
|
|
|
photo_zip.close()
|
|
|
|
print(f"Succesfully processed {file.filename} accepted at {time}")
|
|
|
|
|
|
|
|
|
|
|
|
print(f"Start processing {file.filename} from {time}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(f"Succesfully processed {file.filename} from {time}")
|
|
|
|
|