mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-10-31 22:27:21 +00:00
27 lines
871 B
Bash
Executable file
27 lines
871 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# convert statuses as files and dirs
|
|
json="$(cat)"
|
|
ids=$(echo "$json" | jj -l '#.id' | sed 's/"//g')
|
|
|
|
mkdir -p "$main_basedir/all_statuses/$instance"
|
|
mkdir -p "$main_basedir/statuses/$instance"
|
|
mkdir -p "$main_basedir/timelines/$instance/$timeline"
|
|
|
|
for i in $ids; do
|
|
if [ -f "$main_basedir"/all_statuses/$instance/$i/$i.json ]; then
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
|
continue
|
|
elif [ -d "$main_basedir"/all_statuses/$instance/*/$i ]; then
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
|
continue
|
|
fi
|
|
status_date=$(echo "$json" | jj "#[id=$1].created_at")
|
|
mkdir -m 711 -p "$main_basedir"/all_statuses/$instance/$i
|
|
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$i
|
|
echo "$json" | jj -p "#[id=$i]" > "$main_basedir"/all_statuses/$instance/$i/$i.json
|
|
done
|
|
|
|
export ids
|
|
echo "$json" | "$main_basedir"/utils/extract_fields_statuses.sh
|