summaryrefslogtreecommitdiff
path: root/bash/sraddsong.sh
blob: 8f999078fdb773b24a3e7a911100d57339034d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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