[campcaster-dev] scheduler events
  • Hi,

    I have a question based on the setup we do for Radio Orange:

    Before a broadcast gets played by campcaster, the Kramer audio matrix
    switch needs to be switched to another port. All the stuff for switching
    the Kramer switch is already implemented.

    So my question is: is it possible to trigger an event from the scheduler
    exactly when a broadcast gets played in order to launch an external
    program which switches the Kramer? If yes: how could I implement this?

    Thanks for your help!

    Mic

    --
    strg.at design development server
    http://strg.at office@strg.at
    liniengasse 20/12, 1060 wien
    tel +43 1 526 56 29 fax +43 1 526 56 49
  • 2 Comments sorted by
  • Hi Mic,

    On 8/5/07, Michael Dosser wrote:
    > I was able to find that out by myself. Don't know if this is the correct
    > way, but I did the following:
    >
    > # Login
    > xr_login
    >
    > # Upload the audio clip
    > audiometadataxmlstring (own function to generate audio file xml)
    > xr_storeAudioClipOpen
    > xr_uploadAudioClip
    > xr_storeAudioClipClose => now I have the gunid
    >
    > # Create playlist
    > xr_getAudioClip => xml metadata of the audioclip
    > xr_createPlaylist
    > xr_editPlaylist
    > xr_savePlaylist
    >
    > # Upload the saved playlist for scheduling
    > Scheduler::uploadPlaylist

    I'm not sure what you mean by xr_uploadAudioClip; if it means "and
    then I upload the binary file to the given URL using curl or
    whatever", then this is what we do from our Studio client, yes.


    On 8/5/07, Michael Dosser wrote:
    > The error message is:
    >
    > Fault returned from XML RPC Server, fault code 805:
    > xr_storeAudioClipClose: BasicStor::bsClosePut: md5sum does not match
    > (token=0e2c350a157397f9)
    > [2a35ee853cd5e49a60c7ec58b1450663/d41d8cd98f00b204e9800998ecf8427e]
    >
    > If I upload that file from localhost, everything works fine. If I then
    > try to upload it again from remote, campcaster says:
    >
    > Fault returned from XML RPC Server, fault code 888:
    > xr_storeAudioClipOpen: LocStor::storeAudioClipOpen: Duplicate file -
    > Matched MD5 (2a35ee853cd5e49a60c7ec58b1450663) against 'test.mp3'
    >
    > Why is this happening?

    I haven't seen this; can you send me the Perl file you are using so we
    can try to reproduce it? Or better still, open a bug report about it
    at
    http://code.campware.org/projects/campcaster
    and upload both the mp3 file and the Perl script as attachments. (To
    file a new ticket, first you need to log in; the user name is "guest"
    and the password is "campware".)


    On 8/6/07, Michael Dosser wrote:
    > So my question is: is it possible to trigger an event from the scheduler
    > exactly when a broadcast gets played in order to launch an external
    > program which switches the Kramer? If yes: how could I implement this?

    Not without editing the C++ code, I'm afraid. If you want to try
    that, the class to look at is products/scheduler/PlaylistEvent; you
    need to add the new action in the start() method. Or maybe in the
    initialize() method, which runs 10s earlier. This 10s delay can be
    changed by modifying the assignment to initTime in the constructor.

    Ferenc
  • Hi Ferenc,

    thanks for your help! Comments inline.

    Ferenc Gerlits schrieb:
    > I'm not sure what you mean by xr_uploadAudioClip; if it means "and
    > then I upload the binary file to the given URL using curl or
    > whatever", then this is what we do from our Studio client, yes.

    Erm, stupid me! This is not a XML-RPC method by Campcaster, but of
    course my own function ...

    > On 8/5/07, Michael Dosser wrote:
    >> The error message is:
    >>
    >> Fault returned from XML RPC Server, fault code 805:
    >> xr_storeAudioClipClose: BasicStor::bsClosePut: md5sum does not match
    >> (token=0e2c350a157397f9)
    >> [2a35ee853cd5e49a60c7ec58b1450663/d41d8cd98f00b204e9800998ecf8427e]
    >>
    >> If I upload that file from localhost, everything works fine. If I then
    >> try to upload it again from remote, campcaster says:
    >>
    >> Fault returned from XML RPC Server, fault code 888:
    >> xr_storeAudioClipOpen: LocStor::storeAudioClipOpen: Duplicate file -
    >> Matched MD5 (2a35ee853cd5e49a60c7ec58b1450663) against 'test.mp3'
    >>
    >> Why is this happening?
    >
    > I haven't seen this; can you send me the Perl file you are using so we
    > can try to reproduce it?

    I found the problem! I printed the url given from
    XR_LocStor::xr_storeAudioClipOpen and it gave me:

    http://localhost:80/campcaster/storageServer/var/xmlrpc/put.php?token=38674c793a947172

    Since I am working on a remote machine, localhost is not where
    campcaster listens. Therefore xr_storeAudioClipClose says md5sum does
    not match - I tried to upload to the wrong url. This should be triggered
    by my perl script, but it didn't.

    So I followed the instruction from Micz Flor at:

    http://code.campware.org/manuals/campcaster/1.1/index.php?id=9

    and changed "storageUrlHost" in
    /opt/campcaster/var/Campcaster/storageServer/var/conf.php from
    "localhost" to the servers name.

    Then it worked perfectly. Is it possible to set "storageUrlHost" in a
    proper configuration file already?

    > On 8/6/07, Michael Dosser wrote:
    >> So my question is: is it possible to trigger an event from the scheduler
    >> exactly when a broadcast gets played in order to launch an external
    >> program which switches the Kramer? If yes: how could I implement this?
    >
    > Not without editing the C++ code, I'm afraid. If you want to try
    > that, the class to look at is products/scheduler/PlaylistEvent; you
    > need to add the new action in the start() method. Or maybe in the
    > initialize() method, which runs 10s earlier. This 10s delay can be
    > changed by modifying the assignment to initTime in the constructor.

    Is this the right place to add a system() statement:

    in campcaster-1.2.0/src/products/scheduler/src/PlaylistEvent.cxx

    --snip--
    149 void
    150 PlaylistEvent :: start(void) throw ()
    151 {
    152 DEBUG_BLOCK
    153
    154 if (state != initialized) {155 error() << "::start() -
    ERROR: STATE IS NOT INITIALIZED! Aborting." << endl;
    156 // TODO: handle error?
    157 return;
    158 }
    159
    160 try {
    161 audioPlayer->open(*playlist->getUri());
    162 audioPlayer->start();
    163 system("/usr/home/mic/orange/daemon/kramerswitch.pl 1 1");
    --snap--

    Thanks for your help!

    Mic

    --
    strg.at design development server
    http://strg.at office@strg.at
    liniengasse 20/12, 1060 wien
    tel +43 1 526 56 29 fax +43 1 526 56 49