fix 图片优先显示清晰版本

This commit is contained in:
xaoyaoo 2024-04-13 19:32:26 +08:00
parent 35aa537a64
commit 0341543ec9
2 changed files with 16 additions and 5 deletions

View File

@ -182,10 +182,11 @@ def get_msg_list(MSG_db_path, selected_talker="", start_index=0, page_size=500):
elif type_id == (3, 0): # 图片 elif type_id == (3, 0): # 图片
DictExtra = read_BytesExtra(BytesExtra) DictExtra = read_BytesExtra(BytesExtra)
DictExtra = str(DictExtra) DictExtra_str = str(DictExtra)
match = re.search(r"FileStorage(.*?)'", DictExtra) img_paths = [i for i in re.findall(r"(FileStorage.*?)'", DictExtra_str)]
if match: img_paths = sorted(img_paths, key=lambda p: "Image" in p, reverse=True)
img_path = match.group(0).replace("'", "") if img_paths:
img_path = img_paths[0].replace("'", "")
img_path = [i for i in img_path.split("\\") if i] img_path = [i for i in img_path.split("\\") if i]
img_path = os.path.join(*img_path) img_path = os.path.join(*img_path)
content["src"] = img_path content["src"] = img_path

View File

@ -264,7 +264,7 @@ def func_get_msgs(start, limit, wxid, msg_path, micro_path):
# row_data = {"MsgSvrID": MsgSvrID, "type_name": type_name, "is_sender": IsSender, "talker": talker, # row_data = {"MsgSvrID": MsgSvrID, "type_name": type_name, "is_sender": IsSender, "talker": talker,
# "room_name": StrTalker, "content": content, "CreateTime": CreateTime} # "room_name": StrTalker, "content": content, "CreateTime": CreateTime}
if "merge_all" in micro_path: if "merge_all" in micro_path:
contact_list = analyzer.get_contact_list(micro_path,micro_path) contact_list = analyzer.get_contact_list(micro_path, micro_path)
else: else:
contact_list = analyzer.get_contact_list(micro_path) contact_list = analyzer.get_contact_list(micro_path)
@ -330,6 +330,15 @@ def get_real_time_msg():
msg_paths.sort() msg_paths.sort()
micro_paths = micro_paths[1] micro_paths = micro_paths[1]
micro_paths.sort() micro_paths.sort()
# for i in media_paths:
# print(i)
# merge_real_time_db(key=key, db_path=i, merge_path=save_media_path)
# for i in msg_paths:
# print(i)
# merge_real_time_db(key=key, db_path=i, merge_path=save_msg_path)
# for i in micro_paths:
# print(i)
# merge_real_time_db(key=key, db_path=i, merge_path=save_micro_path)
merge_real_time_db(key=key, db_path=media_paths[-1], merge_path=save_media_path) merge_real_time_db(key=key, db_path=media_paths[-1], merge_path=save_media_path)
merge_real_time_db(key=key, db_path=msg_paths[-1], merge_path=save_msg_path) merge_real_time_db(key=key, db_path=msg_paths[-1], merge_path=save_msg_path)
merge_real_time_db(key=key, db_path=micro_paths[-1], merge_path=save_micro_path) merge_real_time_db(key=key, db_path=micro_paths[-1], merge_path=save_micro_path)
@ -351,6 +360,7 @@ def get_img():
return ReJson(1003, msg="Unsupported method") return ReJson(1003, msg="Unsupported method")
if not img_path: if not img_path:
return ReJson(1002) return ReJson(1002)
img_path = img_path.replace("\\\\", "\\")
wx_path = read_session(g.sf, "wx_path") wx_path = read_session(g.sf, "wx_path")
img_tmp_path = os.path.join(g.tmp_path, "img") img_tmp_path = os.path.join(g.tmp_path, "img")
img_path_all = os.path.join(wx_path, img_path) img_path_all = os.path.join(wx_path, img_path)