It is currently 22 Jun 2017, 19:23



A simple news PHP client relased... my first test!

CasparCG Server, Client and development

Moderators: Macey, Jonas Hummelstrand, didikunz

A simple news PHP client relased... my first test!

Postby andreone72 » 08 Jun 2012, 19:59

Hallo there!
Thanks to the help of many people from the community, I made a decent client in PHP with some interesting features.
In particular I want to thank Vimlesh1975 for a big help on the crawl system and Jonas Hummelstrand and hreinnbeck for a big help on templates.
I'm quite happy because only 20 days ago I discovered this wonderful software... and today I finished my first version of a client!

First of all you can access all the files and source at www.movie-transfer.com/caspar
I'm not a programmer, so I really kept the code at a very very very easy level... mine!

I made this software basing on my experience in the recent elections in my home town, and the work we made in a local TV on a ClassX titling machine.
So I made some standard features (crawl, news lower 3rd, watch) and replicated in Caspar a particular graphic we used in the live event in Genoa, basically the 5 faces of the candidates popping up with their votes.
For fun I changed the 5 faces :D. If the sentence "Winter is coming" rings a bell for you, then you will appreciate!

Anyway, an important part of the job was to make the system compatible with Excel files.
This was very important because, during the election days, we had a feed from the cityhall of Genoa with XLS datas and I decided to replicate this feature also in this release in CasparCG.
So during the live event, our journalists were picking (and checking) the xls files, uploading them to our titling machine, and calling me in the graphics direction room. I checked datas again and sent them live.

I decide to use the same system also for the news/guest/topic templates, so that a journalist could fill the spreadsheet with the required information for the live event.

Anyway, this is my first project, lots of things can be improved, I am mainly a graphic artist (in the media folder you can see a couple of my renders) and I'm not much of a PHP developer or an action script guru, so feel free to send me critics and comments!

All the best!

Andrea

PS: during the upload of the files I made this video with my mobile...
http://www.youtube.com/watch?v=zTg_aEwfkaA
Forgive my english :lol:
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby Jonas Hummelstrand » 08 Jun 2012, 20:38

Andrea, good work!
:D
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: A simple news PHP client relased... my first test!

Postby andreone72 » 08 Jun 2012, 22:23

Thank you! Thank you! Thank you!
:-))
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby siconova » 09 Jun 2012, 17:55

What great work!

I'm working on a remote capture system.. It is going to work controLling casparcg servers like this:

client (in the control room) -------> server1 (in the editing room): capture for NLE editing in the same pc
-------> server2 (in the editing room): capture for NLE editing in the same pc
--------> server3 (in the editing room): capture for NLE editing in the same pc

you can capture the same source in more than a server at the same time, so you have a backup of your ingest.

I'm going to share it when it is finished.. let me know if i can be of any help.

Best regards
siconova
 
Posts: 81
Joined: 04 May 2011, 20:02

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 09 Jun 2012, 22:45

wow! great project!! Can't wait to see it finished :-)
Thank you!!!

Andrea
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby siconova » 12 Jun 2012, 19:55

Hi,

I´m testing your PHP client and it is very useful thanks for sharing it!

I have a couple of questions :

1. It seems that LOGO OFF feature sometimes works, sometimes not.. is this a known bug?
2. When I press send on the news section (or on every CG section) it takes 3 seconds to display the lower third, is this normal or am I doing something worng?

Best regards
siconova
 
Posts: 81
Joined: 04 May 2011, 20:02

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 12 Jun 2012, 20:31

Hi!
Thank you for testing my client :-)
1. No, it's not a known bug... I'll check it, it always worked for me.
2. I put lots of pauses in the scripts ( the usleep([number]); ) because my test pc is a bit old and overloaded and I've experienced some commands not executed without a proper pause.
Also before sending an "add cg" command on a layer I clear that same layer, so my command sequence is:

Clear layer
Pause 2 seconds ( usleep(2000000); )
Add CG
Pause 2 seconds (or more)
Get back to the main page.

You can try to clean the code a bit by lowering the pauses. :-)

Again, I'm a newbie both in Caspar CG and in PHP, so I'm quite sure that there are hundreds of things I should fix ;-)

All the best

Andrea
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby siconova » 13 Jun 2012, 02:03

Yes that made the trick! Thanks a lot!
siconova
 
Posts: 81
Joined: 04 May 2011, 20:02

Re: A simple news PHP client relased... my first test!

Postby siconova » 14 Jun 2012, 21:48

Hi again,

Your news client works nice!

I just have one problem with the PLAYOUT option.. it does not display the list of videoclips that I placed on my ../server/media/news

Besides that problem, everything works properly, just the playout issue.

Please help me and let me know wich information do you need to know.

Best regards
siconova
 
Posts: 81
Joined: 04 May 2011, 20:02

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 14 Jun 2012, 23:29

