mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-09-20 17:48:58 +02:00
Add tqdm progress bar
This commit is contained in:
@@ -498,7 +498,8 @@ def _format_message_text(text):
|
|||||||
|
|
||||||
def _get_reactions(db, data):
|
def _get_reactions(db, data):
|
||||||
"""
|
"""
|
||||||
Process message reactions.
|
Process message reactions. Only new schema is supported.
|
||||||
|
Chat filter is not applied here at the moment. Maybe in the future.
|
||||||
"""
|
"""
|
||||||
c = db.cursor()
|
c = db.cursor()
|
||||||
|
|
||||||
@@ -531,8 +532,11 @@ def _get_reactions(db, data):
|
|||||||
logger.warning(f"Could not fetch reactions (schema might be too old or incompatible){CLEAR_LINE}")
|
logger.warning(f"Could not fetch reactions (schema might be too old or incompatible){CLEAR_LINE}")
|
||||||
return
|
return
|
||||||
|
|
||||||
row = c.fetchone()
|
rows = c.fetchall()
|
||||||
while row is not None:
|
total_row_number = len(rows)
|
||||||
|
|
||||||
|
with tqdm(total=total_row_number, desc="Processing reactions", unit="reaction", leave=False) as pbar:
|
||||||
|
for row in rows:
|
||||||
parent_id = row["parent_message_row_id"]
|
parent_id = row["parent_message_row_id"]
|
||||||
reaction = row["reaction"]
|
reaction = row["reaction"]
|
||||||
chat_id = row["chat_jid_raw"]
|
chat_id = row["chat_jid_raw"]
|
||||||
@@ -557,9 +561,9 @@ def _get_reactions(db, data):
|
|||||||
sender_name = "Unknown"
|
sender_name = "Unknown"
|
||||||
|
|
||||||
message.reactions[sender_name] = reaction
|
message.reactions[sender_name] = reaction
|
||||||
|
pbar.update(1)
|
||||||
row = c.fetchone()
|
total_time = pbar.format_dict['elapsed']
|
||||||
logger.info(f"Processed reactions{CLEAR_LINE}")
|
logger.info(f"Processed {total_row_number} reactions in {convert_time_unit(total_time)}{CLEAR_LINE}")
|
||||||
|
|
||||||
|
|
||||||
def media(db, data, media_folder, filter_date, filter_chat, filter_empty, separate_media=True, fix_dot_files=False):
|
def media(db, data, media_folder, filter_date, filter_chat, filter_empty, separate_media=True, fix_dot_files=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user