Browse Source

配置修改

master
dongchangxi 2 years ago
parent
commit
c0380d2638
  1. 48
      libs/config.py
  2. 3
      libs/libs.py
  3. 12
      libs/libs_db.py

48
libs/config.py

@ -63,34 +63,36 @@ r2 = { @@ -63,34 +63,36 @@ r2 = {
"setRegion" : "-setReconstructionRegionOnCPs 36h11:001 36h11:002 36h11:003 2.1 -moveReconstructionRegion 0 0 -2.1 -rotateReconstructionRegion 180 0 180 -setGroundPlaneFromReconstructionRegion -scaleReconstructionRegion 1.8 1.6 2.1 absolute center -moveReconstructionRegion 0 0 0.0025"
}
#修改为走数据库配置
# 影棚地贴版本定义
floor_sticker_distances = {
# 影棚地贴版本1:老圆形影棚,二维码排序1、2、3、4、1,间距1米
"v1" : "36h11:001 36h11:002 1;36h11:002 36h11:003 1;36h11:003 36h11:004 1;36h11:004 36h11:001 1",
# 影棚地贴版本2:新方形影棚,二维码排序1、2、4、3、1,间距1米 default
"v2" : "36h11:001 36h11:002 1;36h11:002 36h11:004 1;36h11:004 36h11:003 1;36h11:003 36h11:001 1",
# 影棚地贴版本3:新圆形影棚,二维码排序1、2、4、3、1,间距1.5米
"v3" : "36h11:001 36h11:002 1.5;36h11:002 36h11:004 1.5;36h11:004 36h11:003 1.5;36h11:003 36h11:001 1.5",
# 影棚地贴版本4:新方形影棚,二维码排序5、6,间距0.21米
"v4" : "36h11:005 36h11:006 0.21",
# 影棚地贴版本5:新方形影棚,二维码排序7、8,间距0.21米
"v5" : "36h11:007 36h11:008 0.21"
}
# floor_sticker_distances = {
# # 影棚地贴版本1:老圆形影棚,二维码排序1、2、3、4、1,间距1米
# "v1" : "36h11:001 36h11:002 1;36h11:002 36h11:003 1;36h11:003 36h11:004 1;36h11:004 36h11:001 1",
# # 影棚地贴版本2:新方形影棚,二维码排序1、2、4、3、1,间距1米 default
# "v2" : "36h11:001 36h11:002 1;36h11:002 36h11:004 1;36h11:004 36h11:003 1;36h11:003 36h11:001 1",
# # 影棚地贴版本3:新圆形影棚,二维码排序1、2、4、3、1,间距1.5米
# "v3" : "36h11:001 36h11:002 1.5;36h11:002 36h11:004 1.5;36h11:004 36h11:003 1.5;36h11:003 36h11:001 1.5",
# # 影棚地贴版本4:新方形影棚,二维码排序5、6,间距0.21米
# "v4" : "36h11:005 36h11:006 0.21",
# # 影棚地贴版本5:新方形影棚,二维码排序7、8,间距0.21米
# "v5" : "36h11:007 36h11:008 0.21"
# }
#修改为走数据库配置
# 影棚与地贴版本配置关系
ps_floor_sticker = {
"default" : floor_sticker_distances['v5'],
"29" : floor_sticker_distances['v1'],
"44" : floor_sticker_distances['v2'],
"54" : floor_sticker_distances['v2'],
"77" : floor_sticker_distances['v2'],
"79" : floor_sticker_distances['v2'],
"80" : floor_sticker_distances['v2'],
"85" : floor_sticker_distances['v4'],
}
# ps_floor_sticker = {
# "default" : floor_sticker_distances['v5'],
# "29" : floor_sticker_distances['v1'],
# "44" : floor_sticker_distances['v2'],
# "54" : floor_sticker_distances['v2'],
# "77" : floor_sticker_distances['v2'],
# "79" : floor_sticker_distances['v2'],
# "80" : floor_sticker_distances['v2'],
# "85" : floor_sticker_distances['v4'],
# }
# 需要加入新建模系统的影棚
new_make_psids = ['1', '17', '29', '44', '54', '55', '63', '65', '77', '79', '80', '85', '86']
#new_make_psids = ['1', '17', '29', '44', '54', '55', '63', '65', '77', '79', '80', '85', '86']
#企业微信通知人员
notify_user_Ids = ["DongZhangXi","YouShui"]

3
libs/libs.py

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import os, time, json, requests, shutil, oss2, psutil
from tqdm import tqdm
from PIL import Image, ImageEnhance
import config
import config,libs_db
def find_blender_bin_path():
base_path = 'C:\\Program Files\\Blender Foundation\\'
@ -252,6 +252,7 @@ def down_from_oss(oss_client, workdir, pid, per=100): @@ -252,6 +252,7 @@ def down_from_oss(oss_client, workdir, pid, per=100):
def get_defineDistances(psid):
res = ''
distances = libs_db.get_floor_sticker_distances(psid).split(';')
print("distances",distances)
for d in distances:
p1, p2, distance = d.split(' ')
res = res + f' -defineDistance {p1} {p2} {distance}'

12
libs/libs_db.py

@ -79,24 +79,22 @@ def finish_task(data): @@ -79,24 +79,22 @@ def finish_task(data):
print(f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())} 执行finish_task({data})异常: {str(e)}")
# 根据影棚ID 获取影棚的配置,如果没有指定的配置,则返回默认配置
def get_floor_sticker_distances(psid,is_default = False):
def get_floor_sticker_distances(psid):
try:
with pymysqlAlias() as conn:
cursor = conn.cursor()
sql = f'select a.studio_id,value from floor_sticker_link_studio as a left join floor_sticker_distances as b on a.floor_name = b.name where a.studio_id in (0,{psid})'
# print(f'sql: {sql}')
cursor.execute(sql)
result = cursor.fetchall()
if is_default:
return result[0]["value"]
if len(result) == 1:
return result[0]["value"]
return result[0][1]
if len(result) == 2:
for item in result:
if item["studio_id"] == psid:
return item["value"]
if str(item[0]) == str(psid):
return item[1]
return "error-配置异常,该影棚有多个地贴配置"
except Exception as e:
print(f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())} 执行get_floor_sticker_distances()异常: {str(e)}")

Loading…
Cancel
Save