Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of use with CG_ADD #7

Closed
miambe opened this issue Apr 30, 2021 · 2 comments
Closed

Example of use with CG_ADD #7

miambe opened this issue Apr 30, 2021 · 2 comments
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@miambe
Copy link

miambe commented Apr 30, 2021

I don't know what I miss but I'm unable to use the CG_ADD command.

I've tried:

response = client.send(CG_ADD("CG 1 ADD 0 COUNTDOWN 1"))

And I'm getting:

RuntimeError: Command functions do not accept any positional arguments.

Thanks for your help!

@dolejska-daniel dolejska-daniel self-assigned this Apr 30, 2021
@dolejska-daniel dolejska-daniel added good first issue Good for newcomers question Further information is requested labels Apr 30, 2021
@dolejska-daniel
Copy link
Owner

dolejska-daniel commented Apr 30, 2021

Hello, and thank you for your interest in this library!
The commands expect their parameters to be provided by keyword arguments. For example, with the CG_ADD command's syntax looking like this:

CG [video_channel:int]{-[layer:int]|-9999} ADD [cg_layer:int] [template:string] [play_on_load:0,1] {[data:string]}

This syntax description defines following variables:

  • video_channel
  • layer
  • cg_layer
  • template
  • play_on_load
  • data

These variables can then be assigned to using corresponding keyword arguments:

# for your given example "CG 1 ADD 0 COUNTDOWN 1"
command = CG_ADD(video_channel=1, cg_layer=0, template="COUNTDOWN", play_on_load=1)

After creating the command like that, you can send the command using client.send(command) as you have shown before. The program will create appropriate CasparCG command syntax on its own.

@miambe
Copy link
Author

miambe commented Apr 30, 2021

Thanks for your quick reply!
It works as expected.

@miambe miambe closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants