#!/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