Fix when HLS disabled on server

This commit is contained in:
localhost_frssoft 2022-04-06 01:31:15 +03:00
parent 409ab15f8c
commit 51326f326a
1 changed files with 11 additions and 5 deletions

View File

@ -89,8 +89,14 @@ 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)
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)
echo "Channel: $channel"
echo "Description video:\n$desc"
menu_video_choice=$(echo "Play\nBack\nMain menu" | fzy)
@ -101,9 +107,9 @@ 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 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)
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