From 5d08d152498756a310b2feda06835094dff0545d Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sat, 7 May 2022 00:26:17 +0300 Subject: [PATCH] Added: get livechat link --- peertube-cli.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/peertube-cli.sh b/peertube-cli.sh index b7b43c9..dc71087 100755 --- a/peertube-cli.sh +++ b/peertube-cli.sh @@ -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 }