This page last changed on Mar 17, 2014 by andersonffv.

Hi everyone!

I'm trying to integrate MPD with the OR via Telnet.

The "currentsong" command returns:

file: sacd/Dire Straits/Brothers in Arms (1985)/1.02. Money For Nothing.dsf
Last-Modified: 2014-02-25T02:40:44Z
Time: 506
Artist: Dire Straits
AlbumArtist: Dire Straits
Title: Money For Nothing
Album: Brothers in Arms
Track: 2/9
Date: 1985
Genre: Rock
Disc: 1/1
Pos: 1
Id: 374
OK

So I'm using the following regex to extract artist name:

(?m)^\s*Artist:\s*(.+)$

However the OR returns "N / A". The telnet seems to be working, but the Regex expression not.
I´ve tried to test on http://www.regexplanet.com/ and it worked.

Any ideas?
And is this integration method is the most suitable? (telnet, regex)

Thanks everyone.

Not sure if "(?m)" will work for you in Java... open to correction I believe its more common place to use "(?s)". I would try the following:

(?s)^.*Artist:(.*)AlbumArtist.*$ 

I did use Telnet (and TCP/IP) to integrate MPD once and it worked fine.
I then changed my setup to have MPD running on a separate machine to my OR install so I converted my TCP commands into shell scripts that opened an SSH session first (authenticated via key exchange) to the foreign machine and then delivered the command. You can then execute these in OR using the Shell Execution Protocol. This did technically work for me but was ultimately too slow due to the ssh authentication and encryption overheads involved with SSH. In the end, I found a purpose made python library on the MPD site (http://mpd.wikia.com/wiki/Client_Libraries) that you can wrap up in shell scripts. These do all the hard-work for you and are easy to work with once you get used to them.

I just used Python because I am familiar with it. There is also mention of a JAVA library on the site, but i never got around to following it up. I think it should be possible to integrate this all into the rules engine, or if not, you could still execute Shell script wrappers for the JAVA library calls. This would keep the Java theme going, inline with OR itself. But as its open-source, what ever works for you is fine!

MPD is an excellent music player, and well worth the time spent on integrating it. You can run it on almost anything, Raspberry Pis, Beaglebones, NAS etc. A bit time consuming, but ultimately worth it.

Posted by holeymoley at Mar 18, 2014 13:43
Document generated by Confluence on Jun 05, 2016 09:39