NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 81 82 83 84 85 … 93 Next »
ScheduleHelper/IScheduleHelper bug?

 
  • 0 Vote(s) - 0 Average
ScheduleHelper/IScheduleHelper bug?
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#1
2004-12-23, 07:35 AM
Found something today when trying to cancel a recording using the IScheduleHelper interface. The problem is that the CancelScheduledRecording() method in IScheduleHelper doesn't actually cancel the recording but puts it into a Conflict status.

To actually cancel a recording, you have to use the SchedulerHelper class. However, to update a ScheduledRecording you need to use the IScheduleHelper. Everything else seems to work correctly. Spent about 2 hours tonight trying to figure out why I couldn't cancel a recording.
jasonf
Offline

Member

Posts: 121
Threads: 7
Joined: Oct 2004
#2
2004-12-23, 01:15 PM
Something with this doesn't seem to make sense.

IScheduleHelper is simply the interface that ScheduleHelper implements. That is, IScheduleHelper has no logic itself, so all that casting a ScheduleHelper to it's base IScheduleHelper interface would do is hide any public members that were not part of the IScheduleHelper interface.

There is only 1 ScheduleHelper in the system, and in fact, it's a singleton. So it shouldn't matter how the instance is cast--the method invocation will execute the same code, right?

There could still be a bug in the code, but it's probably related to data rather than casting as an interface versus a concrete class.
JasonF
Jeff
Offline

Posting Freak

Posts: 1,933
Threads: 69
Joined: Oct 2004
#3
2004-12-23, 03:18 PM
Could you post an example of the code that does and does not work? I still can not get CancelScheduledRecording() to work from my plug-in for reoccuring recordings and have instead been going straight to the GBPVR database to delete the recording. I'd like to go through the standard API of I can figure out how.

Here is what I have been using

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
// Temp hack to directly delete recording group from DB since it
// doesn't seem to work through public API
private void CancelScheduledRecording(ScheduledRecording scheduledRecording)
{
// If this is a single instance, delete it through the public method
if (scheduledRecording.getRecordingStatus() != ScheduledRecording.STATUS_PLACE_HOLDER)
{
ArchiveVideosTask.LogMsg ("Cancelling pending recording "+scheduledRecording.getFileName());
ScheduleHelper scheduleHelper = ScheduleHelper.getInstance();
scheduleHelper.CancelScheduledRecording(scheduledRecording);
}
// If it is a recording group, go direct to the DB
else
{
// Open the DB
OleDbConnection myConnection = new OleDbConnection (GBPVRDBConnectionString);
myConnection.Open();

// See if there is a record for the selected file in the DB
string mySQLCommand = "DELETE FROM Recording_Schedule WHERE filename ='"+scheduledRecording.getFileName().Replace("'","''")+"' AND Recording_Group ="+scheduledRecording.getRecordingGroup();

ArchiveVideosTask.LogMsg ("About to execute SQL command: "+mySQLCommand);

OleDbCommand myCommand = new OleDbCommand(mySQLCommand,myConnection);
myCommand.ExecuteNonQuery();

// Close the connection to the archive database
myConnection.Close();
}
}
[/QUOTE]
KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#4
2004-12-23, 05:03 PM
Jeff, I'll post an example later when I get back home from work. It was really strange, as I was running through my priority scheduling code, and when it found a conflict (i.e. two shows start or overlap). It would try to cancel the lower priority show, and then schedule the higher priority show. If I used the IScheduleHelper interface class, I would always get the status code being set to a status code of 5 in the database. I verified this by putting a break point there, and querying the database both before and after executing that method.

As soon as I switched to using the ScheduleHelper classes CancelScheduleRecording it deleted the record from the database. Another thing to note about ScheduleHelper and IScheduleHelper. Only IScheduleHelper implements the UpdateScheduleRecording method. It isn't a public method in the ScheduleHelper class.

The recordings, I'm canceling all have a GROUP_NONE and Status Code is PENDING. I'm doing nothing special to get the ScheduleHelper to cancel the recording. Like you I thought I was going to have to write my own routine handle the deletion (I may yet, because the SheduleRecording method, doesn't allow scheduling of a recording, if one already exists at that time, even if that recording that exists is in a Conflict status.)



KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#5
2004-12-24, 06:01 AM
Jeff, here is an example of the code that was working/not working with the different ways of calling the CancelScheduledRecording method.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
if (resolveProgram != null) {
ScheduledRecording cancelRecording = this.findRecording(program.getOID(), scheduledRecordings);
if (cancelRecording != null) {
cancelRecording.setRecordingStatus(ScheduledRecording.STATUS_CONFLICT);

// Added this to get a good CancelScheduleRecording method
ScheduleHelper schedHelp = ScheduleHelper.getInstance();
schedHelp.CancelScheduledRecording(cancelRecording);
ScheduledRecording myRecording = scheduleHelper.SheduleRecording(resolveProgram.getChannelOID(),
resolveProgram.getStartTime(), resolveProgram.getEndTime(), resolveProgram, ScheduledRecording.TYPE_RECORD_ONCE, ScheduledRecording.GROUP_NONE, null);

// Remove the old recording from the list.
knownRecordings.Remove(program.getOID());
scheduledRecordings.Remove(cancelRecording);
// Add the new recording the Known Recordings List
knownRecordings.Add(resolveProgram.getOID());
scheduledRecordings.Add(myRecording);
}
}

[/QUOTE]

The only thing I did to get it to work was to change which method I called from which class. ScheduleHelper works, IScheduleHelper sets status to Conflict.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  ScheduleHelper.SheduleRecording returns Nothing MaidenQuebec 7 2,989 2009-03-20, 12:21 PM
Last Post: Ernie-c
  Recordings via the IScheduleHelper API Ernie-c 39 9,049 2008-05-28, 11:36 PM
Last Post: Ernie-c
  ScheduleHelper questions alibert 1 1,618 2006-08-18, 08:49 PM
Last Post: sub
  ScheduleHelper.GetListingsForTimePeriod alibert 0 1,116 2006-05-29, 01:18 PM
Last Post: alibert
  ScheduleHelper.LoadRecordingSchedule() and SQLite database locks alibert 0 1,210 2006-05-23, 05:36 PM
Last Post: alibert
  Problem with ScheduleHelper class in 0.96.12 Jeff 1 1,498 2006-03-04, 06:00 PM
Last Post: UncleJohnsBand
  Error from ScheduleHelper.LoadRecordingSchedule() Jeff 1 1,383 2005-02-07, 05:11 AM
Last Post: KingArgyle

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode