[mythtv-users] Premieres rule

Mike Holden mythtv at mikeholden.org
Tue Jul 13 13:28:23 UTC 2010

Brian J. Murrell wrote:
> As can be seen, it aired after it's originalairdate.  :-(
> Since I do this search daily and I keep a history of the searches, I
> searched through all of June to see if this was ever matching and it
> never did, so I can only assume that for whatever reason, the actual
> air
> date of the premiere episode(s) was delayed from it's original air
> date.
> I tried removing the
> program.originalairdate = DATE(program.starttime)
> condition but way too many false positives came up.
> Any ideas?

Could you check that the original air date is within a defined
period (say 1 month) of the start time of the program? This would
remove most of the false positives (probably). You could look at
using the "DATEDIFF()" function in mysql for this, possibly also
incorporating "ABS()" to ignore the sign of the number returned.

Something like:
    ABS(DATEDIFF(program.originalairdate,DATE(program.starttime)) <= 31
Mike Holden

More information about the mythtv-users mailing list