From e9cc4b0788191db58c2c0bc4a385da51eacf455d Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Wed, 3 Jan 2024 21:48:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/media_msg.py | 12 +++++++++--- app/DataBase/output.py | 5 +++++ app/config.py | 10 ++++++---- readme.md | 6 ++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/app/DataBase/media_msg.py b/app/DataBase/media_msg.py index 6cfe320..8d0bc83 100644 --- a/app/DataBase/media_msg.py +++ b/app/DataBase/media_msg.py @@ -85,16 +85,22 @@ class MediaMsg: # # 调用 FFmpeg if os.path.exists(ffmpeg_path): cmd = f'''{ffmpeg_path} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}''' - system(cmd) + # system(cmd) + # 使用subprocess.run()执行命令 + subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) else: # 源码运行的时候下面的有效 # 这里不知道怎么捕捉异常 cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data','ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}''' - system(cmd) + # system(cmd) + # 使用subprocess.run()执行命令 + subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) except Exception as e: print(f"Error: {e}") cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data', 'ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}''' - system(cmd) + # system(cmd) + # 使用subprocess.run()执行命令 + subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) os.remove(silk_path) os.remove(pcm_path) print(mp3_path) diff --git a/app/DataBase/output.py b/app/DataBase/output.py index e8dd1e8..fda8dfa 100644 --- a/app/DataBase/output.py +++ b/app/DataBase/output.py @@ -53,6 +53,11 @@ def makedirs(path): os.makedirs(os.path.join(path, 'music'), exist_ok=True) os.makedirs(os.path.join(path, 'icon'), exist_ok=True) resource_dir = os.path.join('app', 'resources', 'data', 'icons') + if not os.path.exists(resource_dir): + # 获取打包后的资源目录 + resource_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__))) + # 构建 FFmpeg 可执行文件的路径 + resource_dir = os.path.join(resource_dir, 'app', 'resources', 'data', 'icons') target_folder = os.path.join(path, 'icon') # 拷贝一些必备的图标 for root, dirs, files in os.walk(resource_dir): diff --git a/app/config.py b/app/config.py index d61deab..9f68a4a 100644 --- a/app/config.py +++ b/app/config.py @@ -1,14 +1,15 @@ -version = '1.0.1' +version = '1.0.2' contact = '701805520' github = 'https://github.com/LC044/WeChatMsg' website = 'https://memotrace.lc044.love/' -copyright = '©2022-2023 ShuaikangZhou' +copyright = '© 2022-2024 SiYuan' +license = 'GPLv3' description = [ '1. 支持获取个人信息
', '2. 支持显示聊天界面
', '3. 支持导出聊天记录
    * csv
    * html
    * ' - 'txt
', - '4. 生成年度报告——圣诞特别版
', + 'txt
    * docx
', + '4. 生成年度报告——圣诞特别版', ] about = f''' 版本:{version}
@@ -16,5 +17,6 @@ about = f''' 地址:{github}
官网:{website}
新特性:
{''.join(['' + i for i in description])}
+ License {license}
Copyright {copyright} ''' diff --git a/readme.md b/readme.md index 8aea2ce..9d90f15 100644 --- a/readme.md +++ b/readme.md @@ -308,3 +308,9 @@ python main.py + +## License + +WeChatMsg is licensed under [GPLv3](./LICENSE). + +Copyright © 2022-2024 by SiYuan. \ No newline at end of file