[mythtv] keyword-based recording

Bruce Markey bjm at lvcm.com
Mon Oct 17 23:57:17 UTC 2005

Chris Petersen wrote:
> Would someone like to explain to me how this works db-wise, so I can get 

Oo oo oo. Me ME! (waves hand in air)

> it added to mythweb?  Does it support regex, etc?

There are four search types that are identified by record.search .
See libs/libmythtv/recordingtypes.h . For these types, the 
record.description field holds the search string which is plugged
into the scheduler's SQL queries. How it is plugged in depends on
the type.

(2) kTitleSearch - puts wildcard "%"s around the description and
and plugs it into "program.title LIKE '%<description>%'"

      title: Junkyard%Wars (Title Search)
     search: 2
description: Junkyard%Wars

(3) kKeywordSearch - does essentially the same thing except it has
three clauses that look for the string in the program title, subtitle
and description.

      title: Japan (Keyword Search)
     search: 3
description: Japan

Would be plugged in like this:

  (program.title LIKE '%Japan%' 
   OR program.subtitle LIKE '%Japan%' 
   OR program.description LIKE '%Japan%)

(4) kPeopleSearch - Looks for a full name that matches the credits
for a program.

      title: Woody Allen (People Search)
     search: 4
description: Woody Allen

Only works with Data Direct because it joins the people and credits
tables to do something like this:

  AND people.name LIKE 'Woody Allen'
  AND credits.person = people.person

(1) kPowerSearch - doesn't impose any syntax for the string but
takes the description as the raw SQL to be plugged into the WHERE
clause of the scheduler query.

      title: Nova (Power Search)
     search: 1
description: program.title = 'Nova'

This searches for programs that match WHERE "program.title = 'Nova'"
or whatever valid SQL appears in the description field.

One thing you need to address for all search rules in mythweb. If
someone goes to a specific showing for one of the matching programs
then updates the rule, you do not want the show's description to
overwrite the rule's description(!). WHERE "program.title = 'Nova'"
works great. WHERE "Scientific research into...", not so good :-(.

Mythfrontend has hacks for special care for search titles, subtitles
and descriptions when filling in program info for programs that match
a search rule. See "searchtitle" in scheduledrecording.cpp .

> Any other new recording option type things that I've missed lately?

The protocol number was recently bumped up and AFAIK mythweb's was
too without any changes. You might want to investigate what prompted
MYTH_PROTO_VERSION 19 and see if something needs to be updated to
accommodate the change.

--  bjm

More information about the mythtv-dev mailing list