2022-08-05 11:49:48 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# convert statuses as files and dirs
|
|
|
|
json="$(cat)"
|
|
|
|
ids=$(echo "$json" | jj -l '#.id' | sed 's/"//g')
|
2022-08-05 14:09:52 +00:00
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
mkdir -p "$main_basedir/all_statuses/$instance"
|
|
|
|
mkdir -p "$main_basedir/statuses/$instance"
|
2022-08-06 13:00:46 +00:00
|
|
|
mkdir -p "$main_basedir/timelines/$instance/$timeline"
|
2022-08-05 14:09:52 +00:00
|
|
|
|
2022-08-05 11:49:48 +00:00
|
|
|
for i in $ids; do
|
2022-08-05 19:30:48 +00:00
|
|
|
if [ -f "$main_basedir"/all_statuses/$instance/$i/$i.json ]; then
|
|
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
2022-08-05 16:09:45 +00:00
|
|
|
continue
|
2022-08-07 20:14:19 +00:00
|
|
|
elif [ -n "$(unzip -p $main_basedir/archives/$instance.zip "**/$i.json")" ]; then
|
2022-08-07 10:11:44 +00:00
|
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
|
|
|
continue
|
|
|
|
elif [ -d "$main_basedir"/all_statuses/$instance/$i ]; then
|
2022-08-05 19:30:48 +00:00
|
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
2022-08-05 11:49:48 +00:00
|
|
|
continue
|
|
|
|
fi
|
2022-08-05 21:41:28 +00:00
|
|
|
status_date=$(echo "$json" | jj "#[id=$1].created_at")
|
2022-08-05 19:30:48 +00:00
|
|
|
mkdir -m 711 -p "$main_basedir"/all_statuses/$instance/$i
|
2022-08-05 21:41:28 +00:00
|
|
|
touch -d "$status_date" "$main_basedir"/all_statuses/$instance/$i
|
2022-08-05 19:30:48 +00:00
|
|
|
echo "$json" | jj -p "#[id=$i]" > "$main_basedir"/all_statuses/$instance/$i/$i.json
|
2022-08-05 11:49:48 +00:00
|
|
|
done
|
2022-08-05 16:09:45 +00:00
|
|
|
|
2022-08-05 19:30:48 +00:00
|
|
|
export ids
|
|
|
|
echo "$json" | "$main_basedir"/utils/extract_fields_statuses.sh
|