summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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