Compare commits

...

2 commits

2 changed files with 43 additions and 55 deletions

View file

@ -5,6 +5,7 @@
"default_visibility": "unlisted", "default_visibility": "unlisted",
"format_time": "+%d.%m.%Y %H:%M:%S", "format_time": "+%d.%m.%Y %H:%M:%S",
"boost_symbol": "[>>]", "boost_symbol": "[>>]",
"reversed_statuses": false,
"public_list_instances": [ "public_list_instances": [
"outerheaven.club", "outerheaven.club",
"stereophonic.space", "stereophonic.space",

View file

@ -10,6 +10,7 @@ default_visibility=$(jj -i config.json default_visibility)
default_content_type=$(jj -i config.json default_content_type) default_content_type=$(jj -i config.json default_content_type)
format_time=$(jj -i config.json format_time) format_time=$(jj -i config.json format_time)
boost_symbol=$(jj -i config.json boost_symbol) boost_symbol=$(jj -i config.json boost_symbol)
reversed_statuses=$(jj -i config.json reversed_statuses)
#[AUTH SECTION] #[AUTH SECTION]
mkdir -m 711 -p .app_sessions mkdir -m 711 -p .app_sessions
@ -303,6 +304,39 @@ statuses_api_account()
default_curl_opt "accounts/$1/statuses?limit=$max_statuses" default_curl_opt "accounts/$1/statuses?limit=$max_statuses"
} }
statuses_render()
{
if [ "$reversed_statuses" = 'true' ]; then
ids_massive=$(echo $ids_massive | tr ' ' '\n' | tac | tr '\n' ' ')
fi
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 +350,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 +371,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 +387,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)
@ -446,7 +434,6 @@ timeline_menu()
sub_menu_lvl=0 ;; sub_menu_lvl=0 ;;
esac esac
done done
} }
share_api_status() share_api_status()