dongchangxi 12 months ago
parent
commit
0d5d9d9289
  1. 22
      new_studio_to_reg/get_new_studio_reg_info.py

22
new_studio_to_reg/get_new_studio_reg_info.py

@ -94,7 +94,7 @@ def get_photo2_align_info(pid):
with open(os.path.join(config.workdir, pid, 'reg', f'{pid}_imgList.txt'), 'a+') as f: 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") f.write(f"{os.path.join(config.workdir, pid, 'photo2', file)}\n")
alignNums = 0
#遍历 reg 目录 上传到oss 上制定的目录 #遍历 reg 目录 上传到oss 上制定的目录
for file in os.listdir(os.path.join(config.workdir, pid, 'reg')): for file in os.listdir(os.path.join(config.workdir, pid, 'reg')):
if not file.endswith('.jpg'): if not file.endswith('.jpg'):
@ -103,8 +103,14 @@ def get_photo2_align_info(pid):
else: else:
print(f'上传文件:{file}') print(f'上传文件:{file}')
#上传到指定的目录 #上传到指定的目录
alignNums += 1
config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/new_studio_align_info/jpgs/{file}', os.path.join(config.workdir, pid, 'reg', file)) config.oss_bucket.put_object_from_file(f'objs/auto/{pid}/new_studio_align_info/jpgs/{file}', os.path.join(config.workdir, pid, 'reg', file))
#判断对齐的图片数量和photo2的数量是否一致,不一致要进行通知处理
photosNums = len(os.listdir(os.path.join(config.workdir, pid, "photo2")))
if alignNums != photosNums:
notify(f'影棚号:{psid} , PID:{pid},没有对齐,照片数量:{photosNums} 对齐的图片数量:{alignNums}')
#处理完成后塞入到指定的队列 #处理完成后塞入到指定的队列
r = create_redis_connection() r = create_redis_connection()
r.rpush('ai:ai_build_mesh',pid) r.rpush('ai:ai_build_mesh',pid)
@ -124,6 +130,20 @@ def create_redis_connection():
time.sleep(5) 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__': if __name__ == '__main__':
start = time.time() start = time.time()
if len(sys.argv) == 2: if len(sys.argv) == 2:

Loading…
Cancel
Save