mirror of
http://gitea.phreedom.club/localhost_frssoft/peertube-cli
synced 2025-03-21 09:52:02 +00:00
Compare commits
4 commits
aff86e836d
...
6f44f2b493
Author | SHA1 | Date | |
---|---|---|---|
6f44f2b493 | |||
3b590001a9 | |||
2a31a63bbf | |||
00a2f0d6b3 |
1 changed files with 50 additions and 4 deletions
|
@ -17,6 +17,15 @@ torrent_init()
|
|||
fi
|
||||
}
|
||||
|
||||
check_connect()
|
||||
{
|
||||
if [ -n "$(curl --head -s $instance_point/config | grep 'HTTP\/. 200')" ]; then
|
||||
echo 'OK'
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
peertube_api_check_ratelimit()
|
||||
{
|
||||
curl -s --head "$instance_point/" | grep rate
|
||||
|
@ -51,6 +60,11 @@ peertube_api_get_video()
|
|||
curl -s --compressed "$instance_point/videos/$1"
|
||||
}
|
||||
|
||||
peertube_api_get_fulldescription()
|
||||
{
|
||||
curl -s --compressed "$instance_point/videos/$1/description" | jj description
|
||||
}
|
||||
|
||||
peertube_menu_videos()
|
||||
{
|
||||
echo "Avalaible $(jj -i preload total) videos"
|
||||
|
@ -89,6 +103,10 @@ peertube_menu_video()
|
|||
name=$(echo $get_video | jj name)
|
||||
desc=$(echo $get_video | jj description)
|
||||
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)
|
||||
if [ -z $check_hls_empty ]; then
|
||||
hls=''
|
||||
|
@ -98,8 +116,13 @@ peertube_menu_video()
|
|||
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)
|
||||
echo "Channel: $channel"
|
||||
echo "Description video:\n$desc"
|
||||
menu_video_choice=$(echo "Play\nBack\nMain menu" | fzy)
|
||||
fulldescr=
|
||||
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
|
||||
"Main menu") sub2_menu=0 && sub_menu=0 ;;
|
||||
"Back") sub2_menu=0 ;;
|
||||
|
@ -119,6 +142,9 @@ peertube_menu_video()
|
|||
else
|
||||
curl -s --tcp-fastopen --output - $video_url | $default_player_command -
|
||||
fi ;;
|
||||
"Full description")
|
||||
fulldesc=$(peertube_api_get_fulldescription $1)
|
||||
echo "$fulldesc" | less -e ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -132,13 +158,22 @@ peertube_menu_stream()
|
|||
name=$(echo $get_video | jj name)
|
||||
desc=$(echo $get_video | jj description)
|
||||
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)
|
||||
state=$(echo $get_video | jj state.label)
|
||||
echo "Status: $state"
|
||||
#torrent_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].torrentUrl)
|
||||
echo "Channel: $channel"
|
||||
echo "Description video:\n$desc"
|
||||
menu_video_choice=$(echo "Play\nWait mode\nBack\nMain menu" | fzy)
|
||||
fulldescr=
|
||||
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
|
||||
"Main menu") sub2_menu=0 && sub_menu=0 ;;
|
||||
"Back") sub2_menu=0 ;;
|
||||
|
@ -162,6 +197,9 @@ peertube_menu_stream()
|
|||
echo 'Stream PUBLISHED!'
|
||||
$default_player_command $playlist_stream
|
||||
;;
|
||||
"Full description")
|
||||
fulldesc=$(peertube_api_get_fulldescription $1)
|
||||
echo "$fulldesc" | less -e ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -197,6 +235,10 @@ menu_settings()
|
|||
done
|
||||
}
|
||||
|
||||
if [ -z $(check_connect) ]; then
|
||||
echo 'Connect error...'
|
||||
echo 'Please retry later or switch instance'
|
||||
fi
|
||||
version=$(peertube_api_version_server)
|
||||
torrent_init
|
||||
videosmenu='All Videos'
|
||||
|
@ -244,6 +286,10 @@ while true; do
|
|||
cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null
|
||||
export instance
|
||||
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)
|
||||
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
|
||||
if [ "$conf_instance_state" = 'Permanent' ]; then
|
||||
|
|
Loading…
Add table
Reference in a new issue