2022-08-05 16:09:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Extract fields from statuses
|
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
json=$(cat)
|
|
|
|
|
|
|
|
for i in $ids; do
|
2022-08-05 16:09:45 +00:00
|
|
|
# Required fields
|
2022-08-05 19:30:48 +00:00
|
|
|
status_id=$(echo "$json" | jj "#[id=$i].id")
|
|
|
|
status_date=$(echo "$json" | jj "#[id=$i].created_at")
|
2022-08-05 16:09:45 +00:00
|
|
|
|
|
|
|
# Fields
|
2022-08-05 19:30:48 +00:00
|
|
|
content=$(echo "$json" | jj "#[id=$i].content" | "$main_basedir"/utils/html_to_txt_render)
|
|
|
|
status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v')
|
2022-08-06 08:42:39 +00:00
|
|
|
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.id")
|
2022-08-05 16:09:45 +00:00
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
chmod 711 "$main_basedir"/all_statuses/$instance/$status_id
|
2022-08-05 16:09:45 +00:00
|
|
|
|
|
|
|
if [ -n "$content" ]; then
|
2022-08-05 19:30:48 +00:00
|
|
|
echo "$content" > "$main_basedir"/all_statuses/$instance/$status_id/content
|
2022-08-05 16:09:45 +00:00
|
|
|
fi
|
|
|
|
if [ -n "$status_media_attachments" ]; then
|
2022-08-05 19:30:48 +00:00
|
|
|
echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8
|
2022-08-05 16:09:45 +00:00
|
|
|
fi
|
2022-08-06 08:42:39 +00:00
|
|
|
if [ -n "$reblog" ]; then
|
|
|
|
echo "$reblog" > "$main_basedir"/all_statuses/$instance/$status_id/reblog.id
|
|
|
|
fi
|
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
chmod 600 "$main_basedir"/all_statuses/$instance/$status_id/*
|
2022-08-06 09:32:31 +00:00
|
|
|
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id/*
|
2022-08-05 16:09:45 +00:00
|
|
|
done
|
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
export ids
|
2022-08-06 13:00:46 +00:00
|
|
|
echo "$json" | "$main_basedir"/utils/statuses2files_group.sh
|