mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-23 14:31:37 +00:00
The check happened in __main__ already
This commit is contained in:
@@ -546,8 +546,8 @@ def main():
|
|||||||
if (args.filter_empty):
|
if (args.filter_empty):
|
||||||
data = {k: v for k, v in data.items() if not is_chat_empty(v)}
|
data = {k: v for k, v in data.items() if not is_chat_empty(v)}
|
||||||
|
|
||||||
if contacts_names_from_vcards_enricher.should_enrich_names_from_vCards():
|
|
||||||
contacts_names_from_vcards_enricher.enrich_names_from_vCards(data)
|
contacts_names_from_vcards_enricher.enrich_names_from_vCards(data)
|
||||||
|
if contact_store.should_enrich_from_vcards():
|
||||||
|
|
||||||
if isinstance(data[next(iter(data))], ChatStore):
|
if isinstance(data[next(iter(data))], ChatStore):
|
||||||
data = {jik: chat.to_json() for jik, chat in data.items()}
|
data = {jik: chat.to_json() for jik, chat in data.items()}
|
||||||
|
|||||||
@@ -1,23 +1,15 @@
|
|||||||
import itertools
|
import itertools
|
||||||
from typing import List, TypedDict
|
from typing import List, TypedDict
|
||||||
|
import vobject
|
||||||
try:
|
|
||||||
import vobject
|
|
||||||
except ModuleNotFoundError:
|
|
||||||
vcards_deps_installed = False
|
|
||||||
else:
|
|
||||||
vcards_deps_installed = True
|
|
||||||
|
|
||||||
class ContactsNamesFromVCards:
|
class ContactsNamesFromVCards:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.l = []
|
self.l = []
|
||||||
|
|
||||||
def should_enrich_names_from_vCards(self):
|
def should_enrich_from_vcards(self):
|
||||||
return len(self.l) > 0
|
return len(self.l) > 0
|
||||||
|
|
||||||
def load_vcf_file(self, vcfFilePath: str, default_country_calling_code: str):
|
def load_vcf_file(self, vcfFilePath: str, default_country_calling_code: str):
|
||||||
if not vcards_deps_installed:
|
|
||||||
raise Exception('Invariant: vobject is missing')
|
|
||||||
self.l = readVCardsFile(vcfFilePath, default_country_calling_code)
|
self.l = readVCardsFile(vcfFilePath, default_country_calling_code)
|
||||||
|
|
||||||
def enrich_names_from_vCards(self, chats):
|
def enrich_names_from_vCards(self, chats):
|
||||||
|
|||||||
Reference in New Issue
Block a user