bash/for_bigg/ytmpdplay.sh
cheesus_crust 9581bcc174 lets
2023-02-14 21:22:28 +03:00

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