[Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#1
Hello everybody,

UPDATED: alpha1 released
- Added a working example project
- Fixed a lot of bugs
- Added some handy new features for getting media information
https://github.com/mcdikki/CasparCGNetC ... .1.1alpha1

UPDATED: alpha4 released
http://casparcg.com/forum/viewtopic.php ... 876#p10876

UPDATED: alpha5 released
https://github.com/mcdikki/CasparCGNetC ... .1.1alpha4

UPDATED: alpha6 released
https://github.com/mcdikki/CasparCGNetC ... .1.1alpha6

UPDATED: 0.1.2 alpha release
https://github.com/mcdikki/CasparCGNetC ... 0.1.2alpha

UPDATED: QuickFix 0.1.2 alpha 1
https://github.com/mcdikki/CasparCGNetC ... .1.2alpha1


I just release the very first alpha version of my CasparCGNetConnector,
a DotNet library for duplex communication with CasparCG.

Here's the Feature part of the github readme:

Code: Select all

This connector framework was written for CasparsPlayoutClient and offers the follwing features:

    * easy connection
    * duplex communication with the CasparCG Server
    * built in CasparCG Server command classes
        * with version control
        * easy runtime exploreation of commands and their paramters - perfect for UI building
        * command and parameter discribtions
    * ready to use media objects for OO usage
    * plaintext command sending
See the github page for more information: https://github.com/mcdikki/CasparCGNetConnector

This is a alpha release and needs a lot of testing. Please don't use it for any productive propose.

I would be very happy if you could test it and tell me what you think about it.
I haven't done extensive unit testing, so there may be some more bugs. Please report them back to me.

Thanks!


I have started implementing this library while implementing my CasparsPlayoutClient. Actually, I planed to use the svt net library, but it doesn't support receiving data form the server, so started to implement my own classes and lately decided to publish them as own project.
I hope it is of use for others, too.

cheers
mcdikki
Last edited by mcdikki on 23 Mar 2014, 14:14, edited 6 times in total.
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#6
Hm,

I never tried it on an other pc than mine.

Try the following:

Remove the netlogger dependency from the project settings and readd it as dll, not project.
The dll should be in the bin/debug folder of the project.

I'll try to fix the project settings and push a new release.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#10
There is a new release available
https://github.com/mcdikki/CasparCGNetC ... .1.1alpha3

It has some critical bugfixes in sending / receiving.
It also introduces connected / disconnected events allowing you to monitor the connection status much better.

This time I also provided a compiled binary package, so you don't need to use the whole project.

I recommend to update older versions.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#11
Hey everybody,

I added some more documentation to the project to make it easier to use.

See the wiki:
https://github.com/mcdikki/CasparCGNetConnector/wiki
and the example project:
https://github.com/mcdikki/CasparCGNetC ... Example.vb

I try to add more and more to the Wiki by the time.
If somebody is willing to help, I would be really thankful and happy.

The number of people using the lib is increasing and I think it would really boost the usage if more good documentations is available.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#12
Hi,

a new build has been released:
https://github.com/mcdikki/CasparCGNetC ... .1.1alpha6

It does some bugfixes and adds named getter/setter for parameters to all command classes so that using them is even more easy.

Example:

Code: Select all

Dim play as new PlayCommand()
play.setMedia("amb")
name = play.getMedia() 
instead of

Code: Select all

Dim play as new PlayCommand()
DirectCast(getCommandParameter("media"), CommandParameter(Of String)).setValue("amb")
name = DirectCast(getCommandParameter("media"), CommandParameter(Of String)).getValue()
This keeps the flexibility for automated usage, but gives much more comfort for the hard coded usage.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#19
Hi leonedo,

there should be a function to set the data.
But to be honest, this part of the lib is not fully functional at this moment and not tested yet.
A quick look showed some Bugs in this part, so at the moment, I can't recommend to use the template object at all :-(

But now that I know that you want to use it, I will fix this quickly and come back to you.

Thanks for using the lib.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: New CasparCGNETConnector released [ALPHA]

#20
Thanks! i really like your library, im using it to do a few things in my project, i mostly use the official one.

a few things that i have found.. (not making any complains or demands :) just saying ) i can't get the get path function tu work.. I do get the path from the infos list but some under "location" tag (image producer) and others with the "filename" tag (ffmpeg-producer).

