Template control application in Python

I’m a novice programmer :wink:
I’m writing a simple template control application in Python.
Everything works very well, only I have one problem.
How to check if the template started the animation, stopped the animation or finished the animation?
My application needs to know what state the server and template are in.
(I use amcp-pylib for connection to server)

I only receive responses of this type from the server:
<SuccessResponse(data=[''], code=202, code_description='CG')>

and no information about the current status of the template.
I’m testing my application with a template made in loopic (https://www.loopic.io)

Usually that is done by an operator seeing it. The AMCP protocol does not automatically give feedback about the status of the template. You can try with INFO commands using pooling, but that is only a workaround.

Why? If we understand your use case better, we could help you better.

I tried to use INFO. The information returned is not enough.

OK, I’ll try to explain step by step what my application does and what the problem is:

  1. Using the application, I upload the template with the CG_ADD… command
  2. I select a line of text to be sent in the interface
  3. (one press “IN/OUT” BUTTON in the interface) With the CG_UPDATE command I send the text and CG_PLAY start the animation. The animation starts with the uploaded text and stops after expanding .
  4. (one press of the “IN/OUT” BUTTON in the interface) Using the same CG_UPDATE and CG_PLAY sequences, I run the closing sequence of the animation (one press of the “IN/OUT” BUTTON in the interface).

In this case, everything is OK.

The problem is when the user changes the selected line of text between point 3 and 4. Then the animation will expand with one text and collapse with another. This is unacceptable.
Once I knew what status the animation was in I could use the CG_UPDATE and CG_PLAY comments once and CG_NEXT to close the animation and the text content would not change.

The way I handle scenarios like this is to design the template to be a html page that connects back to the control software over websockets. That way you can do whatever communication you desire, and bypass AMCP entirely.
With this flow it is often possible to design multiple templates into a single html page that you run once, and fully control over the websocket connection.

In your precise scenario, it shouldn’t be hard to make a copy of what was sent in step 3, so that when they click in/out in 4, you can reuse what was last sent instead of what is currently selected.

It was discussed/suggested to allow html templates to add to the INFO XML or possibly osc info, a while back, but noone has implemented it. It would be fairly straightforward to implement that if someone with C++ experience was willing to, or for it to be sponsored. But live sending data back over AMCP is a much larger task which will need some thought on design, architecture, and backwards compatibility.

In my case, it’s probably the easiest. I also thought about bypassing this problem at the html template level. Unfortunately, as I wrote, I am a novice programmer :wink:
For now, I’m using a template I made at https://www.loopic.io
I’ve already tried to copy the data from the entered text layer to another, but unfortunately I fail :sleepy:

I see two problems here: First it seems you use CG PLAY for brining in AND taking out the template. The normal workflow uses a CG STOP command to take the template out. The second problem lies in the way you do your steps. The normal workflow is like this:

  1. Select a line of text to be sent and use the CG ADD command to load the template. You also send the data to the template using this command. So you use only one CG ADD for template loading and data setting. You can also play the template by setting AutoPlay to true. In case of AutoPlay = false this is done with a button called “Load” or “Prepare”. In case of AutoPlay = true this is done with the “Play” or “Start” button (or what you want to call it).
  2. In case of AutoPlay = false you need a button to play the template using CG PLAY.
  3. When you want to get rid of the template to click on a button called “Stop” or “Out” etc. that sends the CG STOP command.

So dependent on your preference (read AutoPlay true or false) you end up with either 3 or 2 buttons: For AutoPlay = false: “Load”, “Play” and “Stop”, for AutoPlay = true only “Play” and “Stop”.

In this case you never send a CG UPDATE command, that can mess things up.

I sometimes add a separate button for CG UPDATE called “Update” or the like to intentionally change content. But that does not always make sense. In case of a lower third for instance it’s better to take it out, the moment you see the typo, correct it and bring it back in instead of changing it on the fly.

Privacy Policy   Terms of Service