mirror of
http://gitea.phreedom.club/localhost_frssoft/pleroma-cli
synced 2024-11-22 08:11:28 +00:00
Render statuses refactor and improvments
This commit is contained in:
parent
7083310a41
commit
d7b08f768e
|
@ -303,6 +303,36 @@ statuses_api_account()
|
|||
default_curl_opt "accounts/$1/statuses?limit=$max_statuses"
|
||||
}
|
||||
|
||||
statuses_render()
|
||||
{
|
||||
for i in $ids_massive; do
|
||||
status=$(echo "$jsonmassive" | jj "#[id=$i]")
|
||||
reblog=$(echo $status | jj reblog.id)
|
||||
uri=$(echo $status | jj uri)
|
||||
id_status=$(echo $status | jj id)
|
||||
dateutc=$(echo $status | jj created_at)
|
||||
reply_to_id=$(echo $status | jj in_reply_to_id)
|
||||
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
|
||||
if [ -n "$reply_to_id" ]; then
|
||||
echo "Reply to: $reply_to_id"
|
||||
fi
|
||||
if [ -n "$reblog" ]; then
|
||||
echo "$boost_symbol $reblog"
|
||||
fi
|
||||
spoiler_text=$(echo "$status" | jj spoiler_text)
|
||||
if [ -n "$spoiler_text" ]; then
|
||||
echo "#[$spoiler_text]"
|
||||
fi
|
||||
echo "$status" | jj -r content | delqse | html_to_txt_render
|
||||
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
|
||||
if [ -n "$attachments" ]; then
|
||||
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
||||
echo "$attachments" >> attachments.m3u8
|
||||
fi
|
||||
echo '=========='
|
||||
done
|
||||
}
|
||||
|
||||
thread_menu()
|
||||
{
|
||||
sub_menu_lvl=2
|
||||
|
@ -316,34 +346,15 @@ thread_menu()
|
|||
else
|
||||
jsonthread="$descendants"
|
||||
fi
|
||||
indexator=$(expr $(echo $jsonthread | jj \#) - 1)
|
||||
counter=0
|
||||
while [ $sub_menu_lvl -eq 2 ]; do
|
||||
clear
|
||||
echo '[Thread]'
|
||||
while [ ! $indexator -eq $counter ]; do
|
||||
status=$(echo $jsonthread | jj $counter)
|
||||
uri=$(echo $status | jj uri)
|
||||
id_status=$(echo $status | jj id)
|
||||
dateutc=$(echo $status | jj created_at)
|
||||
reply_to_id=$(echo $status | jj in_reply_to_id)
|
||||
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
|
||||
if [ -n "$reply_to_id" ]; then
|
||||
echo "Reply to: $reply_to_id"
|
||||
fi
|
||||
echo "$status" | jj -r content | delqse | html_to_txt_render
|
||||
attachments=$(echo $status | jj -l media_attachments.#.remote_url | delq)
|
||||
if [ -n "$attachments" ]; then
|
||||
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
||||
echo "$attachments" >> attachments.m3u8
|
||||
fi
|
||||
counter=$(expr $counter + 1)
|
||||
echo '_____'
|
||||
done
|
||||
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
|
||||
jsonmassive=$jsonthread
|
||||
statuses_render
|
||||
menuthread=$(echo 'Back' | fzy)
|
||||
case "$menuthread" in
|
||||
"Back")
|
||||
sub_menu_lvl=1 ;;
|
||||
"Back") sub_menu_lvl=1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -356,38 +367,12 @@ timeline_api()
|
|||
timeline_menu()
|
||||
{
|
||||
json=$(timeline_api)
|
||||
indexator=$(expr $max_statuses - 1)
|
||||
sub_menu_lvl=1
|
||||
echo '#EXTM3U' > attachments.m3u8
|
||||
while [ $sub_menu_lvl -eq 1 ]; do
|
||||
|
||||
while [ $indexator -gt 0 ]; do
|
||||
status=$(echo "$json" | jj $indexator)
|
||||
reblog=$(echo $status | jj reblog)
|
||||
uri=$(echo $status | jj uri)
|
||||
id_status=$(echo $status | jj id)
|
||||
dateutc=$(echo $status | jj created_at)
|
||||
reply_to_id=$(echo $status | jj in_reply_to_id)
|
||||
echo "$(date -d $dateutc "$format_time") <$id_status> $uri"
|
||||
if [ -n "$reply_to_id" ]; then
|
||||
echo "Reply to: $reply_to_id"
|
||||
fi
|
||||
if [ -n "$reblog" ]; then
|
||||
echo "$boost_symbol"
|
||||
fi
|
||||
spoiler_text=$(echo "$status" | jj spoiler_text)
|
||||
if [ -n "$spoiler_text" ]; then
|
||||
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')
|
||||
if [ -n "$attachments" ]; then
|
||||
echo "#EXTINF:-1, $uri" >> attachments.m3u8
|
||||
echo "$attachments" >> attachments.m3u8
|
||||
fi
|
||||
indexator=$(expr $indexator - 1)
|
||||
echo '_____'
|
||||
done
|
||||
ids_massive=$(echo $json | jj -l \#.id | delq)
|
||||
jsonmassive=$json
|
||||
statuses_render
|
||||
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy)
|
||||
case $menu in
|
||||
"Prev")
|
||||
|
@ -398,7 +383,6 @@ timeline_menu()
|
|||
json=$(timeline_api $offset)
|
||||
;;
|
||||
"Next")
|
||||
indexator=$(expr $max_statuses - 1)
|
||||
echo '#EXTM3U' > attachments.m3u8
|
||||
clear
|
||||
offset=$(jj -i preload 0.id)
|
||||
|
@ -445,8 +429,7 @@ timeline_menu()
|
|||
"Main menu")
|
||||
sub_menu_lvl=0 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
share_api_status()
|
||||
|
|
Loading…
Reference in a new issue