chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Connect mpd to upnp?

Thu Sep 24, 2015 9:20 pm

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

frassepe
Posts: 7
Joined: Thu Jun 05, 2014 7:14 am

Re: Connect mpd to upnp?

Tue Sep 29, 2015 6:50 pm

Have a look at Pete Manchesters Mediaplayer. It is great. Can also do some multiroom via songcast.
https://github.com/PeteManchester/MediaPlayer
Last edited by frassepe on Wed Sep 30, 2015 6:44 am, edited 1 time in total.

User avatar
Douglas6
Posts: 4826
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Connect mpd to upnp?

Tue Sep 29, 2015 7:15 pm

I use gmediarenderer for a uPnP renderer. There are also some uPnP plug-ins available for mpd; I haven't tried them.

frassepe
Posts: 7
Joined: Thu Jun 05, 2014 7:14 am

Re: Connect mpd to upnp?

Wed Sep 30, 2015 6:45 am

I fixed the link in my previous post.

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

chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Re: Connect mpd to upnp?

Wed Sep 30, 2015 3:23 pm

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

chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Re: Connect mpd to upnp?

Wed Sep 30, 2015 8:29 pm

Given up, using a mount to NAS, MPD, MPC & ncmpcpp. Just works.

frassepe
Posts: 7
Joined: Thu Jun 05, 2014 7:14 am

Re: Connect mpd to upnp?

Thu Oct 01, 2015 7:26 am

Ok. If you feel like having another go, here is a good guide.
https://github.com/guussie/PiDS/wiki/06 ... e-software

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Connect mpd to upnp?

Thu Oct 01, 2015 8:45 am

May be this: http://www.lesbonscomptes.com/upmpdcli/

Greetings, FM_81
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Re: Connect mpd to upnp?

Thu Oct 01, 2015 4:27 pm

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?

kingosticks
Posts: 20
Joined: Mon Jun 24, 2013 9:25 am

Re: Connect mpd to upnp?

Sun Oct 04, 2015 8:03 am

Upmpdcli does exactly what you want, as suggested above.

chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Re: Connect mpd to upnp?

Mon Oct 05, 2015 8:17 pm

@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.

PeteManchester
Posts: 3
Joined: Fri Oct 25, 2013 8:18 pm

Re: Connect mpd to upnp?

Sun Oct 25, 2015 3:07 pm

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

chazza
Posts: 7
Joined: Thu Sep 24, 2015 9:01 pm

Re: Connect mpd to upnp?

Mon Oct 26, 2015 10:19 am

Thanks Pete

raspbee
Posts: 41
Joined: Tue Sep 25, 2012 1:25 pm

Re: Connect mpd to upnp?

Mon Oct 26, 2015 12:16 pm

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 :(

raspbee
Posts: 41
Joined: Tue Sep 25, 2012 1:25 pm

Re: Connect mpd to upnp?

Tue Oct 27, 2015 8:50 am

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

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Connect mpd to upnp?

Thu Oct 29, 2015 5:20 am

@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
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

Return to “Media centres”