32 lines
410 B
Bash
Executable File
32 lines
410 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
: "${1?How to use: $0 YT_VIDEO_LINK}"
|
|
|
|
yt_link="$1"
|
|
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
|
|
echo "Playlist cleared"
|
|
mpc add "$play_link" 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
|