修复目录创建问题

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

View File

@ -1,4 +1,4 @@
version = '0.2.5'
version = '0.2.6'
contact = '474379264'
description = [
'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)):
self.label_ready.setText('已就绪')
except Exception as e:
print(e)
QMessageBox.critical(self, "错误", "请登录微信")
QMessageBox.critical(self, "未知错误", "请收集报错信息发起issue解决问题")
logger.error(traceback.format_exc())
traceback.print_exc()
def set_wxid_(self):
self.info['wxid'] = self.lineEdit.text()
@ -164,8 +162,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
'mobile': self.info['mobile']
}
try:
if not os.path.exists('./app/data'):
os.mkdir('./app/data')
os.makedirs('./app/data', exist_ok=True)
with open('./app/data/info.json', 'w', encoding='utf-8') as f:
f.write(json.dumps(dic))
except:
@ -203,13 +200,7 @@ class DecryptThread(QThread):
# micro_msg_db.close()
# hard_link_db.close()
output_dir = 'app/DataBase/Msg'
try:
if not os.path.exists(output_dir):
os.mkdir(output_dir)
except:
os.mkdir('app')
os.mkdir('app/DataBase')
os.mkdir('app/DataBase/Msg')
os.makedirs(output_dir, exist_ok=True)
tasks = []
if os.path.exists(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.util import dat2pic
if not os.path.exists('./data/'):
os.mkdir('./data/')
if not os.path.exists('./data/image'):
os.mkdir('./data/image')
os.makedirs('./data/image', exist_ok=True)
def get_abs_path(path):
@ -20,6 +17,11 @@ def get_abs_path(path):
return ':/icons/icons/404.png'
def mkdir(path):
if not os.path.exists(path):
os.mkdir(path)
def wx_path():
## 获取当前用户名
user_home = os.environ.get("USERPROFILE")

View File

@ -35,18 +35,12 @@
## 🍉功能
- 恢复📱手机微信数据库
- 安卓 or 苹果都可以哦
- 恢复💻PC端微信数据库
- 获得📱手机本地微信数据库的使用权🐶
- 获得💻PC端本地微信数据库的使用权🐶
- 还原微信聊天界面
- 🗨文本✅
- 🏝图片✅
- 🐻‍❄️表情包✅
- 语音❎
- 视频❎
- 文件❎
- 回复❎
- 拍一拍❎
- 导出聊天记录
- sqlite数据库✅
- HTML(文本、图片)✅
@ -56,7 +50,11 @@
- 🔥**项目持续更新中**
- 导出全部表情包❎
- 合并多个备份数据❎
- 语音❎
- 视频❎
- 文件❎
- 回复❎
- 拍一拍❎
- 小伙伴们想要其他功能可以留言哦📬
- 有任何问题可以随时联系我(863909694@qq.com)
@ -146,7 +144,8 @@ python main_pc.py
### 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)