[mythtv] convergent tagging

Mark Brannan markbrannan at gmail.com
Fri Jul 18 06:47:43 UTC 2008

Hi everyone,

This is my first post to myth-dev.  Haven't worked on any open projects
before either so this is a little new for me...(please be gentle)

I've been wondering about implementing a unified tagging system that could
be shared across mythtv and any plugins.  I started out just wanting
something a little cleaner for mythgames but then it seemed that it would be
better to use a unified set of tags.   My thinking is that it would be nice
to attach any number of arbitrary 'tags' to my

For example, one might want to tag a game 'zelda', but could then query for
all music and pictures that share a 'zelda' tag.  I saw some old posts about
altering how 'genres' are handled in mythmusic which I suppose is along the
same lines, but I think a shared system of user defined tags is more
flexible and interesting for the long term.

I've mostly worked out the schema changes and am now looking at how each of
dbcheck.cpp and upgrade routines works.  Also, Is there some special
process/extra rigor involved in making schema changes or do you just test it
and do it?  --I'm used to code reviews/process compliance and formal schema
change requests at wok so...help me out here on the procedure.

Anyway, its pretty simple schema stuff...something like...

-- This table would be part of myth-proper but could be safely shared with
any plugins
create table MythTags
    tag_id      integer unsigned    not null    auto_increment,
    tag_name    varchar(128)        not null,
    CONSTRAINT  tags_pk             PRIMARY KEY (tag_id),
    CONSTRAINT  tags_uk1            UNIQUE KEY  (tag_name)

-- For tagging games, we'd probably want an easy to handle key than what is
current in gamemetadata
alter table gamemetadata add column
    game_id     integer unsigned    not null    auto_increment
    PRIMARY KEY first;

-- Then a table like maps games to tags...could be repeated for each diff
media type that needs tagging.
create table GameHasTag
    game_id     integer unsigned    not null,
    tag_id      integer unsigned    not null,
    CONSTRAINT  gamehastag_pk       PRIMARY KEY (game_id, tag_id),
    CONSTRAINT  gamehastag_fk1      FOREIGN KEY (game_id)   references
    CONSTRAINT  gamehastag_fk2      FOREIGN KEY (tag_id)    references

--Don't know how this would integrate with the UIs yet...maybe if the
routines to insert/associate the tags get implemented then someone else can
figure out the best place to put it on the screen.  I could also imagine
creating a separate genres and XyzHasGenre tables --maybe separate
gamegenres, musicgenres, videogenres, etc. though instead of a single

Can anyone confirm if any of this is good/bad idea before I go any further?
Would it be better to post to the wiki before making changes in svn?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20080718/b2b01b1e/attachment.htm 

More information about the mythtv-dev mailing list