修复因微信数据库损坏导致的聊天记录缺失问题#117

This commit is contained in:
shuaikangzhou 2023-12-25 20:40:11 +08:00
parent 8f8c4f2083
commit d4562744d0
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ def merge_MediaMSG_databases(source_paths, target_path):
target_conn.execute("BEGIN;")
for i, source_path in enumerate(source_paths):
if not os.path.exists(source_path):
break
continue
db = sqlite3.connect(source_path)
db.text_factory = str
cursor = db.cursor()
@ -52,7 +52,7 @@ def merge_databases(source_paths, target_path):
target_conn.execute("BEGIN;")
for i, source_path in enumerate(source_paths):
if not os.path.exists(source_path):
break
continue
db = sqlite3.connect(source_path)
db.text_factory = str
cursor = db.cursor()

View File

@ -230,7 +230,7 @@ class DecryptThread(QThread):
# 目标数据库文件
target_database = "app/DataBase/Msg/MSG.db"
# 源数据库文件列表
source_databases = [f"app/DataBase/Msg/MSG{i}.db" for i in range(1, 200)]
source_databases = [f"app/DataBase/Msg/MSG{i}.db" for i in range(1, 50)]
import shutil
if os.path.exists(target_database):
os.remove(target_database)
@ -246,7 +246,7 @@ class DecryptThread(QThread):
# 源数据库文件列表
if os.path.exists(target_database):
os.remove(target_database)
source_databases = [f"app/DataBase/Msg/MediaMSG{i}.db" for i in range(1, 200)]
source_databases = [f"app/DataBase/Msg/MediaMSG{i}.db" for i in range(1, 50)]
shutil.copy2("app/DataBase/Msg/MediaMSG0.db", target_database) # 使用一个数据库文件作为模板
# 合并数据库
try: