diff options
author | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-03-16 18:52:53 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk+git@omgwallhack.org> | 2022-03-16 18:52:53 -0700 |
commit | 26d9235aec0ce897acbbf39f4ca1b5b019862c72 (patch) | |
tree | 43b3ae5955b65be80d28e8dcd30fa229b650c73c /bash | |
parent | 333acb11f87c6aa7f488450bf6533716ad2e54a1 (diff) | |
download | twitchtools-26d9235aec0ce897acbbf39f4ca1b5b019862c72.tar.gz twitchtools-26d9235aec0ce897acbbf39f4ca1b5b019862c72.zip |
bash/sraddsong.sh: yt-dlp/mpd song downloader
Diffstat (limited to 'bash')
-rwxr-xr-x | bash/sraddsong.sh | 17 |
1 files changed, 17 insertions, 0 deletions
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 |