I know its a Casparcg thing but i wound be great to have a get full path function not a relative one. or always a relative one. but not the mix.. i know thats a server thing.. :)

I really like your library, mostly because of its easy to way com implementation! thanks and great work!

Re: New CasparCGNETConnector released [ALPHA]

#21
Hi All,

today I released the new v0.1.2 Alpha of the CasparCGNetConnector library.
https://github.com/mcdikki/CasparCGNetC ... 0.1.2alpha

This is a big release and I highly recommend to update your projects to this one.

Changelog
- Added new Commands introduced with CasparCG Server 2.0.7
- Added UnitTests for all CommandClasses verifying that they work as expected
- Changed all Xml from the old MSXML6.0 libs to the new System.Xml of the NET libs
- Changed NET Framework to 4.5
- Changed the way CasparCGConnection is used by introducing the ICasparCGConnection Interface which allows to use other connection types like a FailoverConnection (under development).
- Fixed hundreds of Bugs, mainly typos
- Changed MediaObjects to provide their data via properties and not via getters/setters
- Made the template / templateData objects production ready
- Hardened the code of the command classes against errors by throwing more sensible exceptions


How to use the new Stuff
1. MediaObjects:

The properties of the CasparCGMedia objects are accessible via properties now.
The getter/setter methods have been removed.

Old

Code: Select all

Dim media as CasparCGMovie("amb")
Dim name = media.getName()
media.setName("New Name")
New

Code: Select all

Dim media as CasparCGMovie("amb")
Dim name = media.Name
media.Name = "New Name"

2. TemplateObject and TemplateData:

As from now, you can make use of the templateData object to work with flash templates having data in the standard CasparCgComponent way.
This means the flashtemplate contains components which are registered via registerComponent.
See http://casparcg.com/wiki/Content_/_Medi ... rator_Does for more infos.

To use this built in data function, it is necessary to obtain the template infos from the ccg server.

Code: Select all

...
Dim template as new CasparCGTemplate("simpletemplate2")
template.fillMediaInfo(connection)
Now, the template knows of the Components and their instances and you can set this data.
The used SIMPLETEMPLATE2 (shipped with the template pack in ccg) has 2 instances of the CasparTextfield component named f0 and f1.
The get the known fields (instances), use the getData method of the template

Code: Select all

for each instance in template.getData().getInstances()
    console.writeln("Field " & instance.getName() & " found.")
next
Each instance contains modifiable properties.
In case of the normal CasparTextField, this is only the property "text".
But you may register other Components that allows the use of other properties like color or so.
The get the useable properties, you can do this

Code: Select all

Dim instance = template.getData().getInstance("f0")
for each property in instance.getProperties
    console.writeln("Property " & property.Name & " of type " & property.Type & " and value " & property.Value & " found.")
next
Just set the value of the property.

Code: Select all

template.getData.getInstance("f0").getProperty("text").value = "New Value"
' or ...
If template.getData.getInstance("f0").setValue("text", "New Value") then
    ' everything ok
Else
    ' Error, no such property
End If
You can use the templateData object along with the CgUpdateCommand or retrieve the correct xml string used in AMCP commands like this

Code: Select all

' Template is running on channel 1, layer 1, flashlayer 1
Dim update as new CgUpdateCommand(1,1, template.getData, 1)
' or use the string
Console.writeln("Sending new data to template: " & template.getDataString)
update = new CgUpdateCommand(1,1,template.getDataString,1)
There are several other useful methods like .hasData, containsInstance etc.
Check it out.


3. ICasparCGConnection Interface:

