Compare commits

...

4 Commits

1 changed files with 50 additions and 4 deletions

View File

@ -17,6 +17,15 @@ torrent_init()
fi fi
} }
check_connect()
{
if [ -n "$(curl --head -s $instance_point/config | grep 'HTTP\/. 200')" ]; then
echo 'OK'
else
echo
fi
}
peertube_api_check_ratelimit() peertube_api_check_ratelimit()
{ {
curl -s --head "$instance_point/" | grep rate curl -s --head "$instance_point/" | grep rate
@ -51,6 +60,11 @@ peertube_api_get_video()
curl -s --compressed "$instance_point/videos/$1" curl -s --compressed "$instance_point/videos/$1"
} }
peertube_api_get_fulldescription()
{
curl -s --compressed "$instance_point/videos/$1/description" | jj description
}
peertube_menu_videos() peertube_menu_videos()
{ {
echo "Avalaible $(jj -i preload total) videos" echo "Avalaible $(jj -i preload total) videos"
@ -89,6 +103,10 @@ peertube_menu_video()
name=$(echo $get_video | jj name) name=$(echo $get_video | jj name)
desc=$(echo $get_video | jj description) desc=$(echo $get_video | jj description)
channel=$(echo $get_video | jj channel.name) channel=$(echo $get_video | jj channel.name)
support_author=$(echo $get_video | jj support)
if [ -n "$support_author" ]; then
echo "Support/Donate: $support_author"
fi
check_hls_empty=$(echo $get_video | jj streamingPlaylists.0) check_hls_empty=$(echo $get_video | jj streamingPlaylists.0)
if [ -z $check_hls_empty ]; then if [ -z $check_hls_empty ]; then
hls='' hls=''
@ -98,8 +116,13 @@ peertube_menu_video()
video_url=$(echo $get_video | jj "$hls"files.#[resolution.id=$pref_video_quality].fileUrl) video_url=$(echo $get_video | jj "$hls"files.#[resolution.id=$pref_video_quality].fileUrl)
torrent_url=$(echo $get_video | jj "$hls"files.#[resolution.id=$pref_video_quality].torrentUrl) torrent_url=$(echo $get_video | jj "$hls"files.#[resolution.id=$pref_video_quality].torrentUrl)
echo "Channel: $channel" echo "Channel: $channel"
echo "Description video:\n$desc" fulldescr=
menu_video_choice=$(echo "Play\nBack\nMain menu" | fzy) if [ -n "$desc" ]; then
echo "Description video:\n$desc"
echo '_____'
fulldescr="\nFull description"
fi
menu_video_choice=$(echo "Play$fulldescr\nBack\nMain menu" | fzy)
case $menu_video_choice in case $menu_video_choice in
"Main menu") sub2_menu=0 && sub_menu=0 ;; "Main menu") sub2_menu=0 && sub_menu=0 ;;
"Back") sub2_menu=0 ;; "Back") sub2_menu=0 ;;
@ -119,6 +142,9 @@ peertube_menu_video()
else else
curl -s --tcp-fastopen --output - $video_url | $default_player_command - curl -s --tcp-fastopen --output - $video_url | $default_player_command -
fi ;; fi ;;
"Full description")
fulldesc=$(peertube_api_get_fulldescription $1)
echo "$fulldesc" | less -e ;;
esac esac
done done
} }
@ -132,13 +158,22 @@ peertube_menu_stream()
name=$(echo $get_video | jj name) name=$(echo $get_video | jj name)
desc=$(echo $get_video | jj description) desc=$(echo $get_video | jj description)
channel=$(echo $get_video | jj channel.name) channel=$(echo $get_video | jj channel.name)
support_author=$(echo $get_video | jj support)
if [ -n "$support_author" ]; then
echo "Support/Donate: $support_author"
fi
playlist_stream=$(echo $get_video | jj streamingPlaylists.0.playlistUrl) playlist_stream=$(echo $get_video | jj streamingPlaylists.0.playlistUrl)
state=$(echo $get_video | jj state.label) state=$(echo $get_video | jj state.label)
echo "Status: $state" echo "Status: $state"
#torrent_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].torrentUrl) #torrent_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].torrentUrl)
echo "Channel: $channel" echo "Channel: $channel"
echo "Description video:\n$desc" fulldescr=
menu_video_choice=$(echo "Play\nWait mode\nBack\nMain menu" | fzy) if [ -n "$desc" ]; then
echo "Description stream:\n$desc"
echo '_____'
fulldescr="\nFull description"
fi
menu_video_choice=$(echo "Play\nWait mode$fulldescr\nBack\nMain menu" | fzy)
case $menu_video_choice in case $menu_video_choice in
"Main menu") sub2_menu=0 && sub_menu=0 ;; "Main menu") sub2_menu=0 && sub_menu=0 ;;
"Back") sub2_menu=0 ;; "Back") sub2_menu=0 ;;
@ -162,6 +197,9 @@ peertube_menu_stream()
echo 'Stream PUBLISHED!' echo 'Stream PUBLISHED!'
$default_player_command $playlist_stream $default_player_command $playlist_stream
;; ;;
"Full description")
fulldesc=$(peertube_api_get_fulldescription $1)
echo "$fulldesc" | less -e ;;
esac esac
done done
} }
@ -197,6 +235,10 @@ menu_settings()
done done
} }
if [ -z $(check_connect) ]; then
echo 'Connect error...'
echo 'Please retry later or switch instance'
fi
version=$(peertube_api_version_server) version=$(peertube_api_version_server)
torrent_init torrent_init
videosmenu='All Videos' videosmenu='All Videos'
@ -244,6 +286,10 @@ while true; do
cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null
export instance export instance
export instance_point="https://$instance/api/v1" export instance_point="https://$instance/api/v1"
if [ -z $(check_connect) ]; then
echo 'Connect error...'
echo 'Please retry later or switch instance'
fi
export version=$(peertube_api_version_server) export version=$(peertube_api_version_server)
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy) conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
if [ "$conf_instance_state" = 'Permanent' ]; then if [ "$conf_instance_state" = 'Permanent' ]; then