It is currently 28 Jun 2017, 13:18



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

CasparCG Server, Client and development

Moderators: Macey, Jonas Hummelstrand, didikunz

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

Postby mcdikki » 08 Aug 2013, 00:03

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
viewtopic.php?f=3&t=1623&p=10876#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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby Jonas Hummelstrand » 08 Aug 2013, 00:09

Thanks!
Jonas Hummelstrand
Independent Consultant at SuperFly.tv
Former Community Manager for CasparCG

Problems? Guide to posting Bug reports & Feature requests
User avatar
Jonas Hummelstrand
 
Posts: 2538
Joined: 21 Apr 2009, 08:07
Location: Stockholm, Sweden

Re: New CasparCGNETConnector released [ALPHA]

Postby duron23 » 08 Aug 2013, 08:56

Thanks buddy
Regards,
Duron23
duron23
 
Posts: 33
Joined: 22 Apr 2013, 22:29
Location: Bangalore, India

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 08 Aug 2013, 16:04

Hi,

I updated the release to alpha1 which includes
- a working example project to show the usage of the library
- a lot of bugfixes
- some handy new features for getting media information

See https://github.com/mcdikki/CasparCGNetC ... .1.1alpha1

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby duron23 » 26 Aug 2013, 20:57

Hi mcdikki,

I tried using you CasparCGNETConnector, but it has dependency on your netlogger, I added netlogger, but my project failed to get the path of netlogger.
Regards,
Duron23
duron23
 
Posts: 33
Joined: 22 Apr 2013, 22:29
Location: Bangalore, India

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 26 Aug 2013, 21:26

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 26 Aug 2013, 22:03

Ok, I added a new release alpha3. Please try if it fixed the problem.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby duron23 » 30 Aug 2013, 15:03

Thanks, I will try it tonight and update.
Regards,
Duron23
duron23
 
Posts: 33
Joined: 22 Apr 2013, 22:29
Location: Bangalore, India

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 31 Aug 2013, 00:11

Ok, good luck.

Please tell me how it goes.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 07 Sep 2013, 03:04

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 26 Nov 2013, 18:33

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 23 Mar 2014, 14:13

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby Jonas Hummelstrand » 23 Mar 2014, 15:33

Great, thanks!
Jonas Hummelstrand
Independent Consultant at SuperFly.tv
Former Community Manager for CasparCG

Problems? Guide to posting Bug reports & Feature requests
User avatar
Jonas Hummelstrand
 
Posts: 2538
Joined: 21 Apr 2009, 08:07
Location: Stockholm, Sweden

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 28 Mar 2014, 15:32

I forgot to add a fix to the package.
So please redownload the packages.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby duron23 » 09 Dec 2014, 23:13

mcdikki, are you still developing this framework ??
Regards,
Duron23
duron23
 
Posts: 33
Joined: 22 Apr 2013, 22:29
Location: Bangalore, India

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 10 Dec 2014, 00:11

Sure.
There are some new features in the current development tree ;-)
Like a failover connection per example.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby duron23 » 13 Dec 2014, 11:14

mcdikki wrote:Sure.
There are some new features in the current development tree ;-)
Like a failover connection per example.

cheers
mcdikki


Cool.

Failover Connection, sounds interesting.
Regards,
Duron23
duron23
 
Posts: 33
Joined: 22 Apr 2013, 22:29
Location: Bangalore, India

Re: New CasparCGNETConnector released [ALPHA]

Postby leonedo » 08 Jan 2015, 15:27

Hi mcdikki, great work! thanks for sharing... I have a question.. how do i add the text fields key and values to a templateobject? or do I have to create the XML mysefl?
User avatar
leonedo
 
Posts: 35
Joined: 07 Mar 2013, 16:49
Location: Caracas - Venezuela

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 11 Jan 2015, 13:39

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

Re: New CasparCGNETConnector released [ALPHA]

Postby leonedo » 12 Jan 2015, 18:15

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!
User avatar
leonedo
 
Posts: 35
Joined: 07 Mar 2013, 16:49
Location: Caracas - Venezuela

Re: New CasparCGNETConnector released [ALPHA]

Postby mcdikki » 20 Jan 2015, 15:31

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 28 Jan 2015, 16: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");
        }
    }
}
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby didikunz » 28 Jan 2015, 16:26

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
User avatar
didikunz
 
Posts: 3480
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

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

Postby Joep » 28 Jan 2015, 16:30

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.
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 00:16

Hi.

This is a little less information.
I'm not good at C#, but the code looks ok so far.

