External Event Triggering Screens

Asked by hightekvagabond

OK, so, what we are trying to do is interrupt all the screens in an area and change their layout when an outside event triggers.

Specifically, When someone in athority wants to do a drawing for a prize they swipe a card at a kiosk we already control which triggers a series of events, among other things one of those events is to send a hit to a little php script I’ve been working on over at the Xibo server. The goal of said hit is to change the layout on a bunch of screens to a simple layout that I’ve already made that just fills the screen with a single SWF which works beautifully to do it’s own little hits back to our other servers to keep people up to date on the status of the drawing.

I’m authenticating the hit to my script just fine, the layout looks nice, and with (I think it was Dan’s help) I’ve found the config to change the screens to check for updates every 15 seconds instead of every 60 (it’s not many screens and a small local area network so the performance hit is ok).

The part that boggles me is making a call to the right function in the right library to update the screens, I don’t even mind doing the update 1 screen at a time if I have to, but I’m just not seeing what function I need to call to programaticaly schedule a layout rather then through the admin interface.

I’ve tried just doing straight SQL and inserting into the database schedule table and that didn’t seem to affect the screens, and I’ve done var_dump (with a redirected output to a log file) to see if I can even follow how you are passing in the scheduling info when you update the schedule, and I just don’t see it.

I’m sure I’m probably over looking something (I’m really a perl guy not a php guy) but could really use just a hint of where to look, this is the last piece I need for this big show we having coming up in 2 weeks and I’d love to solve this problem before the end of the week and be a hero to my boss. ;)

You guys would be my heros if you could help me be a hero. :)

Question information

Language:
English Edit question
Status:
Answered
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Dan Garner (dangarner) said :
#1

Hey,

The sad fact is that the 1.0 series of code is not very OO in its design when it comes to interacting with the DB...

The 1.1 series has begun to address this and would make it very easy to do what you want to do... you could simply do:

$schedule = new Schedule($db);
$schedule->Add($fromdt, $todt, $layoutid, $displaygroupids);

However that isn't ready yet so we are stuck with the 1.0 code.

If you are open to a suggestion then there might be a slightly different approach which would suit your needs.

You could add a setting to the settings table which was "overrideLayoutID". It would default to 0 but when your script kicks off it could update that setting to be the ID of the layout you wanted to show.

You could design a custom XMDS which implements changes to 2 functions.

1. RequiredFiles
You would need to change this function to always return the required elements for your layout when the overrideLayoutID was not 0. You could do something like:

$overrideLayoutID = Config::GetSetting($db,'overrideLayoutID');

if ($overrideLayoutID == 0)
{
 // run the SQL we currently run
}
else
{
 // run this sql
 $SQL = 'SELECT layout.layoutID, '2050-12-31 00:00:00' AS starttime, '2050-12-31 00:00:00' AS endtime, layout.xml, layout.background FROM layout WHERE layoutID = ' . $overrideLayoutID;
}

This would then ensure your layout and its media was downloaded to the client.

2. Do a similar thing in the Schedule function

I hope this points you in the right direction. It is actually an interesting request in that we are currently considering something along the same lines for future inclusion into the application.

Revision history for this message
Dan Garner (dangarner) said :
#2

I forgot to mention that if you wanted to you could use

$setting = new Setting($db);
$setting->Edit('overrideLayoutID', 1);

From your PHP trigger script.

I also forgot to mention that we want to expose a lot of this stuff as an API. :-)

Revision history for this message
S Weatherly (sweatherly) said :
#3

Hello,
   I have to say that this signage framework is great and I have been testing the stable and development releases to see if it is a good fit for a new product in development.

I am looking to do something very similar to what hightekvagabond wanted to do in this request. It has been a while since this post was answered so I would like to know if there any documented API that allowed for new media, layout and Schedule Now requests to be made by an external PHP script other than the web interface?

 I went through the database structure a see where it could be done by manually inserting /editing entries in the respective tables, but I think that there may be some other background items updates in other tables that I may miss that may not allow this to run seamlessly down the line.

Can any additional info be provided?

Let me know if further info is needed.

Thanks in advance,

--Steve

Revision history for this message
Dan Garner (dangarner) said :
#4

Hi Steve,

Its moved on a little bit, but not massively... There is an API in the development preview and it does have a number of methods that work well... but there is a lot missing still.

Unfortunately we dont really have a good reason to work on the API in preference to other things, so it is quite low down on the list (also doesnt help that it is a massive piece of work!).

There is a doc available here: http://wiki.xibo.org.uk/wiki/XiboAPI

If you want to do something specific with it and the method isnt available (which it probably isn't), let us know and we can see if it can be put in.

Cheers,
Dan

Can you help with this problem?

Provide an answer of your own, or ask hightekvagabond for more information if necessary.

To post a message you must log in.