|
|
|
|
@ -55,18 +55,23 @@ def get_photo2_align_info(pid,flagDoXmps=False):
@@ -55,18 +55,23 @@ def get_photo2_align_info(pid,flagDoXmps=False):
|
|
|
|
|
#下载照片 |
|
|
|
|
libs.down_from_oss(config.oss_bucket, config.workdir, pid) |
|
|
|
|
|
|
|
|
|
#判断对齐的图片数量和photo2的数量是否一致,不一致要进行通知处理 |
|
|
|
|
photosNums = len(os.listdir(os.path.join(config.workdir, pid, "photo2"))) |
|
|
|
|
#判断是否存在该目录 |
|
|
|
|
print(f"影棚号:{psid} , {config.oss_bucket.object_exists(f'xmps_rate/{psid}/')}") |
|
|
|
|
filename = f'xmps_rate/{psid}/{psid}.rcbox' |
|
|
|
|
isRate = False |
|
|
|
|
if not config.oss_bucket.object_exists(filename) or flagDoXmps == True: |
|
|
|
|
#提示是否进行 xmps_rate 文件夹的创建 |
|
|
|
|
yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)') |
|
|
|
|
if yes_or_not == 'y': |
|
|
|
|
tools_to_xmps.create_rate_xmps(pid) |
|
|
|
|
isRate = True |
|
|
|
|
else: |
|
|
|
|
sys.exit(0) |
|
|
|
|
# yes_or_not = input('当前该影棚没有对应的对齐坐标,是否创建?(y/n)') |
|
|
|
|
# if yes_or_not == 'y': |
|
|
|
|
# tools_to_xmps.create_rate_xmps(pid) |
|
|
|
|
# isRate = True |
|
|
|
|
# else: |
|
|
|
|
# sys.exit(0) |
|
|
|
|
#没有坐标的必须重建 |
|
|
|
|
tools_to_xmps.create_rate_xmps(pid) |
|
|
|
|
isRate = True |
|
|
|
|
|
|
|
|
|
#旋转图片 |
|
|
|
|
if isRate == False: |
|
|
|
|
@ -95,17 +100,25 @@ def get_photo2_align_info(pid,flagDoXmps=False):
@@ -95,17 +100,25 @@ def get_photo2_align_info(pid,flagDoXmps=False):
|
|
|
|
|
with open(os.path.join(config.workdir, pid, 'reg', f'{pid}_imgList.txt'), 'a+') as f: |
|
|
|
|
f.write(f"{os.path.join(config.workdir, pid, 'photo2', file)}\n") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alignNums = 0 |
|
|
|
|
#遍历 reg 目录 上传到oss 上制定的目录 |
|
|
|
|
for file in os.listdir(os.path.join(config.workdir, pid, 'reg')): |
|
|
|
|
if not file.endswith('.jpg'): |
|
|
|
|
print(f'上传文件:{file}') |
|
|
|
|
config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/repeat_build/{file}', os.path.join(config.workdir, pid, 'reg', file)) |
|
|
|
|
else: |
|
|
|
|
alignNums += 1 |
|
|
|
|
print(f'上传文件:{file}') |
|
|
|
|
#上传到指定的目录 |
|
|
|
|
config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/repeat_build/jpgs/{file}', os.path.join(config.workdir, pid, 'reg', file)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if alignNums != photosNums: |
|
|
|
|
notify(f'影棚号:{psid} , PID:{pid},没有对齐,照片数量:{photosNums} 对齐的图片数量:{alignNums}') |
|
|
|
|
#删除文件夹 |
|
|
|
|
shutil.rmtree(os.path.join(config.workdir, pid), ignore_errors=True) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
#处理完成后塞入到指定的队列 |
|
|
|
|
r = create_redis_connection() |
|
|
|
|
r.rpush('ai:ai_repeat_build',pid) |
|
|
|
|
@ -128,6 +141,20 @@ def create_redis_connection():
@@ -128,6 +141,20 @@ def create_redis_connection():
|
|
|
|
|
time.sleep(5) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def notify(content): |
|
|
|
|
|
|
|
|
|
if content == "": |
|
|
|
|
return "content 不能为空" |
|
|
|
|
|
|
|
|
|
for user_agent_id in ["18950403426","13600957301"]: |
|
|
|
|
data = { |
|
|
|
|
'userId': user_agent_id, |
|
|
|
|
'message': content, |
|
|
|
|
} |
|
|
|
|
headers = {'Content-Type': 'application/json'} |
|
|
|
|
message_send_url = "https://mp.api.suwa3d.com/api/qyNotify/sendMessage?userId="+user_agent_id+"&message="+content |
|
|
|
|
response = requests.post(message_send_url, data=json.dumps(data), headers=headers) |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
start = time.time() |
|
|
|
|
if len(sys.argv) >= 2: |
|
|
|
|
|