Pls check and make sure it works, it does for me (fingers crossed). I'm a hobbyist and still learning. I was only able to export one message with the original script.
What does this PR do?
Changes made:
Simplified remove_placeholders method:
Refactored the logic to use a more concise list comprehension for checking if any placeholder phrase exists in a message.
Enhanced error handling in get_user_text:
Introduced better exception handling with more informative print statements for cases where message splitting fails.
Refactored collate_messages method:
Replaced the while-loop-based message aggregation with a more intuitive for-loop, eliminating the need for pointer-style management (fp, sp).
Removed the redundant clean_text function, as its functionality was seamlessly integrated into the refactored collate method.
Optimized the logic to correctly collate multi-line WhatsApp messages and separate messages from different users. The refactored logic is simpler and more efficient.
Ensured that the last message in the conversation is captured, which was possibly missed in the previous implementation.
Removed the unnecessary import os.
Added JSON pretty-printing:
Modified the JSON dump method to include indentation, which improves the readability of the output file.
Improved readability:
Made several cosmetic changes to improve code readability and consistency, such as consistent spacing and indentation.
Rationale:
These changes ensure better performance, accuracy, and ease of understanding.
Enhanced error handling ensures that issues in processing are flagged with detailed information, aiding debugging.
Refactored logic in collate_messages reduces complexity and increases efficiency.
Feature/Issue validation/testing
Please describe the tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
[NA] Test A
Logs for Test A
[NA] Test B
Logs for Test B
TESTS: Script ran with my exports and it worked! :)
Before submitting
[YES] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
Pls check and make sure it works, it does for me (fingers crossed). I'm a hobbyist and still learning. I was only able to export one message with the original script.
What does this PR do?
Changes made:
Simplified
remove_placeholders
method:Enhanced error handling in
get_user_text
:Refactored
collate_messages
method:clean_text
function, as its functionality was seamlessly integrated into the refactored collate method.Removed the unnecessary
import os
.Added JSON pretty-printing:
Improved readability:
Rationale:
collate_messages
reduces complexity and increases efficiency.Feature/Issue validation/testing
Please describe the tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced. Please also list any relevant details for your test configuration.
[NA] Test A Logs for Test A
[NA] Test B Logs for Test B
TESTS: Script ran with my exports and it worked! :)
Before submitting
Thanks for contributing 🎉!