mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
修复因微信数据库损坏导致的聊天记录缺失问题#117
This commit is contained in:
parent
8f8c4f2083
commit
d4562744d0
@ -11,7 +11,7 @@ def merge_MediaMSG_databases(source_paths, target_path):
|
|||||||
target_conn.execute("BEGIN;")
|
target_conn.execute("BEGIN;")
|
||||||
for i, source_path in enumerate(source_paths):
|
for i, source_path in enumerate(source_paths):
|
||||||
if not os.path.exists(source_path):
|
if not os.path.exists(source_path):
|
||||||
break
|
continue
|
||||||
db = sqlite3.connect(source_path)
|
db = sqlite3.connect(source_path)
|
||||||
db.text_factory = str
|
db.text_factory = str
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
@ -52,7 +52,7 @@ def merge_databases(source_paths, target_path):
|
|||||||
target_conn.execute("BEGIN;")
|
target_conn.execute("BEGIN;")
|
||||||
for i, source_path in enumerate(source_paths):
|
for i, source_path in enumerate(source_paths):
|
||||||
if not os.path.exists(source_path):
|
if not os.path.exists(source_path):
|
||||||
break
|
continue
|
||||||
db = sqlite3.connect(source_path)
|
db = sqlite3.connect(source_path)
|
||||||
db.text_factory = str
|
db.text_factory = str
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
@ -230,7 +230,7 @@ class DecryptThread(QThread):
|
|||||||
# 目标数据库文件
|
# 目标数据库文件
|
||||||
target_database = "app/DataBase/Msg/MSG.db"
|
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
|
import shutil
|
||||||
if os.path.exists(target_database):
|
if os.path.exists(target_database):
|
||||||
os.remove(target_database)
|
os.remove(target_database)
|
||||||
@ -246,7 +246,7 @@ class DecryptThread(QThread):
|
|||||||
# 源数据库文件列表
|
# 源数据库文件列表
|
||||||
if os.path.exists(target_database):
|
if os.path.exists(target_database):
|
||||||
os.remove(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) # 使用一个数据库文件作为模板
|
shutil.copy2("app/DataBase/Msg/MediaMSG0.db", target_database) # 使用一个数据库文件作为模板
|
||||||
# 合并数据库
|
# 合并数据库
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user