Just change the type of your variables and function parameters form CasparCGConnection to ICasparCGConnection.
The interface is exactly the same, but you can use other types of connections later if you want.
At this point, nothing changed as there is only the well known CasparCGConnection implementation of the ICasparCGConnection Interface, but I'm gooing to release a FailoverConnection later and maybe some other types.


Thats it. Hope you like it.
Please let me know of Bugs, improvements etc.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#22
Hi mcdikki,

Many thanks for your code!

I'm trying to use it in a C# client but having some issues.

Code: Select all

ICasparCGConnection con = new ICasparCGConnection(this.textBoxIpAdres.Text, 5250);

shows me an error "Cannot create an instance of the abstract class or interface 'CasparCGNETConnector.ICasparCGConnection'
if I can't use ICasparCGConnection I also can't use

Code: Select all

            CgInvokeCommand cmd = new CgInvokeCommand(1, 20, 1, "TwitterIn");
            cmd.execute(cmd);
because execute() expects a ICasparCGConnection.

using

Code: Select all

con.sendCommand("CG 1-20 INVOKE 1 TwitterIn");
evertything works but the connection is dropped. I can't get a respond so I don't know if I'm doing anything wrong. Can you help? I will paste the whole code here:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CasparCGNETConnector;
using logger;

// https://github.com/mcdikki/CasparCGNetConnector/wiki/Overview
namespace TwitterNieuwsClient
{
    public partial class Form1 : Form
    {
        bool connected = false;
        bool twitter_onair = false;
        CasparCGConnection con;

        public Form1()
        {
            InitializeComponent();
        }

        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (connected == false)
            {
                con = new CasparCGConnection(this.textBoxIpAdres.Text, 5250);
                con.connected += new ICasparCGConnection.connectedEventHandler(onConnect);
                con.disconnected += new ICasparCGConnection.disconnectedEventHandler(onDisconnect);
                try
                {
                    con.connect();
                }
                catch
                {
                    MessageBox.Show("Something went wrong while connecting to the server");
                }
            }
            else
            {
                try
                {
                    con.close();
                }
                catch
                {
                    MessageBox.Show("Something went wrong while disconnecting from the server");
                }
            }
        }


        void onDisconnect(ref object sender) {
            this.buttonConnect.Text = "CONNECT";
            this.buttonConnect.BackColor = Color.Chartreuse;

            connected = false;
        }

        void onConnect(ref object sender) {
            this.buttonConnect.Text = "DISCONNECT";
            this.buttonConnect.BackColor = Color.Red;

            connected = true;
        }

        private void buttonTotaal_Click(object sender, EventArgs e)
        {
            if (twitter_onair == false)
            {
                con.sendCommand("CG 1-20 ADD 1 \"TWITTERBALK\" 1");
                twitter_onair = true;
            }
            else
            {
                con.sendCommand("CG 1-20 STOP 1");
                twitter_onair = false;
            }
        }

        private void buttonTwitterAan_Click(object sender, EventArgs e)
        {
            //con.sendCommand("CG 1-20 INVOKE 1 TwitterbalkIn");
            //CgInvokeCommand cmd = new CgInvokeCommand(1, 20, 1, "TwitterbalkIn");
            //cmd.execute(cmd);


            CasparCGResponse response = con.sendCommand("CG 1-20 INVOKE 1 TwitterbalkIn");
            if (response.isOK())
            {
                MessageBox.Show("OK");
                this.textBox1.Text = "Responded Data: " + response.getData();
                this.textBox1.Text = "Responded XML Data: " + response.getXMLData();
            }
            else if (response.isERR())
            {
                MessageBox.Show("ERROR");
                this.textBox1.Text = "Error executing command: " + response.getCommand() + ": " + response.getServerMessage();
            }
        }

        private void buttonTwitterUit_Click(object sender, EventArgs e)
        {
            con.sendCommand("CG 1-20 INVOKE 1 TwitterbalkOut");
        }
    }
}

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#23
Joep wrote:I'm trying to use it in a C# client but having some issues.

Code: Select all
ICasparCGConnection con = new ICasparCGConnection(this.textBoxIpAdres.Text, 5250);

