Skip to content

Commit

Permalink
fix AND MicroMsg实时数据库 #82
Browse files Browse the repository at this point in the history
  • Loading branch information
xaoyaoo committed Mar 15, 2024
1 parent 2c5e08a commit 62ffe40
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ qq交流群:[276392799](https://s.xaoyo.top/gOLUDl) or [276392799](https://s.x
* 常见问题请参考[FAQ](https://github.com/xaoyaoo/PyWxDump/tree/master/doc/FAQ.md),更新日志请参考[CHANGELOG](https://github.com/xaoyaoo/PyWxDump/tree/master/doc/CHANGELOG.md)
* Web UI的仓库位置 [wxdump_web](https://github.com/xaoyaoo/wxdump_web)
* 如果对wxdump实现原理感兴趣,请关注公众号:`逍遥之芯`,回复:`原理` 获取原理解析。

* [:sparkling\_heart: Support Me](https://github.com/xaoyaoo/xaoyaoo/blob/main/donate.md)
* 私有化定制开发请关注公众号:`逍遥之芯`,回复:`私有化定制`

## 5. Star History

Expand Down
2 changes: 1 addition & 1 deletion pywxdump/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@

PYWXDUMP_ROOT_PATH = os.path.dirname(__file__)

__version__ = "2.4.56"
__version__ = "2.4.57"
7 changes: 5 additions & 2 deletions pywxdump/analyzer/db_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ def read_audio(MsgSvrID, is_play=False, is_wave=False, DB_PATH: str = "", rate=2
if len(DBdata) == 0:
return False
data = DBdata[0][0] # [1:] + b'\xFF\xFF'
pcm_data = read_audio_buf(data, is_play, is_wave, rate)
return pcm_data
try:
pcm_data = read_audio_buf(data, is_play, is_wave, rate)
return pcm_data
except Exception as e:
return False


def wordcloud_generator(text, out_path="", is_show=False, img_path="", font="C:\Windows\Fonts\simhei.ttf"):
Expand Down
7 changes: 6 additions & 1 deletion pywxdump/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,22 +309,27 @@ def get_real_time_msg():
"""
save_msg_path = read_session(g.sf, "msg_path")
save_media_path = read_session(g.sf, "media_path")
save_micro_path = read_session(g.sf, "micro_path")
wx_path = read_session(g.sf, "wx_path")
key = read_session(g.sf, "key")

if not save_msg_path or not save_media_path or not wx_path or not key:
return ReJson(1002, body="msg_path or media_path or wx_path or key is required")
media_paths = get_core_db(wx_path, ["MediaMSG"])
msg_paths = get_core_db(wx_path, ["MSG"])
micro_paths = get_core_db(wx_path, ["MicroMsg"])

if not media_paths[0] or not msg_paths[0]:
if not media_paths[0] or not msg_paths[0] or not micro_paths[0]:
return ReJson(1001, body="media_paths or msg_paths is required")
media_paths = media_paths[1]
media_paths.sort()
msg_paths = msg_paths[1]
msg_paths.sort()
micro_paths = micro_paths[1]
micro_paths.sort()
merge_real_time_db(key=key, db_path=media_paths[-1], merge_path=save_media_path)
merge_real_time_db(key=key, db_path=msg_paths[-1], merge_path=save_msg_path)
merge_real_time_db(key=key, db_path=micro_paths[-1], merge_path=save_micro_path)
return ReJson(0, "success")


Expand Down
3 changes: 3 additions & 0 deletions pywxdump/wx_info/merge_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def merge_real_time_db(key, db_path: str, merge_path: str, CreateTime: int = 0,
if not os.path.exists(db_path):
raise FileNotFoundError("数据库不存在")

if "MSG" not in db_path and "MicroMsg" not in db_path and "MediaMSG" not in db_path:
raise FileNotFoundError("数据库不是消息数据库") # MicroMsg实时数据库

out_path = "tmp_" + ''.join(
random.choices('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=6)) + ".db"
merge_path_base = os.path.dirname(merge_path) # 合并后的数据库路径
Expand Down
Binary file modified pywxdump/wx_info/tools/realTime.exe
Binary file not shown.

0 comments on commit 62ffe40

Please sign in to comment.