Hallo!
To have your files listed correctly, you should check line 23 (I use HTML Kit to edit the file) of the main.php

It should say something like

$arrayfile=elencafiles("D:/caspar/CasparCG Server 2.0/Server/media/NEWS/",$array_extimg);

This basically populates the array of files from the specific directory with the right extensions (defined in $array_extimg)
Anyway you have to match the absolute path of your media directory , mine was "D:/caspar/CasparCG Server 2.0/Server/media/NEWS/", so you have to use your directory.

Hope it helps!

All the best

Andrea
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby didikunz » 15 Jun 2012, 08:56

There would be a AMCP command to get a list of media files from the server, without knowing the path to the files. See http://casparcg.com/wiki/CasparCG_2.0_AMCP_Protocol#CLS for detalis.

Didi
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: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 15 Jun 2012, 09:02

wow that's great!!! I'll try it tonight :-))

Thank you Didi!!!
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby siconova » 15 Jun 2012, 18:42

Hi,

I was using \ instead /

I replaced it and now works great..

Best regards!
siconova
 
Posts: 81
Joined: 04 May 2011, 20:02

Re: A simple news PHP client relased... my first test!

Postby Interpreter » 16 Jun 2012, 18:30

This renders a dropdown list with all available movie clips available in the server.

Code: Select all
<?php
$fp = fsockopen("127.0.0.1", 5250, $errno, $errstr, 10);
?>
<select name="Caspar_Video">
<?php
$out = "CLS\r\n" ;
fwrite($fp,  $out);
$result = fread($fp, 1024);
preg_match_all('/"([^"]+)"/', $result, $arr);
$files = $arr[1];
foreach($files as $file)
{
   echo'<option value="'.$file.'">'.$file.'</option>';
}
?>
</select>
<?php
fclose($fp);
?>
User avatar
Interpreter
 
Posts: 122
Joined: 01 May 2012, 15:43
Location: Norrköping, Sweden

Re: A simple news PHP client relased... my first test!

Postby Interpreter » 16 Jun 2012, 18:32

Of course you can exchange the CLS command to TLS to return all the templates available instead.
User avatar
Interpreter
 
Posts: 122
Joined: 01 May 2012, 15:43
Location: Norrköping, Sweden

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 16 Jun 2012, 18:42

thank you!!! I'll try it!!
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 16 Jun 2012, 18:42

thank you!!! I'll try it!!
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby flenoir » 19 Jun 2012, 13:17

Hi,

this is a very nice job

i was wondering because, i can't play files from playout when logo is on, is that normal ?

i have to desactivate the logo in order to see the playout file

in another hand, i was wondering how to have a count of the time duration of the file as the file is playing. in order to know when to switch to my live set

thanks again

f lenoir
flenoir
 
Posts: 17
Joined: 04 Jan 2012, 13:07
Location: Montpellier, France

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 23 Jun 2012, 12:30

Hi!
Sorry for the late answer!!!!
Plyout and logo work well for me... but I think that could be a layer conflict, I'll recheck everything and redistribute all the layers, I've been adding things without a proper project at the beginning, so there may be some layer conflict.
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby henny » 20 Feb 2013, 00:06

HI ive just been playing with your scripts to see if i can extend them to my neeeds

I have added the option to play the ident video before/after a video by adding the following code to the form

Code: Select all
<br> PRE Ident?<input type="checkbox" name="preident" value="true"><br>Post Ident?<input type="checkbox" name="postident" value="true"><br>


and updating the code in playout.php to the below, the only problem im getting is getting caspar to auto play the ident after the playing video the command is passed to caspar as it shows up in the log but it dosen't play, but the auto play of empty at the end works to clear last frame, can any one help?

note i have also added code to set the playout channel and created a preview button on the form to allow clips to be previewed on another channel onscreen


Code: Select all
if ($_POST["preident"]=="true")
  {$out = "PLAY ".$ch."-1 news/utils/tigutv   \r\n";
fwrite($fp,  $out);
usleep(1200000);
 
  }



$out="PLAY ".$ch."-1 ".$v."  \r\n ";
fwrite($fp, $out);
usleep(5000);


if ($_POST["postident"]=="true")
  {$out = "LOADBG ".$ch."-1 news/utils/tigutv AUTO \r\n";
fwrite($fp,  $out);
usleep(1200000);
 
  }

$out="LOADBG ".$ch."-1 EMPTY AUTO \r\n";
fwrite($fp, $out);
usleep(50);

fclose($fp);

header( 'Location: main.php' ) ;
henny
 
Posts: 36
Joined: 15 Feb 2012, 10:32

Re: A simple news PHP client relased... my first test!

Postby hreinnbeck » 20 Feb 2013, 01:50

