[mythtv-users] Power recording rule to choose between dual feeds

Ronald Frazier ron at ronfrazier.net
Mon Jan 18 03:51:45 UTC 2010


> channel x: TeamA at TeamB               (home feed)
> channel x+1: TeamA at TeamB           (away feed)
>
> The programids are the same but I can recognize home games with "at
> MyTeam" in program.subtitle.
> Away games would have "MyTeam" without "at MyTeam".
>
> When my team is away I want the away feed but when my team is home I
> want the home feed.
> How can I choose the right channel?
>
> I have to also keep in mind that sometimes there is only one feed and
> I will want to choose that
> no matter if it is home or away.

Piece of cake up until that last requirement. That's what makes it
tricky, and you are either going to have to do a few subqueries or an
outer join, with the join probably being cleaner. How to wedge this
into myths ui and schema I can't say offhand, but I can construct the
type of query you'd need to generate. Perhaps you can reverse engineer
it from there:

SELECT * FROM Programs A LEFT OUTER JOIN Programs B ON A.programid =
B.programid AND A.chanid <> B.chanid AND A.chanid IN (x, y) AND
B.chanid IN (x, y)
WHERE
(
(A.chanid=x AND A.subtitle LIKE "MyTeam at %") OR
(A.chanid=x AND A.subtitle LIKE "% at MyTeam" AND B.chanid IS NULL) OR
(A.chanid=y AND A.subtitle LIKE "% at MyTeam") OR
(A.chanid=y AND A.subtitle LIKE "MyTeam at %" AND B.chanid IS NULL)
)
AND [whatever other condition you need]


In the join, the
AND A.chanid IN (x, y) AND B.chanid IN (x, y)
part is only necessary in case the event may shows up on a 3rd channel

The logic in there where clause breaks down as:
home broadcaster for home game
home broadcaster for away game when there is no away broadcaster
away broadcaster for away game
away broadcaster for a home game when there is no home broadcaster

-- 
Ron
Ronald Frazier Photography - http://www.ronfphoto.com/
Blogging About Photography - http://ronfrazier.blogspot.com/


More information about the mythtv-users mailing list