combine seds in peertube.sh, ytmpd check for novideo streams
This commit is contained in:
parent
50d457c9e6
commit
0958bcd274
@ -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
|
||||||
|
|
||||||
|
@ -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"
|
||||||
|
is_video=$(yt-dlp -g "$yt_link" | wc -l)
|
||||||
|
if [[ $is_video == 2 ]]
|
||||||
|
then
|
||||||
play_link=$(yt-dlp -g "$yt_link" | sed '1d')
|
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
|
||||||
|
|
||||||
|
@ -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')
|
play_link=$(yt-dlp -g "$yt_link" | sed '1d')
|
||||||
|
else
|
||||||
|
play_link=$(yt-dlp -g "$yt_link")
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user