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

Joey Morris rjmorris.list at zoho.com
Tue Nov 7 12:13:06 UTC 2017


Will <ml at familyrussell.me.uk> wrote on Sun, Nov 05, 2017 at 09:59:54PM +0000:
> 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.

This is a shot in the dark, because I haven't really used this feature of
MythTV and haven't tested this, but maybe you could change your rule to:

  channel.callsign LIKE '% HD' AND recgroups.recgroup = 'Childrens Programmes'
  AND record.recgroupid = recgroups.recgroupid

and add recgroups to the Additional Tables field:

  , recgroups

Have you looked at https://www.mythtv.org/wiki/Custom_Recording? It has several
custom recording rules that may give you other ideas on how to approach this,
including examples of joining additional tables. Also, the very end shows how
MythTV structures the MySQL query, which you might be able to use to test/debug
your rule at the MySQL command line.



More information about the mythtv-users mailing list