Added: get livechat link

This commit is contained in:
localhost_frssoft 2022-05-07 00:26:17 +03:00
parent 1efe93c629
commit 5d08d15249
1 changed files with 20 additions and 1 deletions

View File

@ -59,6 +59,24 @@ peertube_api_get_live_streams()
default_curl_opt "$instance_point/videos?count=100&start=$1&isLive=true&sort=-publishedAt" | jj -p | tee preload >> /dev/null
}
peertube_api_get_livechat()
{
versions_plugin_livechat='5.3.0 5.4.0 5.5.0 5.6.0 5.7.0'
for version_chat in $versions_plugin_livechat; do
link_on_chat="https://$instance/plugins/livechat/$version_chat/router/webchat/room/$1"
curl -s --head $link_on_chat | grep "HTTP\/. 200"
if [ $? -eq 0 ]; then
echo "$link_on_chat"
chat_found=1
break
fi
done
if [ -z $chat_found ]; then
echo 'Chat not avalaible'
fi
}
peertube_api_get_video()
{
default_curl_opt "$instance_point/videos/$1"
@ -184,7 +202,7 @@ peertube_menu_stream()
echo '_____'
fulldescr="\nFull description"
fi
menu_video_choice=$(echo "Play\nWait mode$fulldescr\nShare\nBack\nMain menu" | fzy)
menu_video_choice=$(echo "Play\nWait mode$fulldescr\nShare\nLive chat\nBack\nMain menu" | fzy)
case $menu_video_choice in
"Main menu") sub2_menu=0 && sub_menu=0 ;;
"Back") sub2_menu=0 ;;
@ -215,6 +233,7 @@ peertube_menu_stream()
"Share")
echo "Link: https://$instance/w/$1"
echo "Direct link: $playlist_stream" ;;
"Live chat") peertube_api_get_livechat "$(echo "$get_video" | jj uuid)" ;;
esac
done
}