info-beamer

Scheduled Player Plugin

I have a query that surely is easy for you …

I come across the following scenario …

I am using the “package-scheduled-player” as the basis for playing my lists.

What I want to do is program a “plugin” that allows me to fire certain commands through the services

I have made the plugin, with the menu and options that I need, etc.

This plugin has a general menu in its configuration (node.json), and then when I insert it in each content, it has another menu (tile.js) where particular options are configured for each one.

What I need in principle if you can help me is to see how I read the variables of these two places (node.json and tile.js) in the file (tile.lua) and how I send this to the file (services) as a parameter and if I can from the (tile.lua) execute a function inside the (services)

It is understood ?

Thank you so much !

The result of configuration made in the UI defined within node.json end up in the config.json generated within the same directory. So if you add your packages within the path plugin, you’ll see a /space/root/plugin/config.json generated on the device. You can access this files within your tile.lua using:

function M.updated_config_json(config)
    pp(config)
    -- example for loading a configured font:
    font = resource.load_font(api.localized(config.font.asset_name))
end 

The updated_config_json is automatically called by code within loader.lua used by the top-level “Scheduled Player” code.

Their configuration ends up being given to you in the M.task function that gets called while the tile is on the screen:

function M.task(starts, ends, config, x1, y1, x2, y2)
   -- config contains the per-tile configuration set by tile.js  
   for now in api.frame_between(starts, ends) do
      -- do something for each frame
    end
end

For calling between your Lua code and code in a background service you can use the following to send data to any connected tcp client (more on that in a second):

api.tcp_clients.send(PATH, json.encode{
   foo = "bar"
})

Then connect to info-beamer from within your service using TCP to 127.0.0.1:4444. Send the line

*raw/<path>

with path being the value you get within the NODE environment variable. Once you send this line, you will receive the JSON submitted from Lua if you read line-by-line from the connected socket.

Hi thanks

I have tried to follow your directions and have used the browser plugin as a guide …


service

from ibquery import InfoBeamerQuery

def main():
    ib = InfoBeamerQuery("127.0.0.1")
    con = ib.node('root/browser').io(raw=True)
    for line in con:
        request = json.loads(line)
        ps2 = request['ps2']

tile.lua

function M.task(starts, ends, config, x1, y1, x2, y2)
    api.tcp_clients.send(PATH, json.encode {
        ps2 = "hello"
    })

When I insert the code in the service after that the process hangs and the rest of the code stops working.

if I comment on this section and keep the rest of the code as it was it works …

Any idea where to look?

Hello Florian … your days of silence allowed me to advance a lot with the plugin that I was needing for my implementation and it is already working …

Now I am in the process of polishing it and leaving it with the proper settings to be able to use it in production.

I have some queries that I would like to know if they are possible to program / configure …

When you insert the plugin into a specific content, it normally appears the size (width x height) of the full frame of this content, you can make it so that when it is inserted it is already by default, eg. 300x300 pixels in a specific part of the screen? … I am not referring to the content rendered within the plugin, but to how it looks in the “Scheduled Player” configuration screen

Thanks !

Not at the moment. That’s not a property specified anywhere. But it does sound useful. I can look into that.

1 Like
info-beamer - Digital Signage for the Raspberry Pi community forum - Imprint