From 26d9235aec0ce897acbbf39f4ca1b5b019862c72 Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Wed, 16 Mar 2022 18:52:53 -0700 Subject: bash/sraddsong.sh: yt-dlp/mpd song downloader --- bash/sraddsong.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 bash/sraddsong.sh (limited to 'bash/sraddsong.sh') diff --git a/bash/sraddsong.sh b/bash/sraddsong.sh new file mode 100755 index 0000000..8f99907 --- /dev/null +++ b/bash/sraddsong.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -x +set -e + +cd ~/music + +yt-dlp --no-playlist -x --default-search auto "$1" +sync +ytdlname="$( yt-dlp --no-playlist -x --get-filename --default-search auto "$1" )" +[[ "$ytdlname" =~ (.+)\. ]] +filename="$( find "${BASH_REMATCH[1]}"* -printf '%f\n' | tail -n 1 )" + +mpc update --wait +mpc add "$filename" +mpc play + +# update mpd -- cgit v1.2.3