[mythtv-users] SQL help with custom priority rule using recgroups table

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Nov 8 00:56:30 UTC 2017


On Sun, 5 Nov 2017 21:59:54 +0000, you wrote:

>Hi all,
>
>Been a user of MythTV for about 13 years I think, but never actually posted
>to the list before! Thanks to all the people who have helped this software
>happen.
>
>I'm currently running 29+fixes via Mythbuntu PPA.
>
>The outline is this - I have channel priority of +1 on my HD channels, so
>that recordings on my Freeview HD system here in the UK will normally
>prefer HD over SD (I do it this way because there are some UK channels -
>e.g. Channel 5 HD - that don't actually mark their recordings as HD using
>the EIT data).
>
>I'm a bit mean though, because I want to prefer SD for the millions of kids
>programs we record. So, I've achieved this easily enough with a -2 priority
>on the following custom rule:
>
>channel.callsign LIKE '% HD' AND RECTABLE.recgroupid = 4
>
>It works absolutely fine - but I wondered if there's a more complex SQL
>query that could reference the recording group name, rather than the ID
>that I pulled from the database?
>
>I tried the following:
>
>channel.callsign LIKE '% HD' AND (SELECT recgroups.recgroup FROM recgroups
>INNER JOIN RECTABLE ON RECTABLE.recgroupid = recgroups.recgroupid) =
>'Childrens Programmes'
>
>But the results from the 'Test' function just tells me that childrens
>programmes will be recorded in HD.
>
>Any help is much appreciated!
>
>Thanks in advance,
>
>Will

I think a simple subquery might work:

channel.callsign LIKE '% HD' AND RECTABLE.recgroupid=(SELECT
recgroupid FROM recgroups WHERE recgroup='Childrens Programmes')

Be aware though, that the subquery will likely be executed each time
that bit of SQL is run (for each recording rule processed?).  So it
may slow down the scheduler unless something optimises the query.


More information about the mythtv-users mailing list