[mythtv] Recordings Sports Feature Wish/Development

Michael Rice mikerice1969 at gmail.com
Wed Feb 20 03:10:06 UTC 2008

On 2/19/08, David Engel <david at istwok.net> wrote:
> On Tue, Feb 19, 2008 at 02:10:09PM -0800, Taco Mel wrote:
> > Would it be correct to state that the "override rule"
> > you described is created within the "memory" of the
> > running scheduler process, so to speak, and that it is
> > not written to or defined within the SQL database?
> No, it would not be correct.  The override rule is written to the
> database just like any other override rule.  The scheduler only
> updates its internal state when it detects the new rule with a
> different ending time.
> > What is needed for a sports feature is to be able to
> > create the override rule from outside of the MythTV
> > GUI.  Two ways I can think of would be a database
> > query, or on the command line with something like
> > "mythbackend --resched --chanid XXX --newendtime
> The functionality is already there.  All you have to do is put the
> pieces together.
> > What about a corresponding function to modify the
> > start time of a particular recording (which has not
> > started yet, obviously, since if it started already
> > such modification would be pointless).  I am thinking
> That's just another override rule.
> > I want to avoid hacking at the code, creating new
> > database tables, etc., just for my own purposes.  I
> > want to discover the "official" way.  So I can sum
> > this up in one question - what is the SQL query, or
> > command line, to adjust the start time and end time of
> > a particular recording without modifying the rule itself?
> The SQL begins with "INSERT INTO record (type, chanid, starttime,
> ...)".  For your cases, the most important thing is to set type to
> kOverrideRecord.

As I mentioned in another thread MRE already uses override rules...
and for awhile it was working fine for me.  In fact here is a piece of
the code:

    * Copy constructor
    * All copies of RecordingRule objects are actually override rules to
    * be used to override the source rule.  The __clone method does some
    * object manipulation required to turn the object into an override object.
   public function __clone()
      $this->setVal('recordid', NULL);
      $this->setVal('type', self::RECTYPE_OVERRIDE);
      $this->setVal('search', self::SEARCHTYPE_NONE);
      $this->setVal('findid', 0);


      $db = $conf->getDB();
      $qry = "REPLACE INTO record SET ";
      $cols = array();
      $vals = array();
      foreach($this->_row as $col => $val)
         $cols[] =  "$col = ?";
         $vals[] = $val;
      $qry .= implode(',', $cols);
      $qh = $db->prepare($qry);
         trigger_error("Can't prepare query!", E_USER_ERROR);
      $res = $db->execute($qh, $vals);

Somewhere along the line it stopped working... I never was able to
determine the cause... but it would extend the recording for awhile
then stop without reason (i.e. the event was not over according to
MRE).  I think it was some kind of timing issue but I never completely
debugged it.

So if the solution is inserting override records into the database
that code is already there (in MRE) and just needs to be debugged.

More information about the mythtv-dev mailing list