recording title from tvserver (1 Viewer)

lar282

Portal Pro
July 11, 2004
414
2
Hi
trying to write a TV server plugin that just GETS the title of the recorded show when it just starting to record. How do I get the title?
The below code bails on Log.Wri.. so I am missing something but what?

void events_OnTvServerEvent(object sender, EventArgs eventArgs)
{
TvServerEventArgs tvEvent = (TvServerEventArgs)eventArgs;
switch (tvEvent.EventType)
{

///RecordingStarted is called when the recording is started
case TvServerEventType.RecordingStarted:
Log.WriteFile("DEBUG:rec started:" + tvEvent.Recording.Title);
break;

}


}
 

rtv

Retired Team Member
  • Premium Supporter
  • April 7, 2005
    3,622
    301
    Osnabruck
    Home Country
    Germany Germany
    Use
    Log.Debug("foobar");

    Also note, that some stuff has been ripped out of the core to the utils project.
     

    lar282

    Portal Pro
    July 11, 2004
    414
    2
    well, i get an exeption on the recording part.the Log. part is just an example.
    I am not very good at programming and wondering if u could give example on how to defibe the recording class. I tried to look in the plugins that exist in the server bu none uses any recording info

    regards

    LAsse
     

    lar282

    Portal Pro
    July 11, 2004
    414
    2
    anybody?

    Ok log says this:
    2007-01-12 15:23:46 True
    2007-01-12 15:23:46 1D:\recorded_tv\Angel 12 1 2007 15_10.mpg
    2007-01-12 15:23:46 DEBUG:rec started:BAILEDSystem.NullReferenceException: Object reference not set to an instance of an object.
    at TvEngine.Test.events_OnTvServerEvent(Object sender, EventArgs eventArgs)


    and the code now looks like this:
    case TvServerEventType.RecordingStarted:
    Log.WriteFile("DEBUG:rec RecordingStarted:");

    try
    {
    Recording recording = tvEvent.Recording as Recording; //fine
    Log.Write(tvEvent.Card.IsRecording.ToString()); //fine
    Log.Write(tvEvent.Card.Id.ToString() + tvEvent.Card.RecordingFileName); //fine
    Log.Write("DEBUG:rec started:" + recording.Title); //BAILS

    }
    catch (Exception ex)
    {
    Log.WriteFile("DEBUG:rec started:BAILED" + ex);

    }


    Its gotta be something simple that I did wrong, but what?

    //Lasse
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    Ok log says this:
    2007-01-12 15:23:46 True
    2007-01-12 15:23:46 1D:\recorded_tv\Angel 12 1 2007 15_10.mpg
    2007-01-12 15:23:46 DEBUG:rec started:BAILEDSystem.NullReferenceException: Object reference not set to an instance of an object.
    at TvEngine.Test.events_OnTvServerEvent(Object sender, EventArgs eventArgs)


    and the code now looks like this:
    case TvServerEventType.RecordingStarted:
    Log.WriteFile("DEBUG:rec RecordingStarted:");

    try
    {
    Recording recording = tvEvent.Recording as Recording; //fine
    Log.Write(tvEvent.Card.IsRecording.ToString()); //fine
    Log.Write(tvEvent.Card.Id.ToString() + tvEvent.Card.RecordingFileName); //fine
    Log.Write("DEBUG:rec started:" + recording.Title); //BAILS

    }
    catch (Exception ex)
    {
    Log.WriteFile("DEBUG:rec started:BAILED" + ex);

    }


    Its gotta be something simple that I did wrong, but what?

    //Lasse

    My SVN download is a few week old but...

    Try using the Schedule and not the Recording
    and pull the title from Schedule.ProgramName.

    Here is the code firing the event, the Recording is set to null, but the schedule is passed in.
    Code:
    _tvController.Fire(this, new TvServerEventArgs(TvServerEventType.StartRecording, new VirtualCard(cardInfo.Id), user, recording.Schedule, null));




    HTH,
    patrick
     

    Frodo

    Retired Team Member
  • Premium Supporter
  • April 22, 2004
    1,518
    121
    53
    The Netherlands
    Home Country
    Netherlands Netherlands
    The tvEvent.Schedule is the one you want.
    Schedule:
    contains the information like channel, title, start/end time of each show you
    scheduled to record.

    Recording
    Will be created when a recording has finished.
    It contains all information about programs which were recorded in the past
     

    lar282

    Portal Pro
    July 11, 2004
    414
    2
    thank u all for the replies.
    I just thought it would work since there was a
    tvEvent.Recording.Title


    Me wrong....

    Thanks again

    //Lasse
     

    Users who are viewing this thread

    Top Bottom