diff --git a/libpurple_to_markdown/__init__.py b/libpurple_to_markdown/__init__.py index 968cd6c..8e65bc7 100644 --- a/libpurple_to_markdown/__init__.py +++ b/libpurple_to_markdown/__init__.py @@ -1,11 +1,22 @@ -"""Libpurple to markdown conversion script. +"""# Markdown Message Conversion. -Conversion script for HTML-based logs from [Pidgin/Libpurple](https://pidgin.im/) chat program. +Conversion script from various messaging formats to markdown. -**This is an one-off script, and is not actively maintained.** +Supported input formats: + +- [Pidgin/Libpurple](https://pidgin.im/) chat program HTML-based logs. **This + backend is not actively maintained.** +- [SyncTech Backup & Restore](https://www.synctech.com.au/sms-backup-restore/) + XML-based backup format. ## Motivation +Messaging applications are mostly good at sending real-time messages to other +people, but they generally do not possess any useful archival features. Most +messages are write-once read-once, and the apps where built for this use case. +More and more through, I am attracted to the prospect of archival; of +understanding who I am and who I _were_ when I wrote those messages. + I recently discovered [Obsidian](https://obsidian.md) and liked the prospect of cross-referencing my notes with my old chat logs. Libpurple uses HTML logs if you haven't configured it to something else (which I haden't). @@ -22,7 +33,7 @@ python -m libpurple_to_markdown LOG_DIRECTORY --output OUTPUT_FOLDER ``` It was made specifically for import into Obsidian, so it might not suite your -purposes, but it shouldn't be too difficult to adjust. +purposes, but it shouldn't be too difficult to adjust the formatting code. """ import dataclasses diff --git a/libpurple_to_markdown/libpurple.py b/libpurple_to_markdown/libpurple.py index 37ed6d7..02403c0 100644 --- a/libpurple_to_markdown/libpurple.py +++ b/libpurple_to_markdown/libpurple.py @@ -1,3 +1,12 @@ +"""Backend for Pidgin/LibPurple. + +[Pidgin](https://pidgin.im/) is a multi-protocol instant messaging app. It +stores logs as either plain text files, or as HTML files (default). + +This backend parses the HTML files, focusing on the IRC protocol-style logs. + +**This backend is not actively maintained.** +""" import datetime import logging from pathlib import Path diff --git a/libpurple_to_markdown/synctech_sms.py b/libpurple_to_markdown/synctech_sms.py new file mode 100644 index 0000000..4b949a1 --- /dev/null +++ b/libpurple_to_markdown/synctech_sms.py @@ -0,0 +1,28 @@ +"""Backend for SyncTech Backup & Restore. + +[SyncTech Backup & Restore](https://www.synctech.com.au/sms-backup-restore/) +for Android is a free app for backing up your SMS and MMS messages. It uses an +XML format as backup format, which this backend reads and converts to the +standardized Message format. +""" +import datetime +import logging +from pathlib import Path + +import bs4 + +from .data import Message + +logger = logging.getLogger(__name__) + + + +def parse_messages_in_backup_xml_file(path: Path) -> list[Message]: + logger.info('Parsing %s', path) + + with open(path) as f: + soup = bs4.BeautifulSoup(f, 'lxml-xml') + + # TODO: Implement message parsing + + return []