Make LinuxMCE do something when I start media

From LinuxMCE
Jump to: navigation, search


How to set it up

In the LinuxMCE Admin Website choose Wizard, Events, Respond to events. Choose one of the events from the list, like "Watching media" or "Listening to media" or "Stop Watching media". Then choose the room you want this event handler to respond to. Then add all the commands that you want to be executed when someone starts or stops media in that room, such as turning on lights, closing blinds, and so on. Add a separate event handler for each room you want to do this in.



How to use it

There is nothing to do. Any time you start watching media, such as TV or a movie, LinuxMCE automatically fires the "Watching media" event, and executes the commands you specified. Similarly if you start listening to media such as music or radio, LinuxMCE will fire the "Listening to media" event and execute those commands. It doesn't matter whether the media is from a media director, or another device, like a radio.



Programmer's guide

The Event_Plugin listens for all events and looks for corresponding event handlers. It then uses the criteria class to evaluate if the handler matches the criteria, such as in this case if it's the right room. When it finds a match it sends an "Execute Command Group" command to the DCE Router with the commands you specified. The information is stored in the pluto_main database, tables: EventHandler and Criteria.