summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk+git@omgwallhack.org>2022-03-16 18:52:53 -0700
committerJoe Rayhawk <jrayhawk+git@omgwallhack.org>2022-03-16 18:52:53 -0700
commit26d9235aec0ce897acbbf39f4ca1b5b019862c72 (patch)
tree43b3ae5955b65be80d28e8dcd30fa229b650c73c
parent333acb11f87c6aa7f488450bf6533716ad2e54a1 (diff)
downloadtwitchtools-26d9235aec0ce897acbbf39f4ca1b5b019862c72.tar.gz
twitchtools-26d9235aec0ce897acbbf39f4ca1b5b019862c72.zip
bash/sraddsong.sh: yt-dlp/mpd song downloader
-rwxr-xr-xbash/sraddsong.sh17
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