Some patches
This commit is contained in:
parent
77186eac68
commit
1efe93c629
|
@ -23,7 +23,7 @@ torrent_init()
|
|||
|
||||
check_connect()
|
||||
{
|
||||
if [ -n "$(curl --head -s $instance_point/config | grep 'HTTP\/. 200')" ]; then
|
||||
if [ -n "$(curl --head -s "$instance_point"/config | grep 'HTTP\/. 200')" ]; then
|
||||
echo 'OK'
|
||||
else
|
||||
echo
|
||||
|
@ -47,7 +47,7 @@ peertube_api_get_all_videos()
|
|||
|
||||
peertube_api_get_local_videos()
|
||||
{
|
||||
if [ $version -gt 3 ]; then
|
||||
if [ "$version" -gt 3 ]; then
|
||||
default_curl_opt "$instance_point/videos?count=100&start=$1&isLocal=true" | jj -p | tee preload >> /dev/null
|
||||
else
|
||||
default_curl_opt "$instance_point/videos?count=100&start=$1&filter=local" | jj -p | tee preload >> /dev/null
|
||||
|
@ -82,18 +82,18 @@ peertube_menu_videos()
|
|||
"Next page")
|
||||
if [ "$1" = 'all' ]; then
|
||||
page=$(expr $page + 100)
|
||||
peertube_api_get_all_videos $page
|
||||
peertube_api_get_all_videos "$page"
|
||||
else
|
||||
page=$(expr $page + 100)
|
||||
peertube_api_get_local_videos $page
|
||||
page=$(expr "$page" + 100)
|
||||
peertube_api_get_local_videos "$page"
|
||||
fi ;;
|
||||
*)
|
||||
index=$(echo $menu_videos_choice | cut -f 1 -d:)
|
||||
video_uuid=$(jj -i preload data.$index.uuid)
|
||||
index=$(echo "$menu_videos_choice" | cut -f 1 -d:)
|
||||
video_uuid=$(jj -i preload data."$index".uuid)
|
||||
if [ "$1" = 'lives' ]; then
|
||||
peertube_menu_stream $video_uuid
|
||||
peertube_menu_stream "$video_uuid"
|
||||
else
|
||||
peertube_menu_video $video_uuid
|
||||
peertube_menu_video "$video_uuid"
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
|
@ -103,23 +103,23 @@ peertube_menu_video()
|
|||
{
|
||||
clear
|
||||
sub2_menu=1
|
||||
get_video=$(peertube_api_get_video $1)
|
||||
get_video=$(peertube_api_get_video "$1")
|
||||
while [ $sub2_menu -eq 1 ]; do
|
||||
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)
|
||||
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
|
||||
check_hls_empty=$(echo "$get_video" | jj streamingPlaylists.0)
|
||||
if [ -z "$check_hls_empty" ]; then
|
||||
hls=''
|
||||
else
|
||||
hls='streamingPlaylists.0.'
|
||||
fi
|
||||
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)
|
||||
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"
|
||||
fulldescr=
|
||||
if [ -n "$desc" ]; then
|
||||
|
@ -135,27 +135,27 @@ peertube_menu_video()
|
|||
if [ -z "$video_url" ]; then
|
||||
echo "Resolution $pref_video_quality"'p not avalaible'
|
||||
echo 'Please choice:'
|
||||
resolution=$(echo $get_video | jj -l "$hls"files.#.resolution.label | fzy)
|
||||
video_url=$(echo $get_video | jj "$hls"files.#[resolution.label=$resolution].fileUrl)
|
||||
torrent_url=$(echo $get_video | jj "$hls"files.#[resolution.label=$resolution].torrentUrl)
|
||||
resolution=$(echo "$get_video" | jj -l "$hls"files.#.resolution.label | fzy)
|
||||
video_url=$(echo "$get_video" | jj "$hls"files.#[resolution.label="$resolution"].fileUrl)
|
||||
torrent_url=$(echo "$get_video" | jj "$hls"files.#[resolution.label="$resolution"].torrentUrl)
|
||||
fi
|
||||
|
||||
if [ "$torrent_enabled" = 'true' ]; then
|
||||
transmission-remote $rpcport -a $torrent_url
|
||||
curl -s --tcp-fastopen --output - $video_url | $default_player_command -
|
||||
transmission-remote $rpcport -a "$torrent_url"
|
||||
curl -s --tcp-fastopen --output - "$video_url" | $default_player_command -
|
||||
transmission-remote $rpcport -t 1 -rad
|
||||
else
|
||||
curl -s --tcp-fastopen --output - $video_url | $default_player_command -
|
||||
curl -s --tcp-fastopen --output - "$video_url" | $default_player_command -
|
||||
fi ;;
|
||||
"Full description")
|
||||
fulldesc=$(peertube_api_get_fulldescription $1)
|
||||
fulldesc=$(peertube_api_get_fulldescription "$1")
|
||||
echo "$fulldesc" | less -e ;;
|
||||
|
||||
"Share")
|
||||
echo "Link: https://$instance/w/$1"
|
||||
echo "Direct links:"
|
||||
echo "$(echo $get_video | jj -l "$hls"files.#.resolution.label)"
|
||||
echo "$(echo $get_video | jj -l "$hls"files.#.fileUrl)" ;;
|
||||
echo "$(echo "$get_video" | jj -l "$hls"files.#.resolution.label)"
|
||||
echo "$(echo "$get_video" | jj -l "$hls"files.#.fileUrl)" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
@ -164,17 +164,17 @@ peertube_menu_stream()
|
|||
{
|
||||
clear
|
||||
sub2_menu=1
|
||||
get_video=$(peertube_api_get_video $1)
|
||||
get_video=$(peertube_api_get_video "$1")
|
||||
while [ $sub2_menu -eq 1 ]; do
|
||||
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)
|
||||
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)
|
||||
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"
|
||||
|
@ -188,15 +188,15 @@ peertube_menu_stream()
|
|||
case $menu_video_choice in
|
||||
"Main menu") sub2_menu=0 && sub_menu=0 ;;
|
||||
"Back") sub2_menu=0 ;;
|
||||
"Play") $default_player_command $playlist_stream ;;
|
||||
"Play") $default_player_command "$playlist_stream" ;;
|
||||
|
||||
"Wait mode")
|
||||
playlist_stream=$(echo $get_video | jj streamingPlaylists.0.playlistUrl)
|
||||
playlist_stream=$(echo "$get_video" | jj streamingPlaylists.0.playlistUrl)
|
||||
echo 'Wait mode enabled...'
|
||||
echo 'Stream will be played when published state'
|
||||
while [ -z $playlist_stream ]; do
|
||||
get_video=$(peertube_api_get_video $1)
|
||||
playlist_stream=$(echo $get_video | jj streamingPlaylists.0.playlistUrl)
|
||||
while [ -z "$playlist_stream" ]; do
|
||||
get_video=$(peertube_api_get_video "$1")
|
||||
playlist_stream=$(echo "$get_video" | jj streamingPlaylists.0.playlistUrl)
|
||||
wait=15
|
||||
while [ $wait -gt 0 ]; do
|
||||
date
|
||||
|
@ -206,10 +206,10 @@ peertube_menu_stream()
|
|||
done
|
||||
clear
|
||||
echo 'Stream PUBLISHED!'
|
||||
$default_player_command $playlist_stream
|
||||
$default_player_command "$playlist_stream"
|
||||
;;
|
||||
"Full description")
|
||||
fulldesc=$(peertube_api_get_fulldescription $1)
|
||||
fulldesc=$(peertube_api_get_fulldescription "$1")
|
||||
echo "$fulldesc" | less -e ;;
|
||||
|
||||
"Share")
|
||||
|
@ -231,8 +231,8 @@ menu_settings()
|
|||
|
||||
"$default_res")
|
||||
resolution=$(echo '144\n240\n288\n480\n720\n1080' | fzy)
|
||||
jj -i config.json prefer_quality_video -v $resolution -o config.json
|
||||
export pref_video_quality=$resolution ;;
|
||||
jj -i config.json prefer_quality_video -v "$resolution" -o config.json
|
||||
export pref_video_quality="$resolution" ;;
|
||||
|
||||
"$torrent_set")
|
||||
case $torrent_enabled in
|
||||
|
@ -289,10 +289,10 @@ while true; do
|
|||
type_choice=$(echo "Video\nStream" | fzy)
|
||||
echo 'Input link:'
|
||||
read url
|
||||
url=$(echo $url | rev | cut -f1 -d/ | rev)
|
||||
url=$(echo "$url" | rev | cut -f1 -d/ | rev)
|
||||
case $type_choice in
|
||||
"Video") peertube_menu_video $url ;;
|
||||
"Stream") peertube_menu_stream $url ;;
|
||||
"Video") peertube_menu_video "$url" ;;
|
||||
"Stream") peertube_menu_stream "$url" ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
|
@ -312,7 +312,7 @@ while true; do
|
|||
"Manual input") echo "Type instance (ex. $instance):" && read instance ;;
|
||||
esac
|
||||
if [ $empty -eq 0 ]; then
|
||||
echo $instance >> $instance_hist
|
||||
echo "$instance" >> $instance_hist
|
||||
cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null
|
||||
export instance
|
||||
export instance_point="https://$instance/api/v1"
|
||||
|
@ -325,7 +325,7 @@ while true; do
|
|||
export version=$(peertube_api_version_server)
|
||||
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
|
||||
if [ "$conf_instance_state" = 'Permanent' ]; then
|
||||
jj -i config.json instance -v $instance -o config.json
|
||||
jj -i config.json instance -v "$instance" -o config.json
|
||||
else
|
||||
echo ''
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue