修复目录创建问题

This commit is contained in:
shuaikangzhou 2023-12-03 00:03:00 +08:00
parent d60e60e052
commit 292533b1a2
5 changed files with 25 additions and 39 deletions

View File

@ -9,8 +9,7 @@ from ..DataBase import hard_link_db
from ..person_pc import MePC from ..person_pc import MePC
from ..util import get_abs_path from ..util import get_abs_path
if not os.path.exists('./data/聊天记录'): os.makedirs('./data/聊天记录', exist_ok=True)
os.mkdir('./data/聊天记录')
def escape_js_and_html(input_str): def escape_js_and_html(input_str):
@ -61,8 +60,7 @@ class Output(QThread):
def to_csv_all(self): def to_csv_all(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/" origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/"
if not os.path.exists(origin_docx_path): os.makedirs(origin_docx_path, exist_ok=True)
os.mkdir(origin_docx_path)
filename = f"{os.path.abspath('.')}/data/聊天记录/messages.csv" filename = f"{os.path.abspath('.')}/data/聊天记录/messages.csv"
# columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"] # columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
columns = ['localId', 'TalkerId', 'Type', 'SubType', columns = ['localId', 'TalkerId', 'Type', 'SubType',
@ -145,8 +143,7 @@ class ChildThread(QThread):
def to_csv(self): def to_csv(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}" origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
if not os.path.exists(origin_docx_path): os.makedirs(origin_docx_path, exist_ok=True)
os.mkdir(origin_docx_path)
filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.csv" filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.csv"
# columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"] # columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
columns = ['localId', 'TalkerId', 'Type', 'SubType', columns = ['localId', 'TalkerId', 'Type', 'SubType',
@ -163,8 +160,7 @@ class ChildThread(QThread):
def to_csv_all(self): def to_csv_all(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/" origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/"
if not os.path.exists(origin_docx_path): os.makedirs(origin_docx_path, exist_ok=True)
os.mkdir(origin_docx_path)
filename = f"{os.path.abspath('.')}/data/聊天记录/messages.csv" filename = f"{os.path.abspath('.')}/data/聊天记录/messages.csv"
# columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"] # columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
columns = ['localId', 'TalkerId', 'Type', 'SubType', columns = ['localId', 'TalkerId', 'Type', 'SubType',
@ -181,8 +177,7 @@ class ChildThread(QThread):
def to_html(self): def to_html(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}" origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
if not os.path.exists(origin_docx_path): os.makedirs(origin_docx_path, exist_ok=True)
os.mkdir(origin_docx_path)
messages = msg_db.get_messages(self.contact.wxid) messages = msg_db.get_messages(self.contact.wxid)
filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html" filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html"
f = open(filename, 'w', encoding='utf-8') f = open(filename, 'w', encoding='utf-8')
@ -439,8 +434,7 @@ class ChildThread(QThread):
def to_html_(self): def to_html_(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}" origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
if not os.path.exists(origin_docx_path): os.makedirs(origin_docx_path, exist_ok=True)
os.mkdir(origin_docx_path)
messages = msg_db.get_messages(self.contact.wxid) messages = msg_db.get_messages(self.contact.wxid)
filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html" filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html"
f = open(filename, 'w', encoding='utf-8') f = open(filename, 'w', encoding='utf-8')

View File

@ -1,4 +1,4 @@
version = '0.2.5' version = '0.2.6'
contact = '474379264' contact = '474379264'
description = [ description = [
'1. 支持获取个人信息<br>', '1. 支持获取个人信息<br>',

View File

@ -83,10 +83,8 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
if self.wx_dir and os.path.exists(os.path.join(self.wx_dir)): if self.wx_dir and os.path.exists(os.path.join(self.wx_dir)):
self.label_ready.setText('已就绪') self.label_ready.setText('已就绪')
except Exception as e: except Exception as e:
print(e) QMessageBox.critical(self, "未知错误", "请收集报错信息发起issue解决问题")
QMessageBox.critical(self, "错误", "请登录微信")
logger.error(traceback.format_exc()) logger.error(traceback.format_exc())
traceback.print_exc()
def set_wxid_(self): def set_wxid_(self):
self.info['wxid'] = self.lineEdit.text() self.info['wxid'] = self.lineEdit.text()
@ -164,8 +162,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
'mobile': self.info['mobile'] 'mobile': self.info['mobile']
} }
try: try:
if not os.path.exists('./app/data'): os.makedirs('./app/data', exist_ok=True)
os.mkdir('./app/data')
with open('./app/data/info.json', 'w', encoding='utf-8') as f: with open('./app/data/info.json', 'w', encoding='utf-8') as f:
f.write(json.dumps(dic)) f.write(json.dumps(dic))
except: except:
@ -203,13 +200,7 @@ class DecryptThread(QThread):
# micro_msg_db.close() # micro_msg_db.close()
# hard_link_db.close() # hard_link_db.close()
output_dir = 'app/DataBase/Msg' output_dir = 'app/DataBase/Msg'
try: os.makedirs(output_dir, exist_ok=True)
if not os.path.exists(output_dir):
os.mkdir(output_dir)
except:
os.mkdir('app')
os.mkdir('app/DataBase')
os.mkdir('app/DataBase/Msg')
tasks = [] tasks = []
if os.path.exists(self.db_path): if os.path.exists(self.db_path):
for root, dirs, files in os.walk(self.db_path): for root, dirs, files in os.walk(self.db_path):

View File

@ -4,10 +4,7 @@ import winreg
from app.person_pc import MePC from app.person_pc import MePC
from app.util import dat2pic from app.util import dat2pic
if not os.path.exists('./data/'): os.makedirs('./data/image', exist_ok=True)
os.mkdir('./data/')
if not os.path.exists('./data/image'):
os.mkdir('./data/image')
def get_abs_path(path): def get_abs_path(path):
@ -20,6 +17,11 @@ def get_abs_path(path):
return ':/icons/icons/404.png' return ':/icons/icons/404.png'
def mkdir(path):
if not os.path.exists(path):
os.mkdir(path)
def wx_path(): def wx_path():
## 获取当前用户名 ## 获取当前用户名
user_home = os.environ.get("USERPROFILE") user_home = os.environ.get("USERPROFILE")

View File

@ -35,18 +35,12 @@
## 🍉功能 ## 🍉功能
- 恢复📱手机微信数据库 - 获得📱手机本地微信数据库的使用权🐶
- 安卓 or 苹果都可以哦 - 获得💻PC端本地微信数据库的使用权🐶
- 恢复💻PC端微信数据库
- 还原微信聊天界面 - 还原微信聊天界面
- 🗨文本✅ - 🗨文本✅
- 🏝图片✅ - 🏝图片✅
- 🐻‍❄️表情包✅ - 🐻‍❄️表情包✅
- 语音❎
- 视频❎
- 文件❎
- 回复❎
- 拍一拍❎
- 导出聊天记录 - 导出聊天记录
- sqlite数据库✅ - sqlite数据库✅
- HTML(文本、图片)✅ - HTML(文本、图片)✅
@ -56,7 +50,11 @@
- 🔥**项目持续更新中** - 🔥**项目持续更新中**
- 导出全部表情包❎ - 导出全部表情包❎
- 合并多个备份数据❎ - 合并多个备份数据❎
- 语音❎
- 视频❎
- 文件❎
- 回复❎
- 拍一拍❎
- 小伙伴们想要其他功能可以留言哦📬 - 小伙伴们想要其他功能可以留言哦📬
- 有任何问题可以随时联系我(863909694@qq.com) - 有任何问题可以随时联系我(863909694@qq.com)
@ -146,7 +144,8 @@ python main_pc.py
### 3. 查看 ### 3. 查看
随便下载一个SQLite数据库查看软件就能打开数据库例如[DB Browser for SQLite](https://sqlitebrowser.org/dl/)不懂SQL的就别折腾了 随便下载一个SQLite数据库查看软件就能打开数据库例如[DB Browser for SQLite](https://sqlitebrowser.org/dl/)
不懂SQL的稍微学下SQL咱再来或者自动跳过该步骤直接往下看最终效果
* [数据库功能介绍](./doc/数据库介绍.md) * [数据库功能介绍](./doc/数据库介绍.md)
* [更多功能介绍](./doc/电脑端使用教程.md) * [更多功能介绍](./doc/电脑端使用教程.md)