Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mpc / mpd on linux: how to play local wav file

I am trying to add a local file to mpd ( through mpc ) and play it . my platform is OpenWRT embedded linux .

so, from the man page, it states:

mpc add <file>   Add a song to the current playlist

if i do:

root@OpenWrt:~/.mpd# mpc add /usr/share/baresip/ring.wav 
error adding /usr/share/baresip/ring.wav: directory or file not found

or if i do:

root@OpenWrt:~/.mpd# mpc add file:///usr/share/baresip/ring.wav 
error adding file:///usr/share/baresip/ring.wav: Access denied

what exactly is the correct syntax here? the man page is really not very clear for mpc / mpd .

like image 779
Shrouk Khan Avatar asked Dec 11 '22 16:12

Shrouk Khan


1 Answers

Your second attempt was almost right. The problem you had was that mpd will only allow file: URLs to be passed to it via a local connection, which it enforces by requiring you to connect on its unix-domain socket. So, in your mpd.conf you need to have a line like this:

bind_to_address     "/run/mpd/socket"

(depending on your system you may want to change /run to /var/run -- the version I quote is correct for recent versions of debian or ubuntu but others may be different).

Then, you need to set up your environment to point to that socket:

export MPD_HOST=/run/mpd/socket

when you do this, mpc add or mpc insert can successfully accept a file: URL:

$ mpc insert "file:///data/incoming/files/111_scorpions_-_the_zoo.mp3"
$ mpc next
Scorpions - The Zoo
[playing] #23/39   0:00/5:30 (0%)
volume: n/a   repeat: off   random: off   single: off   consume: off
$
like image 187
Jules Avatar answered Dec 31 '22 04:12

Jules