fix 图片优先显示清晰版本

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

No files matched your search

+5 -4
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): # 图片
DictExtra = read_BytesExtra(BytesExtra)
DictExtra = str(DictExtra)
match = re.search(r"FileStorage(.*?)'", DictExtra)
if match:
img_path = match.group(0).replace("'", "")
DictExtra_str = str(DictExtra)
img_paths = [i for i in re.findall(r"(FileStorage.*?)'", DictExtra_str)]
img_paths = sorted(img_paths, key=lambda p: "Image" in p, reverse=True)
if img_paths:
img_path = img_paths[0].replace("'", "")
img_path = [i for i in img_path.split("\\") if i]
img_path = os.path.join(*img_path)
content["src"] = img_path