New schedule starts recording too late (1 Viewer)

El Gitto

Portal Member
November 4, 2006
22
1
Home Country
Netherlands Netherlands
Hi all,

I'm writing some code to schedule a recording from another app. It's working, but for programs that start in a few minutes, or have already started, the recording starts too late. It's like the schedule isn't in the database in time. This is the coding:

Code:
               TvBusinessLayer layer = new TvBusinessLayer();
                
                Schedule rec = new Schedule(MpProgram.IdChannel, MpProgram.Title, MpProgram.StartTime, MpProgram.EndTime);
                rec.PreRecordInterval = Int32.Parse(layer.GetSetting("preRecordInterval", "5").Value);
                rec.PostRecordInterval = Int32.Parse(layer.GetSetting("postRecordInterval", "5").Value);
                rec.ScheduleType = (int)TvDatabase.ScheduleRecordingType.Once;
                rec.Persist();

                TvServer server = new TvServer();
                server.OnNewSchedule();

I've tried adding server.IsTimeToRecord(DateTime.Now) but this doesn't help. Any suggestions to correct this little problem? Thanks!

Chris
 

El Gitto

Portal Member
November 4, 2006
22
1
Home Country
Netherlands Netherlands
To answer my own question: it looks like adding the line
Code:
bool IsTimeToRecord = server.IsTimeToRecord(DateTime.Now, rec.IdSchedule);
does the trick.
 

Users who are viewing this thread

Top Bottom