some fixes and improvments

This commit is contained in:
localhost_frssoft 2022-04-14 18:42:47 +03:00
parent 3cdfdf4cf7
commit 828b5ac291

View file

@ -151,14 +151,14 @@ follow_api_export()
echo "$acc_following_count followings exported" echo "$acc_following_count followings exported"
elif [ $count -lt 40 ]; then elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1) countindex=$(expr $count - 1)
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv echo $followings | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id) offset=$(echo $followings | jj $countindex.id)
echo "+$count follows" echo "+$count follows"
count=0 count=0
echo "$acc_following_count followings exported" echo "$acc_following_count followings exported"
elif [ $count -gt 0 ]; then elif [ $count -gt 0 ]; then
countindex=$(expr $count - 1) countindex=$(expr $count - 1)
echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv echo $followings | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/friends.csv
offset=$(echo $followings | jj $countindex.id) offset=$(echo $followings | jj $countindex.id)
echo "+$count follows" echo "+$count follows"
fi fi
@ -177,13 +177,13 @@ blocks_api_export()
echo "Blocks exported" echo "Blocks exported"
elif [ $count -lt 40 ]; then elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1) countindex=$(expr $count - 1)
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv echo $blocks | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id) offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks" echo "+$count blocks"
count=0 count=0
echo "Blocks exported" echo "Blocks exported"
elif [ $count -gt 0 ]; then elif [ $count -gt 0 ]; then
echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv echo $blocks | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/blocks.csv
offset=$(echo $blocks | jj $countindex.id) offset=$(echo $blocks | jj $countindex.id)
echo "+$count blocks" echo "+$count blocks"
fi fi
@ -202,13 +202,13 @@ mutes_api_export()
echo "Mutes exported" echo "Mutes exported"
elif [ $count -lt 40 ]; then elif [ $count -lt 40 ]; then
countindex=$(expr $count - 1) countindex=$(expr $count - 1)
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv echo $mutes | jj -l \#.acct | delq | legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id) offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes" echo "+$count mutes"
count=0 count=0
echo "Mutes exported" echo "Mutes exported"
elif [ $count -gt 0 ]; then elif [ $count -gt 0 ]; then
echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv echo $mutes | jj -l \#.acct | delq| legacy_addr_preprocess >> backups_$instance/mutes.csv
offset=$(echo $mutes | jj $countindex.id) offset=$(echo $mutes | jj $countindex.id)
echo "+$count mutes" echo "+$count mutes"
fi fi
@ -260,6 +260,21 @@ thread_api_statuses()
default_curl_opt "$instance_point/statuses/$1/context" default_curl_opt "$instance_point/statuses/$1/context"
} }
html_to_txt_render()
{
sed -e "s/<br[^>]*>/\n/g ; s/<p[^>]*>/\n/g ; s/<[^>]*>//g ; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
}
delq()
{
sed 's/"//g'
}
delqse()
{
sed 's/^"//g; s/"$//g'
}
thread_menu() thread_menu()
{ {
sub_menu_lvl=2 sub_menu_lvl=2
@ -288,10 +303,8 @@ thread_menu()
if [ -n "$reply_to_id" ]; then if [ -n "$reply_to_id" ]; then
echo "Reply to: $reply_to_id" echo "Reply to: $reply_to_id"
fi fi
echo $status | jj content | sed -e "s/<br[^>]*>/\n/g echo "$status" | jj -r content | delqse | html_to_txt_render
; s/<p[^>]*>/\n/g ; s/<[^>]*>//g attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g"
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
if [ -n "$attachments" ]; then if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8 echo "#EXTINF:-1, $uri" >> attachments.m3u8
echo "$attachments" >> attachments.m3u8 echo "$attachments" >> attachments.m3u8
@ -321,7 +334,7 @@ timeline_menu()
while [ $sub_menu_lvl -eq 1 ]; do while [ $sub_menu_lvl -eq 1 ]; do
while [ $indexator -gt 0 ]; do while [ $indexator -gt 0 ]; do
status=$(echo $json | jj $indexator) status=$(echo "$json" | jj $indexator)
reblog=$(echo $status | jj reblog) reblog=$(echo $status | jj reblog)
uri=$(echo $status | jj uri) uri=$(echo $status | jj uri)
id_status=$(echo $status | jj id) id_status=$(echo $status | jj id)
@ -334,9 +347,11 @@ timeline_menu()
if [ -n "$reblog" ]; then if [ -n "$reblog" ]; then
echo "$boost_symbol" echo "$boost_symbol"
fi fi
echo $status | jj content | sed -e "s/<br[^>]*>/\n/g spoiler_text=$(echo "$status" | jj spoiler_text)
; s/<p[^>]*>/\n/g ; s/<[^>]*>//g if [ -n "$spoiler_text" ]; then
; s/&gt;*/>/g ; s/&lt;*/</g ; s/&quot;/\"/g ; s/&#39;/'/g" echo "#[$spoiler_text]"
fi
echo "$status" | jj -r content | delqse | html_to_txt_render
attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g') attachments=$(echo $status | jj -l media_attachments.#.remote_url | sed 's/"//g')
if [ -n "$attachments" ]; then if [ -n "$attachments" ]; then
echo "#EXTINF:-1, $uri" >> attachments.m3u8 echo "#EXTINF:-1, $uri" >> attachments.m3u8