shows me an error "Cannot create an instance of the abstract class or interface 'CasparCGNETConnector.ICasparCGConnection'
There must be a concrete class also, probably called "CasparCGConnection" or something similar, that implements the interface. You can never create an object of an interface, you need a class for it. But you can assign a class, witch implements the interface, to a property that expect an interface.

This is basic object oriented programming.
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#24
Hi didi,
Thanks for the quick reply.

I'm using:

Code: Select all

con = new CasparCGConnection(this.textBoxIpAdres.Text, 5250);
con.connected += new ICasparCGConnection.connectedEventHandler(onConnect);
con.disconnected += new ICasparCGConnection.disconnectedEventHandler(onDisconnect);
This works but after sending:

Code: Select all

CasparCGResponse response = con.sendCommand("CG 1-20 INVOKE 1 TwitterbalkIn");
            if (response.isOK())
            {
                MessageBox.Show("OK");
                this.textBox1.Text = "Responded Data: " + response.getData();
                this.textBox1.Text = "Responded XML Data: " + response.getXMLData();
            }
            else if (response.isERR())
            {
                MessageBox.Show("ERROR");
                this.textBox1.Text = "Error executing command: " + response.getCommand() + ": " + response.getServerMessage();
            }
The connection is dropped and I get no feedback. No MessageBox and nothing in Textbox1.

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#27
So he thinks that your not connected.
This can have two reasons.
1. You are not connected (wonder ;-) )
2. The connection breaks while the command is send. That can be caused i.e. by a timeout.

Please add something like this to check:

Code: Select all

if (con.isConnected) {
    // send command
} else {
    //Print error
}
If it gets disconnected while sending, it should raise the disconnected event.
So, I don't think it does.


cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#28
I added the code:

- First time no error printed and the method in the actionscript is invoked
- After that I see the disconnected event is raised because I see the connect-button changes to green
- When I try to trigger the invoke again the error is printed.

So I think the connection is dropped after sending the INVOKE command. I do the whole procedure in under 5 seconds so I don't think it's timed out?

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#29
Default Timeout is 3s, so that can be the problem.

There are two things we can tweak.
1. Change the timeout to a higher value

Code: Select all

con.timeout = 5000 //5000ms = 5s
and see if it still happens.
2. Change the default behavior at timeouts. Default is to close the connection if a timeout appears as this normally means something is wrong and the user should handle that.
But you can set it to ignore timeouts. This will let your command fail, but keeps the connection online.

Code: Select all

con.disconnectOnTimeout = false
This may be critical, as you should not get timeouts at all. How long does the invoke command take if you run it from the console or a telnet connection?

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#30
Yes!

Code: Select all

con.disconnectOnTimeout = false
Works. There is still a unknown returncode but the connection stays online. I looked in the logs and see a different returncode returned by CasparCG server:

Code: Select all

Sent message to 172.16.8.20: 201 CG OK\r\n<undefined/>\r\n
While this returncode is different when I add the template:

Code: Select all

Sent message to 172.16.8.20: 202 CG OK\r\n

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#31
Could you please post the command received by ccg for these log lines, too.
Maybe there is some error.

The "undefined" seems a little odd to me.

By the way, I recommend to use the CommandClasses shipped with this library and not to use plaintext commands as you do.
This keeps you from adding typos into command names and does all the esacaping for you.

That reminds me that you may need to escape the method parameter for the CG INVOKE command.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 20/1/15] CasparCGNETConnector released [ALPHA]

#32
Hi mcdikki,

The log:

Code: Select all

