[mythtv] PATCH - Regexp Based Categories

Martin Smith martin at spamcop.net
Sat Feb 14 09:54:40 EST 2004


I'm putting this patch forward for those using tv grabbers like tv_grab_uk_rt
that don't provide category information for shows.

It applies categories based on a local file of regular expressions. The patterns
are read from /usr/local/share/mythtv/autocat.txt. If this file doesn't exist
then nothing is done. I've included an example file that works for some UK TV
shows, but the approach should work in other countries too.

The way it works is that after mythfilldabase finishes its updates all programs
that have an empty category or have previously had a category set by
autocategorisation are examined. If the title matches one of the regular
expressions the corresponding category is assigned to it.

A new option to mythfilldatabase --autocat-only does just the above process so
running this after editing the pattern file safely applies the new rules to all
autocategorised programs.

For safety it will never override a category that has been set by a grabber.

This patch needs the SQL updates shown below


ALTER TABLE program ADD autocategory INT DEFAULT 0;

CREATE TABLE auto_categories
  pattern varchar(255) NOT NULL,
  category varchar(64) NOT NULL,
  PRIMARY KEY (pattern)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autocat.tar.gz
Type: application/x-gzip
Size: 3480 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040214/9e59da00/autocat.tar.bin

More information about the mythtv-dev mailing list