From b793a4424a5c387fc3aef430f72fee40c4c7cb94 Mon Sep 17 00:00:00 2001 From: SiYuan <863909694@qq.com> Date: Sat, 3 Feb 2024 15:11:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E7=BC=A9=E7=95=A5=E5=9B=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/exporter_html.py | 7 +------ app/DataBase/hard_link.py | 4 ++-- app/DataBase/output.py | 7 +------ app/ui/chat/chat_info.py | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/DataBase/exporter_html.py b/app/DataBase/exporter_html.py index 086666b..65ff969 100644 --- a/app/DataBase/exporter_html.py +++ b/app/DataBase/exporter_html.py @@ -55,12 +55,7 @@ class HtmlExporter(ExporterBase): avatar = self.get_avatar_path(is_send, message) display_name = self.get_display_name(is_send, message) str_content = escape_js_and_html(str_content) - image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False) - if not os.path.exists(os.path.join(Me().wx_dir, image_path)): - image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True) - if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)): - return - image_path = image_thumb_path + image_path = hard_link_db.get_image(str_content, BytesExtra, up_dir=Me().wx_dir, thumb=False) image_path = get_image_path(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') doc.write( f'''{{ type:{type_}, text: '{image_path}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}'}},''' diff --git a/app/DataBase/hard_link.py b/app/DataBase/hard_link.py index 177c497..95cf643 100644 --- a/app/DataBase/hard_link.py +++ b/app/DataBase/hard_link.py @@ -226,14 +226,14 @@ class HardLink: result = dat_image return result - def get_image(self, content, bytesExtra, thumb=False) -> str: + def get_image(self, content, bytesExtra, up_dir="", thumb=False) -> str: msg_bytes = MessageBytesExtra() msg_bytes.ParseFromString(bytesExtra) if thumb: result = self.get_image_thumb(content, bytesExtra) else: result = self.get_image_original(content, bytesExtra) - if not (result and os.path.exists(result)): + if not (result and os.path.exists(os.path.join(up_dir, result))): result = self.get_image_thumb(content, bytesExtra) return result diff --git a/app/DataBase/output.py b/app/DataBase/output.py index 540e7c4..a8e2ab8 100644 --- a/app/DataBase/output.py +++ b/app/DataBase/output.py @@ -379,12 +379,7 @@ class OutputImage(QThread): BytesExtra = message[10] timestamp = message[5] try: - image_path = hard_link_db.get_image(str_content, BytesExtra, thumb=False) - if not os.path.exists(os.path.join(Me().wx_dir, image_path)): - image_thumb_path = hard_link_db.get_image(str_content, BytesExtra, thumb=True) - if not os.path.exists(os.path.join(Me().wx_dir, image_thumb_path)): - continue - image_path = image_thumb_path + image_path = hard_link_db.get_image(str_content, BytesExtra, up_dir=Me().wx_dir,thumb=False) image_path = get_image(image_path, base_path=f'/data/聊天记录/{self.contact.remark}/image') try: os.utime(origin_docx_path + image_path[1:], (timestamp, timestamp)) diff --git a/app/ui/chat/chat_info.py b/app/ui/chat/chat_info.py index 6473846..0fa8b42 100644 --- a/app/ui/chat/chat_info.py +++ b/app/ui/chat/chat_info.py @@ -134,7 +134,7 @@ class ChatInfo(QWidget): time_message = Notice(self.last_str_time) self.last_str_time = str_time self.chat_window.add_message_item(time_message, 0) - image_path = hard_link_db.get_image(content=str_content, bytesExtra=BytesExtra, thumb=False) + image_path = hard_link_db.get_image(content=str_content, bytesExtra=BytesExtra, up_dir=Me().wx_dir,thumb=False) image_path = get_abs_path(image_path) bubble_message = BubbleMessage( image_path, From 1fa8241aba5bdb1431cc97d1272570f303bc8b15 Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Sat, 3 Feb 2024 15:40:09 +0800 Subject: [PATCH 2/2] update version --- app/config.py | 2 +- app/ui/mainview.py | 3 ++- app/ui/menu/about_dialog.cp310-win_amd64.pyd | Bin 159744 -> 159744 bytes app/ui/menu/about_dialog.cp311-win_amd64.pyd | Bin 159232 -> 159232 bytes app/ui/menu/about_dialog.cp312-win_amd64.pyd | Bin 158720 -> 158720 bytes 5 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/config.py b/app/config.py index 54dc0c8..2663174 100644 --- a/app/config.py +++ b/app/config.py @@ -1,4 +1,4 @@ -version = '1.1.0' +version = '1.0.8' contact = '701805520' github = 'https://github.com/LC044/WeChatMsg' website = 'https://memotrace.lc044.love/' diff --git a/app/ui/mainview.py b/app/ui/mainview.py index 471d155..2972496 100644 --- a/app/ui/mainview.py +++ b/app/ui/mainview.py @@ -346,7 +346,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif): img_bytes = misc_db.get_avatar_buffer(wxid) except: logger.error(f'数据库错误:\n{traceback.format_exc()}') - QMessageBox.critical(self, "数据库错误", "请重启微信后重试") + QMessageBox.critical(self, "数据库错误", "请重启电脑后重试") close_db() import shutil try: @@ -369,6 +369,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif): shutil.rmtree('./app/Database/Msg') except: pass + QMessageBox.critical(self, "数据库错误", "请重启电脑后重试") return me = Me() me.set_avatar(img_bytes) diff --git a/app/ui/menu/about_dialog.cp310-win_amd64.pyd b/app/ui/menu/about_dialog.cp310-win_amd64.pyd index 6dcc6ce3b3ec6adb33cb9e3ef3ef07d7dad39535..f0ff7a920bd6f8a6c05cace0102905f4e177e9fc 100644 GIT binary patch delta 113 zcmZp8z}fJCbAtpU^NW{zo241IOEWSG=rGALZr9aiJj%w%wEeR&<8~Rwr0uH%7!R{E zZrh$8!I;bfKW=8O#i6K6umt}i%CEbWa{>G RYo^^sj2hdO^O){30sxwECQ$$Y diff --git a/app/ui/menu/about_dialog.cp311-win_amd64.pyd b/app/ui/menu/about_dialog.cp311-win_amd64.pyd index 12fe35deeac6edf808f2b7ab8a17d432d7648768..1d80303261afbf9dd84be6331c4ab020f7ee4ae5 100644 GIT binary patch delta 113 zcmZp;!`X0$bAtpU^V^quo241IOEWSy=riu!KF5IZ7#riF?aAhh+hrJ;wo8XF9%g3@ z+kQWqF_{I(cTQkD!^iY@-*mxz#yrNe+Z*y3TXsz6(O`;THPkcEv)G=f!6YmQGIe{o QCDUpnMuY9jIZSsM0oO|=ssI20 delta 113 zcmZp;!`X0$bAtpU^Rv0To241IOEWSy=rg8npJTvyjE!;C_GEL$?J|s9+oeMo53@7I zZNDGQn9Ks?J0~!n;bUUmKV2}NF^}=;_J(}MmL05ydWL!i(-}3GqPM4LFbN2POx<2? Q$+X&t(PF!D4%1ym0B3+C(f|Me diff --git a/app/ui/menu/about_dialog.cp312-win_amd64.pyd b/app/ui/menu/about_dialog.cp312-win_amd64.pyd index 702c5bc3b8824d6d7a9a87ebe2781981d017d6a7..ef4e819b64eb73024b6a7c98c85b8cde5cbae1ed 100644 GIT binary patch delta 113 zcmZp;!P#(wbAtdQ^XHd)n}r#-3o|lmXfpA#Y`4{7Jj%xSX*;ta<8~RwpzXVT84t5F zF56xo%9zXoG9G4U zT(`YGlrfnF$bTHkc!rNLboz!2#(YNA?FyNUS9Y-)>KW=8O#i6N6umt}g-JjVWa{>G RQ>NV}j2hdOvzYEO0sxQ|CL90&