Documentation and starting on SyncTech SMS Backup & Restore backend
This commit is contained in:
parent
91ca8d66d8
commit
c45726d666
|
@ -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
|
## 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
|
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
|
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).
|
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
|
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
|
import dataclasses
|
||||||
|
|
|
@ -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 datetime
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
28
libpurple_to_markdown/synctech_sms.py
Normal file
28
libpurple_to_markdown/synctech_sms.py
Normal file
|
@ -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 []
|
Loading…
Reference in New Issue
Block a user