From 360419ead92283a799b080769478b9a15190b1d9 Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Sat, 16 Dec 2023 18:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/output_pc.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py index 92e4938..ade15de 100644 --- a/app/DataBase/output_pc.py +++ b/app/DataBase/output_pc.py @@ -364,17 +364,22 @@ class ChildThread(QThread): if video_path is None and image_path is not None: image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') image_path = image_path - os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp)) - print(origin_docx_path + image_path[1:]) - image_path = image_path.replace('\\', '/') - # print(f"tohtml:---{image_path}") - if self.is_5_min(timestamp): + try: + print(origin_docx_path + image_path[1:]) + os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp)) + image_path = image_path.replace('\\', '/') + # print(f"tohtml:---{image_path}") + if self.is_5_min(timestamp): + doc.write( + f'''{{ type:0, text: '{str_time}',is_send:0,avatar_path:''}},''' + ) doc.write( - f'''{{ type:0, text: '{str_time}',is_send:0,avatar_path:''}},''' + f'''{{ type:3, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}'}},''' + ) + except: + doc.write( + f'''{{ type:1, text: '视频丢失',is_send:{is_send},avatar_path:'{avatar}'}},''' ) - doc.write( - f'''{{ type:3, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}'}},''' - ) return if video_path is None and image_path is None: return