mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-29 13:41:26 +00:00
Archiver moved; remove content from json; acct to status dir; changed render html to text - w3m
This commit is contained in:
parent
6accd4c39c
commit
190f164da2
|
@ -799,6 +799,7 @@ statuses_auto_update()
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
echo "Sleeping..."
|
echo "Sleeping..."
|
||||||
|
./utils/statuses_archiver.sh
|
||||||
sleep 30
|
sleep 30
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ for i in $ids; do
|
||||||
|
|
||||||
# Fields
|
# Fields
|
||||||
content=$(echo "$json" | jj "#[id=$i].content" | "$main_basedir"/utils/html_to_txt_render)
|
content=$(echo "$json" | jj "#[id=$i].content" | "$main_basedir"/utils/html_to_txt_render)
|
||||||
|
echo "$json" | jj -D "#[id=$i].content"
|
||||||
status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v')
|
status_media_attachments=$(echo "$json" | jj -l "#[id=$i].media_attachments.#.url" | tr -d '"\v')
|
||||||
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.id")
|
reblog=$(echo "$json" | jj -l "#[id=$i].reblog.id")
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/>*/>/g ; s/<*/</g ; s/"/\"/g ; s/'/'/g"
|
cat | w3m -T text/html -dump
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,12 @@
|
||||||
|
|
||||||
json=$(cat)
|
json=$(cat)
|
||||||
|
|
||||||
mkdir -p "$main_basedir/archives/"
|
|
||||||
unixtime_offset=$(expr $(date "+%s") - 86400)
|
|
||||||
|
|
||||||
for i in $ids; do
|
for i in $ids; do
|
||||||
status_id=$i
|
status_id=$i
|
||||||
acct=$(echo "$json" | jj "#[id=$i].account.acct")
|
acct=$(echo "$json" | jj "#[id=$i].account.acct")
|
||||||
|
echo $acct > "$main_basedir"/all_statuses/$instance/$i/acct
|
||||||
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
||||||
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
|
|
||||||
|
|
||||||
if [ -n "$status_id" ]; then
|
if [ -n "$status_id" ]; then
|
||||||
ln -v -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
ln -v -s -r "$main_basedir"/all_statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct/$status_id
|
||||||
|
|
13
utils/statuses_archiver.sh
Executable file
13
utils/statuses_archiver.sh
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
mkdir -p "$main_basedir/archives/"
|
||||||
|
unixtime_offset=$(expr $(date "+%s") - 86400)
|
||||||
|
|
||||||
|
for i in "$main_basedir"/all_statuses/$instance/*; do
|
||||||
|
|
||||||
|
old_check=$(date +'%s' -r "$i"/*.json)
|
||||||
|
if [ $old_check -lt $unixtime_offset ]; then
|
||||||
|
7z a -sdel "$main_basedir"/archives/$instance.7z $i
|
||||||
|
echo "[Archiver] Olded status $i $(date -d "@$old_check") moved to archive"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue