mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-08-18 18:23:24 +02:00
Change "Gathering" to "Processing"
This commit is contained in:
@@ -152,7 +152,7 @@ def contacts(db, data):
|
|||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute("""SELECT count() FROM wa_contacts""")
|
c.execute("""SELECT count() FROM wa_contacts""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"Gathering contacts...({total_row_number})")
|
print(f"Processing contacts...({total_row_number})")
|
||||||
|
|
||||||
c.execute("""SELECT jid, display_name FROM wa_contacts; """)
|
c.execute("""SELECT jid, display_name FROM wa_contacts; """)
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
@@ -169,7 +169,7 @@ def messages(db, data):
|
|||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
c.execute("""SELECT count() FROM message""")
|
c.execute("""SELECT count() FROM message""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"Gathering messages...(0/{total_row_number})", end="\r")
|
print(f"Processing messages...(0/{total_row_number})", end="\r")
|
||||||
|
|
||||||
phone_number_re = re.compile(r"[0-9]+@s.whatsapp.net")
|
phone_number_re = re.compile(r"[0-9]+@s.whatsapp.net")
|
||||||
try:
|
try:
|
||||||
@@ -386,7 +386,7 @@ def messages(db, data):
|
|||||||
data[content["key_remote_jid"]].add_message(content["_id"], message)
|
data[content["key_remote_jid"]].add_message(content["_id"], message)
|
||||||
i += 1
|
i += 1
|
||||||
if i % 1000 == 0:
|
if i % 1000 == 0:
|
||||||
print(f"Gathering messages...({i}/{total_row_number})", end="\r")
|
print(f"Processing messages...({i}/{total_row_number})", end="\r")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
@@ -396,7 +396,7 @@ def messages(db, data):
|
|||||||
if content is not None and isinstance(content["data"], bytes):
|
if content is not None and isinstance(content["data"], bytes):
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
print(f"Gathering messages...({total_row_number}/{total_row_number})", end="\r")
|
print(f"Processing messages...({total_row_number}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def media(db, data, media_folder):
|
def media(db, data, media_folder):
|
||||||
@@ -404,7 +404,7 @@ def media(db, data, media_folder):
|
|||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
c.execute("""SELECT count() FROM message_media""")
|
c.execute("""SELECT count() FROM message_media""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"\nGathering media...(0/{total_row_number})", end="\r")
|
print(f"\nProcessing media...(0/{total_row_number})", end="\r")
|
||||||
i = 0
|
i = 0
|
||||||
try:
|
try:
|
||||||
c.execute("""SELECT messages.key_remote_jid,
|
c.execute("""SELECT messages.key_remote_jid,
|
||||||
@@ -466,10 +466,10 @@ def media(db, data, media_folder):
|
|||||||
message.meta = True
|
message.meta = True
|
||||||
i += 1
|
i += 1
|
||||||
if i % 100 == 0:
|
if i % 100 == 0:
|
||||||
print(f"Gathering media...({i}/{total_row_number})", end="\r")
|
print(f"Processing media...({i}/{total_row_number})", end="\r")
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
print(
|
print(
|
||||||
f"Gathering media...({total_row_number}/{total_row_number})", end="\r")
|
f"Processing media...({total_row_number}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def vcard(db, data):
|
def vcard(db, data):
|
||||||
@@ -501,7 +501,7 @@ def vcard(db, data):
|
|||||||
|
|
||||||
rows = c.fetchall()
|
rows = c.fetchall()
|
||||||
total_row_number = len(rows)
|
total_row_number = len(rows)
|
||||||
print(f"\nGathering vCards...(0/{total_row_number})", end="\r")
|
print(f"\nProcessing vCards...(0/{total_row_number})", end="\r")
|
||||||
base = "WhatsApp/vCards"
|
base = "WhatsApp/vCards"
|
||||||
if not os.path.isdir(base):
|
if not os.path.isdir(base):
|
||||||
Path(base).mkdir(parents=True, exist_ok=True)
|
Path(base).mkdir(parents=True, exist_ok=True)
|
||||||
@@ -519,7 +519,7 @@ def vcard(db, data):
|
|||||||
f"however it should be located at {file_path}"
|
f"however it should be located at {file_path}"
|
||||||
message.mime = "text/x-vcard"
|
message.mime = "text/x-vcard"
|
||||||
message.meta = True
|
message.meta = True
|
||||||
print(f"Gathering vCards...({index + 1}/{total_row_number})", end="\r")
|
print(f"Processing vCards...({index + 1}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def create_html(
|
def create_html(
|
||||||
|
|||||||
@@ -84,6 +84,6 @@ def messages(path, data, assume_first_as_me=False):
|
|||||||
msg.data += "<br>" + line.strip()
|
msg.data += "<br>" + line.strip()
|
||||||
|
|
||||||
if index % 1000 == 0:
|
if index % 1000 == 0:
|
||||||
print(f"Gathering messages & media...({index}/{total_row_number})", end="\r")
|
print(f"Processing messages & media...({index}/{total_row_number})", end="\r")
|
||||||
print(f"Gathering messages & media...({total_row_number}/{total_row_number})", end="\r")
|
print(f"Processing messages & media...({total_row_number}/{total_row_number})", end="\r")
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def messages(db, data):
|
|||||||
# Get contacts
|
# Get contacts
|
||||||
c.execute("""SELECT count() FROM ZWACHATSESSION""")
|
c.execute("""SELECT count() FROM ZWACHATSESSION""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"Gathering contacts...({total_row_number})")
|
print(f"Processing contacts...({total_row_number})")
|
||||||
|
|
||||||
c.execute("""SELECT ZCONTACTJID, ZPARTNERNAME FROM ZWACHATSESSION; """)
|
c.execute("""SELECT ZCONTACTJID, ZPARTNERNAME FROM ZWACHATSESSION; """)
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
@@ -27,7 +27,7 @@ def messages(db, data):
|
|||||||
# Get message history
|
# Get message history
|
||||||
c.execute("""SELECT count() FROM ZWAMESSAGE""")
|
c.execute("""SELECT count() FROM ZWAMESSAGE""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"Gathering messages...(0/{total_row_number})", end="\r")
|
print(f"Processing messages...(0/{total_row_number})", end="\r")
|
||||||
|
|
||||||
c.execute("""SELECT COALESCE(ZFROMJID, ZTOJID) as _id,
|
c.execute("""SELECT COALESCE(ZFROMJID, ZTOJID) as _id,
|
||||||
ZWAMESSAGE.Z_PK,
|
ZWAMESSAGE.Z_PK,
|
||||||
@@ -124,10 +124,10 @@ def messages(db, data):
|
|||||||
data[_id].add_message(Z_PK, message)
|
data[_id].add_message(Z_PK, message)
|
||||||
i += 1
|
i += 1
|
||||||
if i % 1000 == 0:
|
if i % 1000 == 0:
|
||||||
print(f"Gathering messages...({i}/{total_row_number})", end="\r")
|
print(f"Processing messages...({i}/{total_row_number})", end="\r")
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
print(
|
print(
|
||||||
f"Gathering messages...({total_row_number}/{total_row_number})", end="\r")
|
f"Processing messages...({total_row_number}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def media(db, data, media_folder):
|
def media(db, data, media_folder):
|
||||||
@@ -135,7 +135,7 @@ def media(db, data, media_folder):
|
|||||||
# Get media
|
# Get media
|
||||||
c.execute("""SELECT count() FROM ZWAMEDIAITEM""")
|
c.execute("""SELECT count() FROM ZWAMEDIAITEM""")
|
||||||
total_row_number = c.fetchone()[0]
|
total_row_number = c.fetchone()[0]
|
||||||
print(f"\nGathering media...(0/{total_row_number})", end="\r")
|
print(f"\nProcessing media...(0/{total_row_number})", end="\r")
|
||||||
i = 0
|
i = 0
|
||||||
c.execute("""SELECT COALESCE(ZWAMESSAGE.ZFROMJID, ZWAMESSAGE.ZTOJID) as _id,
|
c.execute("""SELECT COALESCE(ZWAMESSAGE.ZFROMJID, ZWAMESSAGE.ZTOJID) as _id,
|
||||||
ZMESSAGE,
|
ZMESSAGE,
|
||||||
@@ -185,10 +185,10 @@ def media(db, data, media_folder):
|
|||||||
message.caption = content["ZTITLE"]
|
message.caption = content["ZTITLE"]
|
||||||
i += 1
|
i += 1
|
||||||
if i % 100 == 0:
|
if i % 100 == 0:
|
||||||
print(f"Gathering media...({i}/{total_row_number})", end="\r")
|
print(f"Processing media...({i}/{total_row_number})", end="\r")
|
||||||
content = c.fetchone()
|
content = c.fetchone()
|
||||||
print(
|
print(
|
||||||
f"Gathering media...({total_row_number}/{total_row_number})", end="\r")
|
f"Processing media...({total_row_number}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def vcard(db, data):
|
def vcard(db, data):
|
||||||
@@ -206,7 +206,7 @@ def vcard(db, data):
|
|||||||
ON ZWAMEDIAITEM.ZMESSAGE = ZWAMESSAGE.Z_PK""")
|
ON ZWAMEDIAITEM.ZMESSAGE = ZWAMESSAGE.Z_PK""")
|
||||||
contents = c.fetchall()
|
contents = c.fetchall()
|
||||||
total_row_number = len(contents)
|
total_row_number = len(contents)
|
||||||
print(f"\nGathering vCards...(0/{total_row_number})", end="\r")
|
print(f"\nProcessing vCards...(0/{total_row_number})", end="\r")
|
||||||
base = "Message/vCards"
|
base = "Message/vCards"
|
||||||
if not os.path.isdir(base):
|
if not os.path.isdir(base):
|
||||||
Path(base).mkdir(parents=True, exist_ok=True)
|
Path(base).mkdir(parents=True, exist_ok=True)
|
||||||
@@ -224,7 +224,7 @@ def vcard(db, data):
|
|||||||
message.mime = "text/x-vcard"
|
message.mime = "text/x-vcard"
|
||||||
message.media = True
|
message.media = True
|
||||||
message.meta = True
|
message.meta = True
|
||||||
print(f"Gathering vCards...({index + 1}/{total_row_number})", end="\r")
|
print(f"Processing vCards...({index + 1}/{total_row_number})", end="\r")
|
||||||
|
|
||||||
|
|
||||||
def create_html(
|
def create_html(
|
||||||
|
|||||||
Reference in New Issue
Block a user