Roomware MPD control

17 views
Skip to first unread message

Gert-Jan de Boer

unread,
Jul 24, 2009, 5:48:47 AM7/24/09
to The Roomware Project, mar...@sexybiggetje.nl
Hi,

I'd like to tell you about my implementation of Roomware.

I use MPD (http://www.musicpd.org) on my mediacenter to play music
without an interface. I connect to this MPD daemon with some PC
clients and two phone clients, one using Bluetooth and one using Wifi.

I run the Roomware server on my Ubuntu Jaunty mediacenter. This
mediacenter has an USB bluetooth stick. It scans the room every 120
seconds. We wrote an script (PHP CLI) and run this in Cron. This
script reads out an .ini file describing different playlists and the
devices associated with them. It also reads an file in /tmp and
connects to the Roomware server to get the current devices.

The script compares the ini file with the current devices it knows
about and only remembers the devices which are "important" (linked to
an playlist).

Now it compares the important devices from the /tmp file and the
important devices from the Roomware server. If there is no change
nothing happens. If there is an change it will clear the current MPD
playlist, read out the ini file and seek the most matching playlist
for the people in the room and puts that in the current playlist. Last
but not least it presses Play on the MPD daemon.

When there are no important devices left in the room it will pause the
music. The script doesn't change playlists and doesn't press Play if
the current MPD status is STOPPED. So we manually control the running
of MPD by pressing the STOP and PLAY button. If the state is PAUSE or
PLAY the script will take ownership of the playlist every two minutes.

The .ini file looks like this:

[<playlistname>]
<devicename>=required

So my file looks like this:

[gertjandeboer]
Tleilax=required

[mariekedeboer]
Arrakis=required

[gezelligsamen]
Tleilax=required
Arrakis=required

[noggezelligersamen]
Tleilax=required
Arrakis=required
Bigachu=required


In MPD you obviously need to create these playlists.

On my wishlist for this script:

1) Nested playlists. For example when there are two people together in
the room and "gezelligsamen" gets hit and someone enters which isn't
in any of the multiple user playlists but has is own playlist defined
it shouldn't clear the current playlist but join the two playlists.

I'll post the script to this wiki.

Kind regards,

Gert-Jan de Boer
Roomware enthousiast.

Gert-Jan de Boer

unread,
Jul 24, 2009, 7:55:21 AM7/24/09
to The Roomware Project
And updated the files on this group to include the code :-)
Will you post it on the site?

Tijs Teulings

unread,
Jul 24, 2009, 8:58:58 AM7/24/09
to room...@googlegroups.com
i've added it to the list of downloads on our google code repository for now: http://code.google.com/p/roomware/downloads/list

good stuff btw, would like to hack something similar with applescript and itunes some time.

Tijs


On Fri, Jul 24, 2009 at 1:55 PM, Gert-Jan de Boer <goo...@nosco-ict.nl> wrote:

And updated the files on this group to include the code :-)
Will you post it on the site?




--
Tijs Teulings
Automatique
tel: +31645004824
http://www.automatique.nl
kvk: 34229089

more: http://tijs.org

Sexybiggetje

unread,
Jul 24, 2009, 9:14:21 AM7/24/09
to The Roomware Project
Since im currently working on something other roomware related, i
didn't modify the script yet, but iTunes should be easily done in a
similar way.
Following addition could change the playlist easily, now we only need
to find out if it is playing, with applescript.

<?php
$changePlaylist = "osascript -e 'tell application \"iTunes\"'"
." -e 'play track 1 in playlist \"" .
$matchingPlaylist . "\"'"
." -e 'end tell'";

passthru($changePlaylist);
?>

On 24 jul, 14:58, Tijs Teulings <tteuli...@gmail.com> wrote:
> i've added it to the list of downloads on our google code repository for
> now:http://code.google.com/p/roomware/downloads/list
> good stuff btw, would like to hack something similar with applescript and
> itunes some time.
>
> Tijs
>
> On Fri, Jul 24, 2009 at 1:55 PM, Gert-Jan de Boer <goo...@nosco-ict.nl>wrote:
>
>
>
> > And updated the files on this group to include the code :-)
> > Will you post it on the site?
>
> --
> Tijs Teulings
> Automatique
> tel: +31645004824http://www.automatique.nl

Tijs Teulings

unread,
Jul 24, 2009, 12:14:18 PM7/24/09
to room...@googlegroups.com
cool thanks, i'll try that!
Reply all
Reply to author
Forward
0 new messages