mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-25 21:21:26 +00:00
Separate statuses by acct dirs added
This commit is contained in:
parent
39e7196839
commit
3a2efce6d0
29
utils/extract_fields_statuses.sh
Executable file
29
utils/extract_fields_statuses.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Extract fields from statuses
|
||||
if [ ! -f "$main_basedir"/statuses/$instance/*/*.json ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for i in "$main_basedir"/statuses/$instance/*/*.json; do
|
||||
# Required fields
|
||||
status_id=$(jj -i $i 'id')
|
||||
status_date=$(jj -i $i 'created_at')
|
||||
|
||||
# Fields
|
||||
content=$(jj -i $i content | "$main_basedir"/utils/html_to_txt_render)
|
||||
status_media_attachments=$(jj -i $i -l 'media_attachments.#.url' | tr -d '"\v')
|
||||
|
||||
chmod 711 "$main_basedir"/statuses/$instance/$status_id
|
||||
touch -d "$status_date" "$main_basedir"/statuses/$instance/$status_id
|
||||
|
||||
if [ -n "$content" ]; then
|
||||
echo "$content" > "$main_basedir"/statuses/$instance/$status_id/content
|
||||
fi
|
||||
if [ -n "$status_media_attachments" ]; then
|
||||
echo "$status_media_attachments" > "$main_basedir"/statuses/$instance/$status_id/media_attachments.m3u8
|
||||
fi
|
||||
chmod 600 "$main_basedir"/statuses/$instance/$status_id/*
|
||||
done
|
||||
|
||||
"$main_basedir"/utils/statuses2files_acct.sh
|
|
@ -9,11 +9,13 @@ if [ ! -d "$main_basedir/statuses/$instance" ]; then
|
|||
fi
|
||||
|
||||
for i in $ids; do
|
||||
if [ -f "$main_basedir"/statuses/$instance/$i.json ]; then
|
||||
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
|
||||
chmod 600 "$main_basedir"/statuses/$instance/$i/$i.json
|
||||
done
|
||||
|
||||
"$main_basedir"/utils/extract_fields_statuses.sh
|
||||
|
|
20
utils/statuses2files_acct.sh
Executable file
20
utils/statuses2files_acct.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Move statuses to acct dirs
|
||||
# [statuses]
|
||||
# |
|
||||
# |---[acct]
|
||||
# | |
|
||||
# | |--- [status_id]
|
||||
# | |--- ...
|
||||
# |...
|
||||
|
||||
for i in "$main_basedir"/statuses/$instance/*/*.json; do
|
||||
status_id=$(jj -i $i 'id')
|
||||
acct=$(jj -i $i 'account.acct')
|
||||
mkdir -m 711 -p "$main_basedir"/statuses/$instance/$acct
|
||||
if [ -n "$status_id" ]; then
|
||||
mv "$main_basedir"/statuses/$instance/$status_id "$main_basedir"/statuses/$instance/$acct
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in a new issue