pleroma-cli/utils/statuses2files.sh

22 lines
572 B
Bash
Raw Normal View History

#!/bin/sh
# convert statuses as files and dirs
json="$(cat)"
ids=$(echo "$json" | jj -l '#.id' | sed 's/"//g')
if [ ! -d "$main_basedir/statuses/$instance" ]; then
mkdir -p "$main_basedir/statuses/$instance"
fi
for i in $ids; do
2022-08-05 16:09:45 +00:00
if [ -f "$main_basedir"/statuses/$instance/$i/$i.json ]; then
continue
elif [ -d "$main_basedir"/statuses/$instance/*/$i ]; then
continue
fi
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$i
echo "$json" | jj -p "#[id=$i]" > "$main_basedir"/statuses/$instance/$i/$i.json
done
2022-08-05 16:09:45 +00:00
"$main_basedir"/utils/extract_fields_statuses.sh