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"
|
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()
|
thread_menu()
|
||||||
{
|
{
|
||||||
sub_menu_lvl=2
|
sub_menu_lvl=2
|
||||||
|
@ -316,34 +346,15 @@ thread_menu()
|
||||||
else
|
else
|
||||||
jsonthread="$descendants"
|
jsonthread="$descendants"
|
||||||
fi
|
fi
|
||||||
indexator=$(expr $(echo $jsonthread | jj \#) - 1)
|
|
||||||
counter=0
|
|
||||||
while [ $sub_menu_lvl -eq 2 ]; do
|
while [ $sub_menu_lvl -eq 2 ]; do
|
||||||
clear
|
clear
|
||||||
echo '[Thread]'
|
echo '[Thread]'
|
||||||
while [ ! $indexator -eq $counter ]; do
|
ids_massive=$(echo $jsonthread | jj -l \#.id | delq)
|
||||||
status=$(echo $jsonthread | jj $counter)
|
jsonmassive=$jsonthread
|
||||||
uri=$(echo $status | jj uri)
|
statuses_render
|
||||||
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
|
|
||||||
menuthread=$(echo 'Back' | fzy)
|
menuthread=$(echo 'Back' | fzy)
|
||||||
case "$menuthread" in
|
case "$menuthread" in
|
||||||
"Back")
|
"Back") sub_menu_lvl=1 ;;
|
||||||
sub_menu_lvl=1 ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -356,38 +367,12 @@ timeline_api()
|
||||||
timeline_menu()
|
timeline_menu()
|
||||||
{
|
{
|
||||||
json=$(timeline_api)
|
json=$(timeline_api)
|
||||||
indexator=$(expr $max_statuses - 1)
|
|
||||||
sub_menu_lvl=1
|
sub_menu_lvl=1
|
||||||
echo '#EXTM3U' > attachments.m3u8
|
echo '#EXTM3U' > attachments.m3u8
|
||||||
while [ $sub_menu_lvl -eq 1 ]; do
|
while [ $sub_menu_lvl -eq 1 ]; do
|
||||||
|
ids_massive=$(echo $json | jj -l \#.id | delq)
|
||||||
while [ $indexator -gt 0 ]; do
|
jsonmassive=$json
|
||||||
status=$(echo "$json" | jj $indexator)
|
statuses_render
|
||||||
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
|
|
||||||
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy)
|
menu=$(echo 'Prev\nNext\nReply\nShare\nFavorite\nThread\nMain menu' | fzy)
|
||||||
case $menu in
|
case $menu in
|
||||||
"Prev")
|
"Prev")
|
||||||
|
@ -398,7 +383,6 @@ timeline_menu()
|
||||||
json=$(timeline_api $offset)
|
json=$(timeline_api $offset)
|
||||||
;;
|
;;
|
||||||
"Next")
|
"Next")
|
||||||
indexator=$(expr $max_statuses - 1)
|
|
||||||
echo '#EXTM3U' > attachments.m3u8
|
echo '#EXTM3U' > attachments.m3u8
|
||||||
clear
|
clear
|
||||||
offset=$(jj -i preload 0.id)
|
offset=$(jj -i preload 0.id)
|
||||||
|
@ -445,8 +429,7 @@ timeline_menu()
|
||||||
"Main menu")
|
"Main menu")
|
||||||
sub_menu_lvl=0 ;;
|
sub_menu_lvl=0 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
share_api_status()
|
share_api_status()
|
||||||
|
|
Loading…
Reference in a new issue