curl switched in to function

This commit is contained in:
localhost_frssoft 2022-04-14 14:23:30 +03:00
parent 2ae2464155
commit 77186eac68

View file

@ -9,6 +9,10 @@ ordering='title'
default_player_command='mpv --network-timeout=30 --profile=low-latency'
instance_point="https://$instance/api/v1"
default_curl_opt()
{
curl -s --compressed "$@"
}
torrent_init()
{
@ -28,41 +32,41 @@ check_connect()
peertube_api_check_ratelimit()
{
curl -s --head "$instance_point/" | grep rate
default_curl_opt --head "$instance_point/" | grep rate
}
peertube_api_version_server()
{
curl -s --compressed "$instance_point/config" | jj serverVersion | cut -f 1 -d.
default_curl_opt "$instance_point/config" | jj serverVersion | cut -f 1 -d.
}
peertube_api_get_all_videos()
{
curl -s --compressed "$instance_point/videos?count=100&start=$1" | jj -p | tee preload >> /dev/null
default_curl_opt "$instance_point/videos?count=100&start=$1" | jj -p | tee preload >> /dev/null
}
peertube_api_get_local_videos()
{
if [ $version -gt 3 ]; then
curl -s --compressed "$instance_point/videos?count=100&start=$1&isLocal=true" | jj -p | tee preload >> /dev/null
default_curl_opt "$instance_point/videos?count=100&start=$1&isLocal=true" | jj -p | tee preload >> /dev/null
else
curl -s --compressed "$instance_point/videos?count=100&start=$1&filter=local" | jj -p | tee preload >> /dev/null
default_curl_opt "$instance_point/videos?count=100&start=$1&filter=local" | jj -p | tee preload >> /dev/null
fi
}
peertube_api_get_live_streams()
{
curl -s --compressed "$instance_point/videos?count=100&start=$1&isLive=true&sort=-publishedAt" | jj -p | tee preload >> /dev/null
default_curl_opt "$instance_point/videos?count=100&start=$1&isLive=true&sort=-publishedAt" | jj -p | tee preload >> /dev/null
}
peertube_api_get_video()
{
curl -s --compressed "$instance_point/videos/$1"
default_curl_opt "$instance_point/videos/$1"
}
peertube_api_get_fulldescription()
{
curl -s --compressed "$instance_point/videos/$1/description" | jj description
default_curl_opt "$instance_point/videos/$1/description" | jj description
}
peertube_menu_videos()