From c361de5ad582966159e6976ce55a6ae6b0b30837 Mon Sep 17 00:00:00 2001 From: STDquantum <405720329@qq.com> Date: Wed, 13 Dec 2023 21:03:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E8=A7=86=E9=A2=91=E3=80=81=E9=9F=B3?= =?UTF-8?q?=E9=A2=91=E5=92=8C=E5=9B=BE=E7=89=87=E7=9A=84=E2=80=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=97=B4=E2=80=9D=E5=B1=9E=E6=80=A7=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=85=B6=E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4=EF=BC=8C?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E5=9C=A8=E6=9C=AC=E5=9C=B0=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E8=A7=82=E5=AF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/output_pc.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py index 3966dac..24de94f 100644 --- a/app/DataBase/output_pc.py +++ b/app/DataBase/output_pc.py @@ -190,6 +190,7 @@ class ChildThread(QThread): ) def image(self, doc, message): + origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}" type_ = message[2] str_content = message[7] str_time = message[8] @@ -210,6 +211,9 @@ class ChildThread(QThread): if image_path is None and image_thumb_path is None: return image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') + image_path = image_path.replace('/', '\\') + 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): @@ -236,6 +240,8 @@ class ChildThread(QThread): if self.output_type == Output.HTML: try: audio_path = media_msg_db.get_audio(msgSvrId, output_path=origin_docx_path + "/voice") + audio_path = audio_path.replace('/', '\\') + os.utime(audio_path, (timestamp, timestamp)) audio_path = audio_path.replace('\\', '/') voice_to_text = media_msg_db.get_audio_text(str_content) except: @@ -345,9 +351,10 @@ class ChildThread(QThread): video_path = hard_link_db.get_video(str_content, BytesExtra, thumb=False) image_path = hard_link_db.get_video(str_content, BytesExtra, thumb=True) if video_path is None and image_path is not None: - print(video_path, image_path) image_path = path.get_relative_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') - print(image_path) + 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): @@ -365,6 +372,7 @@ class ChildThread(QThread): new_path = origin_docx_path + '/video/' + os.path.basename(video_path) if not os.path.exists(new_path): shutil.copy(video_path, os.path.join(origin_docx_path, 'video')) + os.utime(new_path, (timestamp, timestamp)) video_path = f'./video/{os.path.basename(video_path)}' video_path = video_path.replace('\\', '/') if self.is_5_min(timestamp):