[2015-01-29 12:53:03.169] [094E0390] [info]    Accepted connection from 172.16.8.20 3
[2015-01-29 12:53:03.175] [094E0390] [info]    Received message from 172.16.8.20: VERSION SERVER\r\n
[2015-01-29 12:53:03.175] [046ADDA0] [debug]   Executed command: VersionCommand
[2015-01-29 12:53:03.175] [046ADDA0] [info]    Sent message to 172.16.8.20: 201 VERSION OK\r\n2.0.6.fb579b2 Stable\r\n
[2015-01-29 12:53:03.180] [094E0390] [info]    Received message from 172.16.8.20: INFO\r\n
[2015-01-29 12:53:03.180] [046ADDA0] [debug]   Executed command: InfoCommand
[2015-01-29 12:53:03.180] [046ADDA0] [info]    Sent message to 172.16.8.20: 200 INFO OK\r\n1 1080i5000 PLAYING\r\n\r\n
[2015-01-29 12:53:04.210] [094E0390] [info]    Received message from 172.16.8.20: CG 1-1 ADD 20 "TWITTERBALK" 1\r\n
[2015-01-29 12:53:04.210] [046ADDD0] [info]    flash[cg20.fth.1080i5000|5000] Invoking add-command: <invoke name="Add" returntype="xml"><arguments><number>20</number><string>TWITTERBALK.ft</string><true/><string></string><string><![CDATA[]]></string></arguments></invoke>
[2015-01-29 12:53:04.210] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [command]      <invoke name="OnCommand" returntype="xml"><arguments><string>Command recieved @Add@20@</string></arguments></invoke>
[2015-01-29 12:53:04.211] [046ADDD0] [debug]   Executed command: CGCommand
[2015-01-29 12:53:04.211] [046ADDD0] [info]    Sent message to 172.16.8.20: 202 CG OK\r\n
[2015-01-29 12:53:04.252] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [activity]     <invoke name="OnActivity" returntype="xml"><arguments><string>Command finished @Add@20@</string></arguments></invoke>
[2015-01-29 12:53:04.253] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [activity]     <invoke name="OnActivity" returntype="xml"><arguments><string>Command finished @RemoveTemplate@20@</string></arguments></invoke>
[2015-01-29 12:53:04.305] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [activity]     <invoke name="OnActivity" returntype="xml"><arguments><string>Command finished @Play@20@</string></arguments></invoke>
[2015-01-29 12:53:04.752] [094E0390] [info]    Received message from 172.16.8.25: INFO 1\r\n
[2015-01-29 12:53:04.788] [046ADDA0] [debug]   Executed command: InfoCommand
[2015-01-29 12:53:04.788] [046ADDA0] [info]    Sent more than 512 bytes to 172.16.8.25
[2015-01-29 12:53:07.768] [094E0390] [info]    Received message from 172.16.8.25: INFO 1\r\n
[2015-01-29 12:53:07.788] [046ADDA0] [debug]   Executed command: InfoCommand
[2015-01-29 12:53:07.788] [046ADDA0] [info]    Sent more than 512 bytes to 172.16.8.25
[2015-01-29 12:53:09.576] [094E0390] [info]    Received message from 172.16.8.20: CG 1-1 INVOKE 20 "TwitterbalkIn"\r\n
[2015-01-29 12:53:09.576] [046ADDD0] [info]    flash[cg20.fth.1080i5000|5000] Invoking invoke-command: <invoke name="Invoke" returntype="xml"><arguments><array><property id="0"><number>20</number></property></array><string>TwitterbalkIn</string></arguments></invoke>
[2015-01-29 12:53:09.576] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [command]      <invoke name="OnCommand" returntype="xml"><arguments><string>Command recieved @Invoke@20@</string></arguments></invoke>
[2015-01-29 12:53:09.577] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [activity]     <invoke name="OnActivity" returntype="xml"><arguments><string>Command finished @Invoke@20@</string></arguments></invoke>
[2015-01-29 12:53:09.577] [046ADDD0] [debug]   Executed command: CGCommand
[2015-01-29 12:53:09.577] [046ADDD0] [info]    Sent message to 172.16.8.20: 201 CG OK\r\n<undefined/>\r\n
[2015-01-29 12:53:10.774] [094E0390] [info]    Received message from 172.16.8.25: INFO 1\r\n
[2015-01-29 12:53:10.788] [046ADDA0] [debug]   Executed command: InfoCommand
[2015-01-29 12:53:10.788] [046ADDA0] [info]    Sent more than 512 bytes to 172.16.8.25
[2015-01-29 12:53:13.781] [094E0390] [info]    Received message from 172.16.8.25: INFO 1\r\n
[2015-01-29 12:53:13.787] [046ADDA0] [debug]   Executed command: InfoCommand
[2015-01-29 12:53:13.787] [046ADDA0] [info]    Sent more than 512 bytes to 172.16.8.25
[2015-01-29 12:53:16.096] [094E0390] [info]    Received message from 172.16.8.20: CG 1-1 INVOKE 20 "TwitterbalkOut"\r\n
[2015-01-29 12:53:16.097] [046ADDD0] [info]    flash[cg20.fth.1080i5000|5000] Invoking invoke-command: <invoke name="Invoke" returntype="xml"><arguments><array><property id="0"><number>20</number></property></array><string>TwitterbalkOut</string></arguments></invoke>
[2015-01-29 12:53:16.097] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [command]      <invoke name="OnCommand" returntype="xml"><arguments><string>Command recieved @Invoke@20@</string></arguments></invoke>
[2015-01-29 12:53:16.097] [046ADE90] [debug]   flash-player[cg20.fth.1080i5000|1920x1080] [activity]     <invoke name="OnActivity" returntype="xml"><arguments><string>Command finished @Invoke@20@</string></arguments></invoke>
[2015-01-29 12:53:16.098] [046ADDD0] [debug]   Executed command: CGCommand
[2015-01-29 12:53:16.098] [046ADDD0] [info]    Sent message to 172.16.8.20: 201 CG OK\r\n<undefined/>\r\n
When I try to use the commands this is the code:

