Dynamically update images in layout from external source

For a project, I need to automatically change images in a layout. The images are generated on an external server by a web application I have full control over. I’ve considered just adding the external URL of the images into a layout, which works… but, since the layout is refreshed frequently and because there are many screens running the layout, it puts quite a strain on the external webserver. I’d like to find a way to avoid that.

So, I’m currently looking for a better solution. I was thinking about feeding the images into Xibo’s CMS automatically each time they’re updated, but a) I’m not sure how to do this and b) I’m not sure if it’s the best way.

Can anyone offer some advice?

You can use webpage media module on Xibo. Since it is a web application, simply put the url to the web page media module and control display with xibo.

This is what I’m currently doing, as I stated in the first post. The documentation clearly states though that web pages are not cached, which is something I’ve also seen in practice. This means a huge resource waste on the server. We’re talking images here, that are part of a slideshow, which is refreshing roughly every 30 seconds. There are currently 15 clients, so that’s 30 images loaded every minute from the external server. 1800 per hour, 43200 per day. The image averages 100 kilobytes, so that’s roughly 4.2 gigabit bandwidth per day. While this is not a problem per se, I’d like to avoid it, by having the image cached locally somehow.

One possible solution would be a web server WAMP on the computer with the player. Sync once at night images with a script or rsync, and would make local requests without external traffic.

There are two ways to achieve this. One of them is TCP server/client example which you can use push method. Client is your web application which is always in listenning state. And modify your app code as to be an server state. When your images changes then it update your client by using TCP server/client architecture.

Other way is polling architecture. You can control image changing with a variable/flag then you can use this variable to trigger image update. But in this time your client/web app has to have an update interval. Client go and check this variable to decide wheter update or not.

1 Like

I don’t see how I can keep a Xibo client in listening or even polling mode since it is refreshed every time another layout loads, which is every 30 seconds or so. I could try to directly manipulate the cache of the local Xibo client using some app running in the background maybe? Not sure if that is what you guys are suggesting? But this seems to go a bit far?

I think it’s time for xibo’s slideshow module which is long due. [sorry for my incorrect English]

1 Like

You can change the images in the Xibo layout via the API.

There’s a basic example here:

1 Like

Hey, I am just in the middle of trying to get this script to work, it gets so far, then I encounter an error;

File “/usr/local/xiboscript/ReplacePPT.py”, line 167, in mediaid - api.parseID(content, ‘media’)

No node/attribute matches your request
We just changed things slightly to replace a PowerPoint rather than a video.

Any help you can offer would be appreciated

It’s hard to say without knowing what you edited, but assuming the line numbers are broadly the same that comes just after:

# Now the file is uploaded, and the old file is deleted,
# we need to add the newly uploaded file to the CMS Library
params = [('fileId', uploadId),
          ('type', 'video'),
          ('name', mediaName),
          ('duration', '0'),

  response, status, code, message, content = api.callMethod('LibraryMediaAdd', params)

So a good guess would be that either the file didn’t upload properly or didn’t get added to the library properly. The code example I give works so you need to look carefully at your edits to be sure that something you changed hasn’t broken the preceding code.

Also note that guide is designed as an example of how you might write an application, how you call the API etc. Helping you write an application that talks to the API is beyond what we would call reasonable support for the base system so if you wanted us to help debug your code we would ask you open a paid support ticket with Spring Signage and we’ll be happy to help you there.

Best wishes


Sorry for bumping an old topic, but I am in the same situation and I was wondering if updating images via the API is still the best way to go. Or is there currently a better way to do this? (since this topic is from 2015).

Well the example above relates to the API for 1.7 CMS. The 1.8 API is very different.

It depends really what you need the functionality for. 1.8 CMS can pull in images from a fixed URL in to a dataset, and then you can show those images in a ticker or in a table view, so that might be an easier way for you to go about it.

1 Like

And images from a URL in a dataset is also cached on a player? Is it also possible to dynamically add these images to a dataset, instead of fixed?

Yes they are cached on the Player.

If you wanted to be able to dynamically add and remove, then you could do it using a MediaRSS feed, and the Ticker module, which is again cached on the Player.

1 Like

Thanks for the quick responses!

This is only possible for images, not for videos right? What would be the best way to enhance it with videos? Use the API?

API is your route if you want to programatically add/remove videos yes.

The API is different on 1.8, so please ensure you look at Peter’s guide rather than the old one linked above.

1 Like

Hi All , you just use this library in xibo; http://unapllc.com/lss/howto.html, It works perfectly. You can create multiple folders each which becomes a url which you can just insert as a webpage in your Xibo layout. Any photos copied into the ‘images’ folder will be displayed. I have folders shared with specific people so they can keep their particular slideshow images updated