mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-23 06:21:37 +00:00
Skip generating chats that do not contain any message
This commit is contained in:
@@ -661,6 +661,9 @@ def create_html(
|
|||||||
|
|
||||||
for current, contact in enumerate(data):
|
for current, contact in enumerate(data):
|
||||||
current_chat = data.get_chat(contact)
|
current_chat = data.get_chat(contact)
|
||||||
|
if len(current_chat) == 0:
|
||||||
|
# Skip empty chats
|
||||||
|
continue
|
||||||
safe_file_name, name = get_file_name(contact, current_chat)
|
safe_file_name, name = get_file_name(contact, current_chat)
|
||||||
|
|
||||||
if maximum_size is not None:
|
if maximum_size is not None:
|
||||||
@@ -733,6 +736,8 @@ def create_html(
|
|||||||
def create_txt(data, output):
|
def create_txt(data, output):
|
||||||
os.makedirs(output, exist_ok=True)
|
os.makedirs(output, exist_ok=True)
|
||||||
for jik, chat in data.items():
|
for jik, chat in data.items():
|
||||||
|
if len(chat) == 0:
|
||||||
|
continue
|
||||||
if chat.name is not None:
|
if chat.name is not None:
|
||||||
contact = chat.name.replace('/', '')
|
contact = chat.name.replace('/', '')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ class ChatStore:
|
|||||||
self.their_avatar_thumb = None
|
self.their_avatar_thumb = None
|
||||||
self.status = None
|
self.status = None
|
||||||
self.media_base = ""
|
self.media_base = ""
|
||||||
|
|
||||||
|
def __len__(self) -> int:
|
||||||
|
"""Get number of chats. Required for dict-like access."""
|
||||||
|
return len(self._messages)
|
||||||
|
|
||||||
def add_message(self, id: str, message: 'Message') -> None:
|
def add_message(self, id: str, message: 'Message') -> None:
|
||||||
"""Add a message to the chat store."""
|
"""Add a message to the chat store."""
|
||||||
|
|||||||
Reference in New Issue
Block a user