chatty-import-sms-mms/save_files
Gilles Filippini 3ad0fc9294 Initial import
2022-03-18 23:59:45 +01:00

13 lines
503 B
Bash
Executable file

#!/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;")"