combine seds in peertube.sh, ytmpd check for novideo streams

This commit is contained in:
паша душный 2023-05-09 01:23:01 +03:00
parent 50d457c9e6
commit 0958bcd274
3 changed files with 36 additions and 11 deletions

View File

@ -10,13 +10,11 @@ wget "$link" -O /tmp/videohtml
### Variables ### Variables
videolink=$( grep "meta property" /tmp/videohtml | grep "og:video:url" \ videolink=$(grep "og:video:url" /tmp/videohtml | sed 's/.*href="//;s#" />##' )
| sed 's/.*href="//' | sed 's#" />##') chatver=$(grep "peertube-plugin-livechat" /tmp/videohtml \
chatver=$( grep 'peertube-plugin-livechat' /tmp/videohtml | grep 'version'\ | sed 's#.*npmName..:..peertube-plugin-livechat.....name..:..livechat.....version..:..##;s#.....description.....PeerTube plugin livechat: offers a way.*##' )
| sed 's#.*npmName..:..peertube-plugin-livechat.....name..:..livechat.....version..:..##' \ instance=$(echo "$videolink" | sed 's#https://##;s#/videos/watch/.*##')
| sed 's#.....description.....PeerTube plugin livechat: offers a way.*##' ) videoid=$(echo "$videolink" | sed 's#.*videos/watch/##')
instance=$(echo "$videolink" | sed 's#https://##' | sed 's#/videos/watch/.*##')
videoid=$(echo $videolink | sed 's#.*videos/watch/##')
### Delete html ### Delete html

View File

@ -3,8 +3,13 @@
: "${1?How to use: $0 YT_VIDEO_LINK}" : "${1?How to use: $0 YT_VIDEO_LINK}"
yt_link="$1" yt_link="$1"
play_link=$(yt-dlp -g "$yt_link" | sed '1d') is_video=$(yt-dlp -g "$yt_link" | wc -l)
if [[ $is_video == 2 ]]
then
play_link=$(yt-dlp -g "$yt_link" | sed '1d')
else
play_link=$(yt-dlp -g "$yt_link")
fi
echo "Clear playlist? (N/y)" echo "Clear playlist? (N/y)"
read -r clearplay read -r clearplay
@ -29,4 +34,3 @@ esac
mpc add "$play_link" 1>/dev/null mpc add "$play_link" 1>/dev/null
exit 0 exit 0

View File

@ -3,11 +3,34 @@
: "${1?How to use: $0 YT_VIDEO_LINK}" : "${1?How to use: $0 YT_VIDEO_LINK}"
yt_link="$1" yt_link="$1"
is_video=$(yt-dlp -g "$yt_link" | wc -l)
if [[ $is_video == 2 ]]
then
play_link=$(yt-dlp -g "$yt_link" | sed '1d')
else
play_link=$(yt-dlp -g "$yt_link")
fi
play_link=$(yt-dlp -g "$yt_link" | sed '1d') echo "Clear playlist? (N/y)"
read -r clearplay
case "$clearplay" in
"y")
mpc clear 1>/dev/null mpc clear 1>/dev/null
echo "Playlist cleared"
mpc add "$play_link" 1>/dev/null mpc add "$play_link" 1>/dev/null
mpc play 1>/dev/null mpc play 1>/dev/null
echo "Playing"
exit 0
;;
"n")
echo "Adding"
;;
"")
echo "Adding"
;;
esac
mpc add "$play_link" 1>/dev/null
exit 0 exit 0