diff --git a/pywxdump/analyzer/__init__.py b/pywxdump/analyzer/__init__.py index 5353663..6fe6e09 100644 --- a/pywxdump/analyzer/__init__.py +++ b/pywxdump/analyzer/__init__.py @@ -7,5 +7,6 @@ # ------------------------------------------------------------------------------- from .db_parsing import read_img_dat, read_emoji, decompress_CompressContent, read_audio_buf, read_audio, \ parse_xml_string, read_BytesExtra -from .export_chat import export_csv, get_contact_list, get_chatroom_list, get_msg_list, get_chat_count, export_json +from .export_chat import export_csv, get_contact_list, get_chatroom_list, get_msg_list, get_chat_count, export_json, \ + get_all_chat_count from .utils import get_type_name, get_name_typeid diff --git a/pywxdump/analyzer/export_chat.py b/pywxdump/analyzer/export_chat.py index 2d2d9b0..c238f0a 100644 --- a/pywxdump/analyzer/export_chat.py +++ b/pywxdump/analyzer/export_chat.py @@ -290,6 +290,18 @@ def get_chat_count(MSG_db_path: [str, list], username: str = ""): chat_counts[username] = chat_count return chat_counts +def get_all_chat_count(MSG_db_path: [str, list]): + """ + 获取聊天记录总数量 + :param MSG_db_path: MSG.db 文件路径 + :return: 聊天记录数量 + """ + sql = f"SELECT COUNT(*) FROM MSG;" + db1 = sqlite3.connect(MSG_db_path) + result = execute_sql(db1, sql) + chat_counts = result[0][0] + return chat_counts + def export_csv(username, outpath, MSG_ALL_db_path, page_size=5000): if not os.path.exists(outpath):