Youtube to mpd

2022-06-06T14:57:30Z

Below a script taking a youtube url as argument. The audio is extracted, then added to the mpd library, inserted in the playlist then played.

#!/bin/sh
# download sound from youtube, convert to $format,
# then insert and play in mpd

format="flac"

MUSDIR=$(awk '/music_directory/ {sub("^\"","",$2);sub("\"$","",$2); print $2}' $HOME/.mpdconf)

cd ${MUSDIR}
yt-dlp --no-playlist -x \
	--audio-format $format \
	-c "${1}" \
	-o "%(title)s.%(ext)s" \
	--exec "mpc --wait update && mpc insert \"%(title)s.%(ext)s\" && mpc next" 
Proxy Information
Original URL
gemini://si3t.ch/log/2022-06-06-yt2mpd.txt
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
496.258656 milliseconds
Gemini-to-HTML Time
0.182111 milliseconds

This content has been proxied by September (3851b).