mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-10-31 22:27:21 +00:00
35 lines
1.1 KiB
Bash
Executable file
35 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Extract fields from statuses
|
|
|
|
json=$(cat)
|
|
|
|
for i in $ids; do
|
|
# Required fields
|
|
status_id=$(echo "$json" | jj "#[id=$i].id")
|
|
status_date=$(echo "$json" | jj "#[id=$i].created_at")
|
|
|
|
# Fields
|
|
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')
|
|
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.id")
|
|
|
|
chmod 711 "$main_basedir"/all_statuses/$instance/$status_id
|
|
|
|
if [ -n "$content" ]; then
|
|
echo "$content" > "$main_basedir"/all_statuses/$instance/$status_id/content
|
|
fi
|
|
if [ -n "$status_media_attachments" ]; then
|
|
echo "$status_media_attachments" > "$main_basedir"/all_statuses/$instance/$status_id/media_attachments.m3u8
|
|
fi
|
|
if [ -n "$reblog" ]; then
|
|
echo "$reblog" > "$main_basedir"/all_statuses/$instance/$status_id/reblog.id
|
|
fi
|
|
|
|
chmod 600 "$main_basedir"/all_statuses/$instance/$status_id/*
|
|
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$status_id/*
|
|
done
|
|
|
|
export ids
|
|
echo "$json" | "$main_basedir"/utils/statuses2files_group.sh
|