RogerBW's Blog

mpd and YouTube 15 January 2020

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.

Search
Archive
Tags 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000s 2010s 3d printing action aeronautics aikakirja anecdote animation anime army astronomy audio audio tech base commerce battletech beer boardgaming book of the week bookmonth chain of command children chris chronicle church of no redeeming virtues cold war comedy computing contemporary cornish smuggler cosmic encounter coup covid-19 cycling dead of winter doctor who documentary drama driving drone ecchi economics espionage essen 2015 essen 2016 essen 2017 essen 2018 essen 2019 existential risk falklands war fandom fanfic fantasy feminism film firefly first world war flash point flight simulation food garmin drive gazebo genesys geodata gin gkp gurps gurps 101 harpoon historical history horror hugo 2014 hugo 2015 hugo 2016 hugo 2017 hugo 2018 hugo 2019 hugo 2020 hugo-nebula reread in brief avoid instrumented life kickstarter learn to play leaving earth linux liquor lovecraftiana mecha men with beards museum mystery naval non-fiction one for the brow opera parody perl perl weekly challenge photography podcast politics powers prediction privacy project woolsack pyracantha python quantum rail raku ranting raspberry pi reading reading boardgames social real life restaurant reviews romance rpg a day rpgs ruby rust science fiction scythe second world war security shipwreck simutrans smartphone south atlantic war squaddies stationery steampunk stuarts suburbia superheroes suspense television the resistance thirsty meeples thriller tin soldier torg toys trailers travel type 26 type 31 type 45 vietnam war war wargaming weather wives and sweethearts writing about writing x-wing young adult
Special All book reviews, All film reviews
Produced by aikakirja v0.1