Are you sure the connection is online?
Does is throw any exception?
Can you check the value of response.getCode() and response.getServerMessage()? (Not inside the if clause, just after the sendCommand.

Thanks,
Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 12:03

Hi McDikki,

This is the response:
Code: Select all
Responded Data: UNKNOWN_RETURNCODE
Responded Data: 000 NOT_CONNECTED_ERROR


Strange thing is in the same code I have a button which sends also a AMCP command and then the connection is not broken.
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 12:23

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 12:44

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?
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 12:54

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 13:00

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
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 13:07

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 13:23

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"?
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 13:29

I'm pretty sure the problem is the <undefined /> message. This may lead to an error in the sendCommand function.
I will check that later and come back to you.

Now I gonna go.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 13:33

Many thanks!!
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 29 Jan 2015, 16:31

Hi,

ok, found the problem.
Let me correct it and do some tests, then I'll release a fix.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 29 Jan 2015, 17:50

Yeah, sounds good!
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby mcdikki » 31 Jan 2015, 03:11

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Joep » 04 Feb 2015, 14:58

Thanks! Works like a charm.
Joep
 
Posts: 26
Joined: 11 Dec 2012, 18:23

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

Postby Rom1 » 21 May 2015, 20:49

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.
User avatar
Rom1
 
Posts: 35
Joined: 21 May 2015, 19:00

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

Postby mcdikki » 22 May 2015, 01:56

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby imorrish » 27 Jun 2015, 00:18

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.
User avatar
imorrish
 
Posts: 28
Joined: 27 Jan 2015, 07:12
Location: New Zealand

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

Postby mcdikki » 27 Jun 2015, 18:24

Cool! I did not know this is possible.
Thanks for sharing!

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Rom1 » 10 Aug 2015, 10:52

Hi MCDikki,

Thanks for your tips.
I will start to develop my playout client like a all in box. I want to play a schedule playlist, but before to begin do you know if we can play file with accuracy. I didn't see any schedule command in AMCP protocol lile "PLAY 1-1 AMB @10:20:015". Do you try to do this in your playout client ?

Regards.
User avatar
Rom1
 
Posts: 35
Joined: 21 May 2015, 19:00

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

Postby mcdikki » 10 Aug 2015, 11:04

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Rom1 » 14 Aug 2015, 21:13

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.
User avatar
Rom1
 
Posts: 35
Joined: 21 May 2015, 19:00

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

Postby mcdikki » 14 Aug 2015, 23:35

Thats not a bug, it's a feature :-)

Thats the way to detect if the connection is still valid.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby imorrish » 09 Feb 2016, 05:25

Trying to figure out best way to add a Decklink Producer. It is not a valid "Media" type in the connector lib and I can't see any other mention of Decklink except for the Consumer option.
Just using sendCommand with a string builder at the moment. Any ideas on how it could be added (or pointer to what I'm missing)?
User avatar
imorrish
 
Posts: 28
Joined: 27 Jan 2015, 07:12
Location: New Zealand

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

Postby mcdikki » 09 Feb 2016, 11:51

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby imorrish » 22 Feb 2016, 22:11

That would be awesome mcdikki.
I've been doing a lot more testing with PowerShell and it is able to do everything I want.
Will add more functionality as I go.
This example get the thumbnail for a media file and displays it in a dialog.
Image
Will be adding lots more sample scripts to the project https://github.com/imorrish/GasparCG-PowerShell/tree/master/Samples
User avatar
imorrish
 
Posts: 28
Joined: 27 Jan 2015, 07:12
Location: New Zealand

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

Postby mcdikki » 23 Feb 2016, 02:48

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
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Rom1 » 20 Mar 2016, 13:25

Hi mcdikki,

Did you try to implement OSC protocol ?

Regards.
User avatar
Rom1
 
Posts: 35
Joined: 21 May 2015, 19:00

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

Postby mcdikki » 20 Mar 2016, 14:13

Hi Rom,

no, not yet.
It's planed for the next major release (no due date). But I won't implement it, I will use an external lib for that and offer ccg releated OSC functions.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby giliet » 05 May 2016, 08:50

Hi,

Some time ago I decided to go with CasparCGNETConnector and it is a big help in application development I am doing.

Yesterday I hit a problem related to national characters display in CasparCG templates. They are just skipped. Is there support for UTF-8 data ? Or maybe any other way to solve this problem ?
giliet
 
Posts: 5
Joined: 18 Mar 2016, 09:16

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

Postby mcdikki » 05 May 2016, 23:06

The lib should do UTF-8 per default.

Could you share the template and some data producing this problem?
That would help me to determine the source of the problem.

cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby giliet » 06 May 2016, 09:34

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)
giliet
 
Posts: 5
Joined: 18 Mar 2016, 09:16

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

Postby mcdikki » 06 May 2016, 09:52

Hi,

glad you found the error.

The lib was developed when ccg was windows only, so I did not implement unix style path separators.
I will add it to the next release.

If you find other thinks to be corrected or enhanced, you are welcome to fork the lib on github and open merge requests with your changes.

Cheers
mcdikki
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby Rom1 » 31 Jan 2017, 17:37

Hi mcdikki,

I'm making a Web Api with your .net connector.
I have some difficulties to work with the CallCommand. Did you try it ?
For example I want to make

Code: Select all
CALL 1-1 LENGTH 250


Regards.
User avatar
Rom1
 
Posts: 35
Joined: 21 May 2015, 19:00

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

Postby mcdikki » 02 Feb 2017, 12:53

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
sublan.tv - Wir teilen Begeisterung
User avatar
mcdikki
 
Posts: 1059
Joined: 11 Dec 2012, 15:48
Location: Germany

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

Postby didikunz » 02 Feb 2017, 13:06

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.1_AMCP_Protocol#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
User avatar
didikunz
 
Posts: 3480
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland


Return to Tech and Development

Who is online

Users browsing this forum: Bing [Bot] and 3 guests