2022-08-06 13:00:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Group statuses by acct and timelines dirs
|
|
|
|
|
|
|
|
json=$(cat)
|
|
|
|
|
2022-08-07 10:11:44 +00:00
|
|
|
mkdir -p "$main_basedir/archives/"
|
|
|
|
unixtime_offset=$(expr $(date "+%s") - 86400)
|
|
|
|
|
2022-08-06 13:00:46 +00:00
|
|
|
for i in $ids; do
|
|
|
|
status_id=$i
|
|
|
|
acct=$(echo "$json" | jj "#[id=$i].account.acct")
|
|
|
|
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
2022-08-07 10:11:44 +00:00
|
|
|
old_check=$(date +'%s' -r "$main_basedir"/all_statuses/$instance/$i/$i.json)
|
|
|
|
if [ $old_check -lt $unixtime_offset ]; then
|
|
|
|
7z a -sdel "$main_basedir"/archives/$instance.7z "$main_basedir"/all_statuses/$instance/$i
|
|
|
|
echo "Olded status $i $(date -d "@$old_check") moved to archive"
|
|
|
|
ids=$(echo "$ids" | sed -E "s/.?$i.?//g")
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2022-08-06 13:00:46 +00:00
|
|
|
if [ -n "$status_id" ]; then
|
2022-08-07 05:05:50 +00:00
|
|
|
ln -v -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
2022-08-06 13:00:46 +00:00
|
|
|
|
2022-08-07 05:05:50 +00:00
|
|
|
ln -v -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/timelines/$instance/$timeline/$status_id
|
2022-08-06 13:00:46 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|