MPD won't play audiofiles locally

General Discussion about MPD – anything that doesn't fit in the other MPD forums.
Post Reply
Grum-pi
Posts: 2
Joined: January 21st, 2013, 6:33 am

MPD won't play audiofiles locally

Post by Grum-pi »

Dear All,

When I was just about to scan the forum for a solution to my problem, I discovered it was gone. Many thanks for setting up a new forum so I can post my question. Hopefully it is one you can help me with.

I am trying to set up the one-button-audio-book on a raspberry Pi as a gift for my girlfriend's blind grandma.
Among other things, it uses MPD, MPC and a python script.
What should happen is that when you start the script and plug in a usb-stick, the files on the stick are copied to the RPi. After unplugging the USB-stick, the player should start automatically start or you can press the start/pause button.
I have checked the python script and it all seem to work, the files are copied from the stick to the RPi, the button works, and the led too... but no soundfiles are played.

When I play one of the copied soundfiles with mpg123 by typing:

Code: Select all

/music/mp3 $ mpg123 file0.mp3
It works.

I think it has got something to do with creating the playlist or permissions.
I have changed the permissions of the files MPD needs (including the soundfiles) to the user mentioned in /etc/mpd.conf whichin my case is "mpd" according to the instructions mentioned here
Added to that I set the file-permissions of the soundfiles to 777 according to(wards the bottom of this thread:

I know MPC and MPD are running because when I type:

Code: Select all

$ mpc
I get this result:

Code: Select all

volume: 77%  repeat: off  random: off  single: off  consume: off
Now when I try to add a file to a playlist manually by typing:

Code: Select all

/music/mp3 $ mpc add file0.mp3 
I get:

Code: Select all

error: directory or file not found
When I do:

Code: Select all

/music/mp3 $ mpc add /music/mp3/file0.mp3 
I get the same error.
When I do:

Code: Select all

/music/mp3 $ mpc ls|mpc add
As instructed in the man-pages, I get no error but when I check the playlist by typing:

Code: Select all

/music/mp3 $ mpc listall
Nothing is returned.
When I type:

Code: Select all

/music/mp3 $ mpc play
No music is played.

What on earth am I missing here?
I hope you can help me making life a little more pleasant for Granny.

Many thanks in advance.
Erik.
Qball
Forum team
Posts: 54
Joined: January 15th, 2013, 4:03 pm

Re: MPD won't play audiofiles locally

Post by Qball »

Once the file is copy, you want MPD to update it DATABASE.

Code: Select all

mpc update
Or you can update/add one specific file:

Code: Select all

mpc update <file>
Then after updating is done, add the file to the play-queue

Code: Select all

mpc add <file>
Then you can play it.


A second solution is connecting to MPD via MPC via a socket (see mpd.conf)
Then you can do:

Code: Select all

mpc add file://<path to local file>
and then play it. (withouth it being added to the database)
Grum-pi
Posts: 2
Joined: January 21st, 2013, 6:33 am

Re: MPD won't play audiofiles locally

Post by Grum-pi »

Qball,

Thank you ever so much for your help.
I hear beautiful sound coming from the RPi
It needs a little more experimentation but ones I get it working I'll make a detailed installation guide.

Regards,

Erik.
Post Reply