Code: Select all

            CgInvokeCommand cmd = new CgInvokeCommand(1, 20, 1, "TwitterbalkIn");
           cmd.execute(con);
I get an error:

Code: Select all

Error	1	The best overloaded method match for 'CasparCGNETConnector.AbstractCommand.execute(ref CasparCGNETConnector.ICasparCGConnection)' has some invalid arguments
I think becasue the connection is a "CasparCGConnection"?

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#37
Hi everybody,

there is a new QuickFix release that fixes two serious bugs introduced with v0.1.2alpha.
Please update to v0.1.2alpha1!

https://github.com/mcdikki/CasparCGNetC ... .1.2alpha1

- Due to a missing change of parameter types from CasparCGConnection to ICasparCGConnection, the command classes where unable to execute.

- Some 201 server messages could not be parsed correctly leading to a timeout while sending the command.

Both has been fixed in 0.1.2alpha1.

There also is a slightly change in the way CasparCGConnection.sendCommand and AbstractCommand.execute reacting to timeouts and unconnected connections.
Now, instead of informing the user inside the CasparCGResponse, they will throw an Exception that should be catched by the caller.

Thanks to Joep for reporting!

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#39
Hi,

Thanks for your work.
I just begin to use your Caspar Library. How do you list media file on Caspar ? I saw the CLS Method but do you have implement an other method that retrieve file and set automatically properties like Size, Framerate .... ?

Will you implement OSC Protocol in your Class to listen play, pause, and audio events ? I begin to implements OSC Protocols with bespoke library but informations are not accurate and not very signifiant. I would like to try with Caspar CG 2.1 but i didn't find an alpha build for windows.

Regards.

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#40
Hi Rom,

glad to hear you use the libs.

In the framework, you only have the cls,cinf and info command classes that will give you an xml or text representation inside the server response. You can easily parse them.

I would suggest to do the following:
1. Get the list of the media files from the server by sending a cls command
2. Parse all the media and create media objects like CasparCGMovie etc from it
3. Call the fillMediaInfo(connection) function on them so that they get all the metadata.

Have a look at the MediaLibrary I use in my client:
https://github.com/SublanTV/CasparsPlay ... ry.vb#L158

To your second question: Yes, I am planning to add OSC to the libs. But this will not happen in the next time soon!
So go with the OSC Bespoke libs. There are other libs, too. But for now, I'm using the bespoke libs in my client. Have a look at the MediaUpdater class if you are interested in how I use them.
But I will add an other lib than the bespoke ones to my framework.

