Displaying artwork information on an e-ink display alongside Openframe

Hi all,

I’m currently using a Python script on a Raspberry Pi to display images on a monitor. The twist is that there’s an e-ink display that shows information about the artwork that is currently being displayed. I’m interested in moving this set-up to Openframe, but I’m unsure how I could achieve the same effect with the e-ink display.

Ideally, I’d port the e-ink code to Node JS and integrate it into an extension. The extension should start whenever the artwork on the monitor changes. This is the part where I get stuck. Does the extension infrastructure currently allow for something like this?

As long as there’s some sort of trigger with the changing of the artwork, I could hack something in place (e.g. launching the Python script and fetching the artwork information through the REST API) if I cannot figure out the extensions or if they themselves don’t work with the e-ink. The only thing that comes close that I’ve thought of so far is to poll the REST API for changes, but that’s not a very neat solution.

I look forward to hearing your ideas and am curious if there’s anyone with a similar setup already!

Hey —

I believe you should indeed be able to accomplish this with an extension. There’s a global event bus (aka the pubsub system) that will publish events related to frames updating which you could listen for in the extension and do your work accordingly.

Extensions have access to the pubsub module via this.pubsub. Take a look at this example for an idea of how you might go about it access the pubsub.

Unfortunately the docs around the event bus aren’t great — I think what you’d want to do is subscribe to the /frame/{frame_id}/frame_updated event. You can get the frame ID by this.frame.id (or this.frame.state.id? I can’t remember off-hand) within the extension init method.

// untested, but something like this....
this.pubsub.subscribe('/frame/' + this.frame.state.id + '/frame_updated', function(id) {
    // do your thing -- I'm sorry to say that it looks like this event only includes the frame id as payload, which 
    // means you'll need to use the rest api to fetch the current artwork... maybe the whole frame data 
    // should be included?

Good luck!

Hey Jon,

Thanks a lot for your reply! This pushed me in the right direction and I am now able to subscribe to changes in the artwork that’s being displayed and its metadata. I can feed this information into a script to power the e-ink display.

I’ve also submitted a pull request, because a small change toOpenframe’s controller code was required to do so.