[mythtv] [PATCH] Control duplicates by channel ID

Bruce Markey bjm at lvcm.com
Fri Aug 10 23:05:38 UTC 2007

David Shay wrote:
> Determined what at least one of the problems here is.  The primary key
> to oldrecorded does not include chanid. This makes the "REPLACE"
> statement in AddHistory not add a new record when it now should.  I'm
> not sure if there would be any other impacts of just adding chanid
> into the key for oldrecorded.

I haven't really been following this while you guys hash
this out but here's a random thought that may point in a
different direction...

"REPLACE" isn't engraved in granite. It's a shortcut for
DELETE FROM then INSERT INTO only much less flexible. You
could use starttime/title/chanid as the key because chanid
is a subset of station and not the other way around. For
normal rules:

DELETE FROM oldrec WHERE starttime/title/station;
INSERT INTO oldrec (starttime,title,chanid,station,...);

For dupchanid:

DELETE FROM oldrec WHERE starttime/title/chanid;
INSERT INTO oldrec (starttime,title,chanid,station,...);

The first bug would be that if a normal rule and a dupchanid
rule are recording the same show on a different chanid, the
first "DELETE" above would remove all entries for any chanid
of that station. Maybe starttime/title/station/recordid; or
something. I think a normal and dupchanid fighting for the
same showing may raise other issues too.

--  bjm

More information about the mythtv-dev mailing list