Fix long time loading

This commit is contained in:
localhost_frssoft 2022-04-05 20:36:11 +03:00
parent 79da2a4a0a
commit b05c5c0c20

View file

@ -55,6 +55,8 @@ peertube_menu_video()
name=$(echo $get_video | jj name)
desc=$(echo $get_video | jj description)
channel=$(echo $get_video | jj channel.name)
video_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].fileUrl)
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\nBack\nMain menu" | fzy)
@ -62,22 +64,20 @@ peertube_menu_video()
"Main menu") sub2_menu=0 && sub_menu=0 ;;
"Back") sub2_menu=0 ;;
"Play")
video_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].fileUrl)
torrent_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.id=$pref_video_quality].torrentUrl)
if [ -z "$video_url" ]; then
echo "Resolution $pref_video_quality\p not avalaible"
echo "Resolution $pref_video_quality"'p not avalaible'
echo 'Please choice:'
resolution=$(echo $get_video | jj -l streamingPlaylists.0.files.#.resolution.label | fzy)
video_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.label=$resolution].fileUrl)
torrent_url=$(echo $get_video | jj streamingPlaylists.0.files.#[resolution.label=$resolution].torrentUrl)
fi
echo 'Loading may long time for big video'
if [ "$torrent_enabled" = 'true' ]; then
transmission-remote 9095 -a $torrent_url
$default_player_command $video_url
curl -s --tcp-fastopen --output - $video_url | $default_player_command -
transmission-remote 9095 -t 1 -rad
else
$default_player_command $video_url
curl -s --tcp-fastopen --output - $video_url | $default_player_command -
fi ;;
esac
done