# Scheduled Player Plugin

**URL:** <https://community.info-beamer.com/t/scheduled-player-plugin/958>\
**Category:** Help\
**Created:** [October 8, 2020, 4:23pm UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958 "2020-10-08T16:23:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michel](https://community.info-beamer.com/letter_avatar_proxy/v3/letter/m/ea666f/32.png) [@michel](https://community.info-beamer.com/u/michel)\
**Post date:** [October 8, 2020, 4:23pm UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958/1 "2020-10-08T16:23:29Z")

</div>

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 !

---

<div class="post-metadata">

**Author:** ![infobeamer-fw](https://community.info-beamer.com/user_avatar/community.info-beamer.com/infobeamer-fw/32/3_2.png) [@infobeamer-fw](https://community.info-beamer.com/u/infobeamer-fw)\
**Post date:** [October 9, 2020, 2:27pm UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958/2 "2020-10-09T14:27:10Z")

</div>

> [@michel](#):
>
> […] how I read the variables of these two places(node.json […]

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:

```auto
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`](https://github.com/info-beamer/package-scheduled-player/blob/a5fbda734579af68180edcd2509dcec1f64fa616/loader.lua#L47-L56) used by the top-level “Scheduled Player” code.

> [@michel](#):
>
> […] and tile.js)

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

```auto
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):

```auto
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

```plaintext
*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.

---

<div class="post-metadata">

**Author:** ![michel](https://community.info-beamer.com/letter_avatar_proxy/v3/letter/m/ea666f/32.png) [@michel](https://community.info-beamer.com/u/michel)\
**Post date:** [October 9, 2020, 3:34pm UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958/3 "2020-10-09T15:34:40Z")

</div>

Hi thanks

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

* * *

`service`

```auto
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`

```auto
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?

---

<div class="post-metadata">

**Author:** ![michel](https://community.info-beamer.com/letter_avatar_proxy/v3/letter/m/ea666f/32.png) [@michel](https://community.info-beamer.com/u/michel)\
**Post date:** [October 15, 2020, 12:08am UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958/4 "2020-10-15T00:08:29Z")

</div>

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

 ![image](https://community.info-beamer.com/uploads/default/original/1X/4469703d8198a25192fa2cb02976b32ba9ce09ca.jpeg)

Thanks !

---

<div class="post-metadata">

**Author:** ![infobeamer-fw](https://community.info-beamer.com/user_avatar/community.info-beamer.com/infobeamer-fw/32/3_2.png) [@infobeamer-fw](https://community.info-beamer.com/u/infobeamer-fw)\
**Post date:** [October 16, 2020, 10:21am UTC](https://community.info-beamer.com/t/scheduled-player-plugin/958/5 "2020-10-16T10:21:55Z")

</div>

> [@michel](#):
>
> 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?

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