[mythtv-users] Custom Record help, please

John P Poet jppoet at gmail.com
Wed Dec 13 06:20:57 UTC 2006


On 12/12/06, Bruce Markey <bjm at lvcm.com> wrote:
> John P Poet wrote:
> > I want to craft a custom record rule which will match Crime and
> > Mystery dramas.  I do *not* want reality crime shows.
> >
> > Looking through some of the shows I would like it to match, I see:
> >
> > Category: Crime, Drama
> > Category: Crime drama
> > Category: Mystery, Drama
> > Category: Crime drama, Mystery
>
> If you want all "Crime drama" then "Crime drama, Mystery"
> is moot. Based on the above:
>
> Category: Crime drama
> Category: Drama, (Crime OR Mystery)
>
> > Among the shows I do *not* want it to catch, I see:
> >
> > Category: Mystery
> > Category: Crime
> >
> > I have tried to craft a rule which looks for either Mystery|Crime
> > *and* Drama, but it does not work.  Can someone give me an example of
> > how to do this?
>
> The problem is that when you JOIN, there is a result row with
> the show and one specific match from the programgenres. Therefore
> you need two joins of the table to come up with a combination
> of two genre matches for the same show.
>
> Rule Name: Crime Drama
>
> LEFT JOIN programgenres ON program.chanid = programgenres.chanid AND program.starttime = programgenres.starttime LEFT JOIN programgenres genre2 ON program.chanid = genre2.chanid AND program.starttime = genre2.starttime
>
> programgenres.genre = 'Crime drama'
> OR (programgenres.genre = 'Drama'
>   AND (genre2.genre = 'Crime' OR genre2.genre = 'Mystery'))
>
>
> I get way too many results to use as a rule so you may want
> to store this to run it periodically then choose individual
> series and movies. Enter the mess above then press "Store".
> On the dialog page click 'Store "Crime Drama"'. Each time
> you enter the custom editor you can press the left arrow to
> get to "Crime Drama (stored example)", click "Add..." then
> "Test" to see the current result.
>
>
> That said, here is a less messy but less complete approach.
> "Category" is simply the 'best' genre from the DD genre info.
> Therefore, if you really want these Category plus sub-genre:
>
> Category: Crime drama
> Category: Crime, Genre: Drama
> Category: Mystery, Genre: Drama
>
> LEFT JOIN programgenres ON program.chanid = programgenres.chanid AND program.starttime = programgenres.starttime
>
> program.category = 'Crime drama'
> OR ((program.category = 'Crime' OR program.category = 'Mystery')
>      AND programgenres.genre = 'Drama')
>
>
> --  bjm
>
> Attached is the SQL to insert these into your 'customexample'
> table along with a couple other useful stored examples.
>
>
>
>
> INSERT INTO `customexample` VALUES ('New Flix','','program.category_type = \'movie\' AND program.airdate >= 2005 \nAND program.stars > 0.5 ');
> INSERT INTO `customexample` VALUES ('Timeout','','program.starttime < \'2006-05-25 15:00:00\' \n');
> INSERT INTO `customexample` VALUES ('First new episode','','program.previouslyshown = 0 AND program.first > 0 ');
> INSERT INTO `customexample` VALUES ('Crime Drama','LEFT JOIN programgenres ON program.chanid = programgenres.chanid AND program.starttime = programgenres.starttime LEFT JOIN programgenres genre2 ON program.chanid = genre2.chanid AND program.starttime = genre2.starttime','programgenres.genre = \'Crime drama\'\nOR (programgenres.genre = \'Drama\'\n  AND (genre2.genre = \'Crime\' OR genre2.genre = \'Mystery\'))');
> INSERT INTO `customexample` VALUES ('Crime Mystery','LEFT JOIN programgenres ON program.chanid = programgenres.chanid AND program.starttime = programgenres.starttime','program.category = \'Crime drama\'\nOR ((program.category = \'Crime\' OR program.category = \'Mystery\')\n     AND programgenres.genre = \'Drama\')');
>

Thanks Bruce.  I will poor over these examples and figure out what
will work the best for me.

John


More information about the mythtv-users mailing list