From 51326f326a494518db7e6744b0948bd658ecbf75 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Wed, 6 Apr 2022 01:31:15 +0300 Subject: [PATCH] Fix when HLS disabled on server --- peertube-cli.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/peertube-cli.sh b/peertube-cli.sh index 9e6729e..31f8f02 100755 --- a/peertube-cli.sh +++ b/peertube-cli.sh @@ -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