Page 1 of 1

Connect mpd to upnp?

Posted: Thu Sep 24, 2015 9:20 pm
by chazza
I thought this would be simple but I've been around all of the internet at least twice trying to sort this.

Based on http://blog.scphillips.com/posts/2014/0 ... rry-pi-v2/ and a mod or 2 I have got my RPI playing radio stations through my amp via MPD & MPC. Simple ssh to RPI and "$radio bbc6" . All good but got me thinking...

Ideally I would like to stream playlists from my Mac mini & iTunes but does not seem to be possible. Happily I back up my media to my Networkspace NAS which runs a variant of DAAP & UPNP. So I can connect to it with Rhythmbox or similar and play music on my Ubuntu PC.

So I want mpd to connect to the Networkspace upnp and use mpc or something like ncmpcpp over ssh to select and control playback on my RPI. I can see that there are settings in mpd.conf concerning upnp but I can't find what they should be.

How can I connect mpd to upnp?
Is this the best way to accomplish a command line streamer?

Thanks

Re: Connect mpd to upnp?

Posted: Tue Sep 29, 2015 6:50 pm
by frassepe
Have a look at Pete Manchesters Mediaplayer. It is great. Can also do some multiroom via songcast.
https://github.com/PeteManchester/MediaPlayer

Re: Connect mpd to upnp?

Posted: Tue Sep 29, 2015 7:15 pm
by Douglas6
I use gmediarenderer for a uPnP renderer. There are also some uPnP plug-ins available for mpd; I haven't tried them.

Re: Connect mpd to upnp?

Posted: Wed Sep 30, 2015 6:45 am
by frassepe
I fixed the link in my previous post.

It should be:
https://github.com/PeteManchester/MediaPlayer

Re: Connect mpd to upnp?

Posted: Wed Sep 30, 2015 3:23 pm
by chazza
I had a look at mediaplayer, have to say the install instructions aren't as clear as they could be. Got HARDFLOAT, checked java version, installed both mpd and mplayer just in case, downloaded the master.zip, unzipped to a temp directory, copied contents of com.upnp.mediaplayer to /home/pi/mediaplayer, chmod'd run.sh, ran it, got...

Error: Unable to access jarfile /home/chazza/mediaplayer/mediaplayer.jar

Found mediaplayer.jar in the download/release directory, copied to /home/pi/mediaplayer, ran run.sh, got...

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.rpi.main.StartMe.<clinit>(StartMe.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

Am I being a complete numptiehead? Where have I gone wrong?

Thanks

Re: Connect mpd to upnp?

Posted: Wed Sep 30, 2015 8:29 pm
by chazza
Given up, using a mount to NAS, MPD, MPC & ncmpcpp. Just works.

Re: Connect mpd to upnp?

Posted: Thu Oct 01, 2015 7:26 am
by frassepe
Ok. If you feel like having another go, here is a good guide.
https://github.com/guussie/PiDS/wiki/06 ... e-software

Re: Connect mpd to upnp?

Posted: Thu Oct 01, 2015 8:45 am
by FM81
May be this: http://www.lesbonscomptes.com/upmpdcli/

Greetings, FM_81

Re: Connect mpd to upnp?

Posted: Thu Oct 01, 2015 4:27 pm
by chazza
Thanks for all your replies. I was hoping for an easy command line client which would just browse upnp resources similar to Rhythmbox or Amarok which is simply find, connect and play. As far as I can see I can't find one where I can just ssh to my pi and go. So was hoping mpd with a little edit would just connect, obviously no such luck. I can see a lot of people have spent a lot of time putting together working infrastructure for this kind of functionality but it's too complicated for ickle ol' me.

My RPI is an old model A so X is pants, hence wanting a command line client.

Just curious, if Rhythmbox/Amarok can do it, any reason why the console clients can't?

Re: Connect mpd to upnp?

Posted: Sun Oct 04, 2015 8:03 am
by kingosticks
Upmpdcli does exactly what you want, as suggested above.

Re: Connect mpd to upnp?

Posted: Mon Oct 05, 2015 8:17 pm
by chazza
@kingosticks
Apologies, you're quite correct, I did look at the link but was under the influence of config fatigue so didn't read it properly. If on the RPI it was a case of apt-get dostuff then I'd give it a go. Cheers.

Re: Connect mpd to upnp?

Posted: Sun Oct 25, 2015 3:07 pm
by PeteManchester
chazza wrote:I had a look at mediaplayer, have to say the install instructions aren't as clear as they could be. Got HARDFLOAT, checked java version, installed both mpd and mplayer just in case, downloaded the master.zip, unzipped to a temp directory, copied contents of com.upnp.mediaplayer to /home/pi/mediaplayer, chmod'd run.sh, ran it, got...

Error: Unable to access jarfile /home/chazza/mediaplayer/mediaplayer.jar

Found mediaplayer.jar in the download/release directory, copied to /home/pi/mediaplayer, ran run.sh, got...

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at org.rpi.main.StartMe.<clinit>(StartMe.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

Am I being a complete numptiehead? Where have I gone wrong?

Thanks
A bit late but I've just seen this post, from your description it looks like you downloaded the zip file of the complete repository rather than just the zipped up release files.

I have now put the mediaPlayer.zip release files at this url

https://github.com/PeteManchester/MediaPlayer/releases, so just download the latest release version and extract/copy to /home/pi then follow the instructions

Re: Connect mpd to upnp?

Posted: Mon Oct 26, 2015 10:19 am
by chazza
Thanks Pete

Re: Connect mpd to upnp?

Posted: Mon Oct 26, 2015 12:16 pm
by raspbee
I think I am currently trying something similar.
raspberry -> commandline -> play mp3 to dlna device

As far as I read in this thread as mentioned by kingosticks and FM81 this should be possible with
Upmpdcli ?

This is new terrain for me so I have some difficulties in understanding it right.
I have MDP installed which should act as the server now I need some playback client
which I need to tell the target device somehow.
First I thought of configuring an "audio_device" but I couldn´t find anything describing how to setup a dlna device as audio_device.

Now what exactly does upmpdcli?
I can configure a "upnpip" and a port but how do I play the file then ?

mpc add ~/music/test.mp3 just returns "error: directory or file not found"
and it doesn´t matter if I use "/home/pi/music/test.mp3" instead

such a simple thing and I am stuck :(

Re: Connect mpd to upnp?

Posted: Tue Oct 27, 2015 8:50 am
by raspbee
alright, at least I got mpd/mpc playing through the raspberry jack now but I still have no idea how to direct this to me dlna device

Re: Connect mpd to upnp?

Posted: Thu Oct 29, 2015 5:20 am
by FM81
@raspbee: I'm not sure, if you need 'upmpdcli' in this case at all? As far as I understand 'upmpdcli' only translates UPnP to MPD on the "command-side", not the "playing-part"? (Please excuse if I'm saying something wrong here.)

To stream, please look at your MPD-config, for example here: http://linux.die.net/man/5/mpd.conf
You have to define an output, part of my config:

Code: Select all

audio_output {
type "httpd"
name "HTTP Stream from Raspberry Pi"
encoder "lame"
bitrate "128"
bind_to_address "0.0.0.0"
port "54321"
format "44100:16:2"
}
There are a lot of formats, HTTP is only one of them ...
Any client can play this, for example with the command

Code: Select all

/usr/bin/mpg123 -b 2048 http://192.168.0.8:54321
('192.168.0.8' is the IP of my raspberry, '-b 2048' is for buffering.)
Also DNLA isn't involved in my case at all; but as said, there are many ways to do the same thing ...

Greetings, FM_81