chatty-import-sms-mms/save_files

14 lines
503 B
Text
Raw Normal View History

2022-03-14 19:46:55 +01:00
#!/bin/bash
set -euo pipefail
database="$1"
# Saving binary files only
# .smil parts are ignored (not used by Chatty)
# Plain text attachments will be converted into message bodies
# cf. chatty:src/mm/chatty-mmsd.c:chatty_mmsd_process_mms_message_attachments
while read path; do
mkdir -p "$(dirname "$path")"
sqlite3 "$database" "select binary_data from part where savepath='$path';" | base64 -d >"$path"
done <<<"$(sqlite3 "$database" "select savepath from part where binary_data is not null;")"