Hope that helps.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#41
Just been playing with CasparCGNetConnector from PowerShell.
So simple.

add-type -path 'C:\Users\IAN\Documents\WindowsPowerShell\Modules\CasparCGAutomation\CasparCGNETConnector.dll'
$casparcg = new-object "CasparCGNETConnector.CasparCGConnection"
$casparcg.connect("127.0.0.1",5250)
$casparcg.sendCommand("play 1-1 ARISE_HeyO")
$casparcg.close()

Working on a script module that would make the PowerShell ISE client function the same as JustMacros. Have ATEM, HyperDeck and Midi IO working from PowerShell also.

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#44
CCG does not support a scheduled play. You need to handle this in your client.
Since there is a short delay between sending a AMCP command and CCG executing it, you won't get a 1 frame accuracy, but you can get close to it.

I'm doing this in my client and find it to be ok for scheduling. But it's to much for playing 2 items one ofter an other without a noticeable gap.
But you can get around that by using the loadbg command with auto.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#45
Thanks for your reply.

For information you have some issue on your CasparCGConnection class in the checkConnection() method.
"A non-blocking socket operation could not be completed immediately".

It's not a big issue, but I noticed that this error was trigger a lot as "A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll"

Regards.

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#48
Hi imorrish,

that's a good point.
Initially I meant to use the normal Play/Load/LoadBG command to play decklinks.

But this doesn't work well.

So the idea of a Decklink Command might be good and I thought about it but did not implement it yet.
At the moment, you will need to send a plaintext command for that :-( , at least this is the way I do it.

But I think I will add a

Code: Select all

playInputCommand(type {DECKLINK | BLUEFISH}, device, format) 

command or similar with the next release to handle this.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#50
Just a tip: In the lib, there are also media objects. You can use them to do a lot of cool stuff.

I can't give you a ps example, but a vb.net one:

Code: Select all

' The variable to save all relevant media informations
Dim media as new CasparCGMovie("amb")

' Get the information from the server
media.fillMediaInfos(connection)
media.fillThumbnail(connection)
Now you can access a lot of metadata and the thumbnail of the amb clip via the media variable:

Code: Select all

' The base64 coded thumbnail if any
media.Base64Thumbnail

' A Key - Value store of metadata
media.getInfos

Please don't expect the decklink commands to be implemented any soon. I'm quite busy and it has a low priority.
But it's on the list!
I guess you can expect it somewhere around april or may.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#55
mcdikki wrote:The lib should do UTF-8 per default.
Your answer let me to think that this could be a template problem which proved to be true. It was a font problem. Sorry for troubling you.

One more thing - path paramater does not accept unix style path separator "/"

Code: Select all

media = new CasparCGMovie(@"FOLDER/TEMPLATE");
This code generates exception at runtime.
Found bug in file AbstractCasparCGMedia.vb, function parsePath:

Code: Select all

        ElseIf nameWithPath.Contains("/") Then
            Return nameWithPath.Substring(Name.LastIndexOf("/") + 1)
Should be:

Code: Select all

        ElseIf nameWithPath.Contains("/") Then
            Return nameWithPath.Substring(nameWithPath.LastIndexOf("/") + 1)

Re: [Updated 31/1/15] CasparCGNETConnector released [ALPHA]

#59
mcdikki wrote:This doesn't look right to me. Shouldn't it be

Code: Select all

call 1-1 "LENGHT 250"
What kind of problems do you encounter using the call command and how do you use it in the lib?
That would help me to reproduce your problems.

cheers
mcdikki
It should work without the quotes: http://www.casparcg.com/wiki/CasparCG_2 ... tocol#CALL
Didi Kunz
CasparCG Client-Programmer, Template Maker & Live CG-Operator
Media Support, CH-5722 Gränichen, Switzerland http://mediasupport.ch/
Problems? Guide to posting Bug reports & Feature requests

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron