Compatible with old versions PeerTube for watch local videos

This commit is contained in:
localhost_frssoft 2022-04-05 23:10:55 +03:00
parent cbd398b7ec
commit cf9c2ba397
1 changed files with 19 additions and 3 deletions

View File

@ -22,9 +22,23 @@ peertube_api_check_ratelimit()
curl -s --head "$instance_point/" | grep rate curl -s --head "$instance_point/" | grep rate
} }
peertube_api_version_server()
{
curl -s --compressed "$instance_point/config" | jj serverVersion | cut -f 1 -d.
}
peertube_api_get_all_videos() peertube_api_get_all_videos()
{ {
curl -s --compressed "$instance_point/videos?count=100&start=$1&isLocal=$2" | jj -p | tee preload >> /dev/null curl -s --compressed "$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
else
curl -s --compressed "$instance_point/videos?count=100&start=$1&filter=local" | jj -p | tee preload >> /dev/null
fi
} }
peertube_api_get_video() peertube_api_get_video()
@ -116,6 +130,7 @@ menu_settings()
done done
} }
version=$(peertube_api_version_server)
torrent_init torrent_init
videosmenu='All Videos' videosmenu='All Videos'
videosmenulocal='Local Videos' videosmenulocal='Local Videos'
@ -138,7 +153,7 @@ while true; do
"$videosmenulocal") "$videosmenulocal")
echo 'Enter page number (per 100 videos)' echo 'Enter page number (per 100 videos)'
read page read page
peertube_api_get_all_videos $page 'true' peertube_api_get_local_videos $page
peertube_menu_videos ;; peertube_menu_videos ;;
"$changepod") "$changepod")
@ -161,6 +176,7 @@ 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"
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
jj -i config.json instance -v $instance -o config.json jj -i config.json instance -v $instance -o config.json
@ -175,7 +191,7 @@ while true; do
"$checkapilimits") peertube_api_check_ratelimit ;; "$checkapilimits") peertube_api_check_ratelimit ;;
"$Exit") "$Exit")
if [ $torrent_enabled = 'true' ]; then transmission-remote 9095 --exit; fi if [ $torrent_enabled = 'true' ]; then transmission-remote $rpcport --exit; fi
exit 0 ;; exit 0 ;;
esac esac