Add SNS/image export and GUI contact export
Introduce SNS (朋友圈) and batch image tooling and enhance the GUI export workflow. Added new scripts: decrypt_sns.py (decrypt WeChat SNS cache) and batch_decrypt_images.py (bulk .dat image decrypt). Update build scripts and PyInstaller spec to include the new files. app_gui.py: add contact discovery, contact selection/export options dialog, new buttons (find image key, SNS), orchestrate combined export/voice/SNS tasks via subprocesses and env flags, and auto-run export after decryption. config.py: add output_base_dir, auto-detect WeChat Files path, and expose msgattach/xwechat cache dirs. export_messages.py: switch to output_base_dir, add image resource lookup and .dat locating/decryption helpers, and support environment-driven contact/format/image filters. Misc: update build.bat and packaging datas to include the new modules. Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
26
config.py
26
config.py
@@ -229,8 +229,34 @@ def load_config():
|
||||
else:
|
||||
cfg["wechat_base_dir"] = db_dir
|
||||
|
||||
# 输出目录:<app_dir>/wechat_files/<wxid>/
|
||||
wxid = os.path.basename(os.path.normpath(cfg["wechat_base_dir"]))
|
||||
cfg["output_base_dir"] = os.path.join(base, "wechat_files", wxid)
|
||||
|
||||
# decoded_image_dir 默认值
|
||||
if "decoded_image_dir" not in cfg:
|
||||
cfg["decoded_image_dir"] = os.path.join(base, "decoded_images")
|
||||
|
||||
# 自动检测 WeChat Files 目录(FileStorage/MsgAttach, FileStorage/Sns/Cache)
|
||||
if not cfg.get("wechat_files_dir"):
|
||||
wechat_files_base = os.path.join(os.path.expanduser("~"), "Documents", "WeChat Files")
|
||||
if os.path.isdir(wechat_files_base):
|
||||
# xwechat_files 的 wxid 可能带后缀如 _1d4c,需要模糊匹配
|
||||
wxid_prefix = wxid.rsplit("_", 1)[0] if "_" in wxid else wxid
|
||||
for d in os.listdir(wechat_files_base):
|
||||
if d == wxid or d == wxid_prefix or wxid.startswith(d):
|
||||
candidate = os.path.join(wechat_files_base, d)
|
||||
if os.path.isdir(os.path.join(candidate, "FileStorage")):
|
||||
cfg["wechat_files_dir"] = candidate
|
||||
break
|
||||
|
||||
wf_dir = cfg.get("wechat_files_dir", "")
|
||||
cfg["msgattach_dir"] = os.path.join(wf_dir, "FileStorage", "MsgAttach") if wf_dir else ""
|
||||
cfg["sns_cache_dir"] = os.path.join(wf_dir, "FileStorage", "Sns", "Cache") if wf_dir else ""
|
||||
|
||||
# xwechat_files 图片/缓存路径
|
||||
wb = cfg["wechat_base_dir"]
|
||||
cfg["xwechat_attach_dir"] = os.path.join(wb, "msg", "attach") if wb else ""
|
||||
cfg["xwechat_cache_dir"] = os.path.join(wb, "cache") if wb else ""
|
||||
|
||||
return cfg
|
||||
|
||||
Reference in New Issue
Block a user