I've extended my mpd-tools suite to allow for a new mode of operation.
There's a lot of music on YouTube, and the immediate inspiration
for this was Melodice, a set of playlists for
board games. The idea is that you have a laptop or phone or such like
at the game table, tell the site which game you're playing, and it
plays a succession of YouTube videos as background music.
But, well, I don't want to have a web browser on the box that's hooked
up to the speakers in my main room, especially not one that's pointed
at a Google site. Can I get this stuff into the excellent
mpd instead?
Why yes, I can. ytpl
needs youtube-dl to
do the heavy lifting. It looks through the playlist, shuffles it if
wanted, and whenever there's less than five minutes of play time
remaining it picks a new track. If it's not already on the server the
process tries to download it (converting to a plain audio file) and
updates the mpd database so that the track is available, then adds it
to the queue – which can be manipulated normally with mpd client
software, including adding locally-stored tracks. (I know, it's
terribly old-fashioned to have one's own digital music collection
rather than renting temporary listening rights over someone else's,
but that's the way I like to do things.)
It's all rather silly, but it works. (It's also probably a violation
of YouTube's ToS to take the video file they happily send you and
actually keep it in a cache, rather than playing it once and throwing
it away. So if you care about that sort of thing you shouldn't use
this software, or indeed youtube-dl
.)
It'll also work on a standard YouTube playlist, or individual file
URLs. I've updated the mpd-tools package on
github.
Comments on this post are now closed. If you have particular grounds for adding a late comment, comment on a more recent post quoting the URL of this one.