Adding two AUTO's means that the last AUTO overrides all the previous. If you disable the EMPTY AUDIO:
Code: Select all
/*
$out="LOADBG ".$ch."-1 EMPTY AUTO \r\n";
fwrite($fp, $out);
usleep(50);
*/

- you will find that your outro should play through.
hreinnbeck
 
Posts: 295
Joined: 04 Aug 2009, 06:31

Re: A simple news PHP client relased... my first test!

Postby henny » 20 Feb 2013, 08:11

But will the empty still run ? I need to clear last frame of the outtro as I'm using internal key in a decklink
henny
 
Posts: 36
Joined: 15 Feb 2012, 10:32

Re: A simple news PHP client relased... my first test!

Postby didikunz » 20 Feb 2013, 08:29

henny wrote:But will the empty still run ? I need to clear last frame of the outtro as I'm using internal key in a decklink


Yes and no. A LOADBG with AUTO means, play this clip after the one that is currently playing. There is no list of commands, so if you send multiple LOADBG commands, the last one will win. You have to wait until the clip preloaded is playing until you preload the next. And EMPTY is treated like any other clip.
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: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: A simple news PHP client relased... my first test!

Postby henny » 20 Feb 2013, 08:35

So there no way of stacking up clips? no problem looks like im going to have to come up with some php that checks the current playing file and sends the command when my outro is playing
henny
 
Posts: 36
Joined: 15 Feb 2012, 10:32

Re: A simple news PHP client relased... my first test!

Postby didikunz » 20 Feb 2013, 09:13

henny wrote:So there no way of stacking up clips? no problem looks like im going to have to come up with some php that checks the current playing file and sends the command when my outro is playing


Yes, that will be the way to go.
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: 3477
Joined: 10 May 2010, 09:08
Location: Aarau, Switzerland

Re: A simple news PHP client relased... my first test!

Postby Slewfoot » 25 Mar 2013, 04:25

First let me say GREAT client!

One thing I've noticed and I just don't know what to do about it is that when the length of the crawler text gets too large, it blanks out the decklink input. The templates for the logo, time, and crawler still show up, but nothing else. I've set up the crawler on windows scheduler and modified it to go out and grab an RSS feed, parse it, and attach it to the end of the crawler text. It's been working great until the string length gets too large and then it just blanks out the decklink input and shows nothing more than the crawler and logo.

Any ideas?

Thanks,

Slewfoot
Slewfoot
 
Posts: 15
Joined: 11 Feb 2013, 22:01

Re: A simple news PHP client relased... my first test!

Postby Slewfoot » 26 Mar 2013, 13:53

Found it...

Adjusting the performance settings for Best Performance took care of the issue.
Slewfoot
 
Posts: 15
Joined: 11 Feb 2013, 22:01

Re: A simple news PHP client relased... my first test!

Postby Andrea Basso » 27 Mar 2013, 14:55

It looks like I'm not the only guy from Genoa using Caspar!

Welcome andreone72!
Andrea Basso
 
Posts: 60
Joined: 24 Jan 2012, 10:11

Re: A simple news PHP client relased... my first test!

Postby tomj » 12 Apr 2013, 10:53

If you put
Code: Select all
fgets($SOCKET_HANDLE);

under each of the 'fwrite's then I think you should be able to remove all of the usleeps.

fgets will wait and read the next line from the response from the server, however long it takes, and he server only sends a response when it's ready to continue.

http://php.net/manual/en/function.fgets.php
tomj
 
Posts: 227
Joined: 20 Mar 2013, 23:31
Location: Lancaster, UK

Re: A simple news PHP client relased... my first test!

Postby tomj » 12 Apr 2013, 16:59

I've just written a function which you could use which waits for the response and then returns the status code and any data if applicable.
viewtopic.php?f=3&t=1416#p8533
tomj
 
Posts: 227
Joined: 20 Mar 2013, 23:31
Location: Lancaster, UK

Re: A simple news PHP client relased... my first test!

Postby andreone72 » 27 May 2013, 09:44

Hi all!!
I'm very sorry, I've been away from this project for a very long time!
I'm very happy to see that so many people are interested on it, I'll check my software soon so that I can give you a better and cleaner version :-)
All the best!

Andrea
andreone72
 
Posts: 27
Joined: 30 May 2012, 20:43

Re: A simple news PHP client relased... my first test!

Postby carlosowusu » 24 Mar 2015, 00:52

Any updates on a new version?
User avatar
carlosowusu
 
Posts: 30
Joined: 26 May 2011, 18:22

Re: A simple news PHP client relased... my first test!

Postby marc.colemont » 17 May 2017, 09:25

The download link seems to be broken?
As I would like to try it out. The excel functionality looks great.
Does anyone has the download available?
marc.colemont
 
Posts: 4
Joined: 13 Jul 2015, 20:38


Return to Tech and Development

Who is online

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