[mythtv] db schema, metadata and season/episode numbering

Torbjörn Jansson torbjorn.jansson at mbox200.swipnet.se
Tue May 1 07:22:54 UTC 2012


> On 04/30/2012 06:25 PM, Torbjörn Jansson wrote:
> >> Since he's no longer here to block it I'd be interested in pushing
> >> forward, at
> >> least in the UK it's pretty decent information. There's no reason to
> >> simply
> >> ignore it, especially when the current metadata lookup is so hit and
> >> miss (tv
> >> espiodes frequently given film metadata and vice-versa), having
> >> season/episode
> >> information would either make it more reliable or as reliable, but
> >> certainly
> >> not less. Even if the air order differs from the order at tvdb.com
> >> (subtitle
> >> etc) can always take precedence over episode number.
> >>
> >> If nothing else it could be inserted as airepisode/airseason - let
> >> those of us
> >> who get this data use it in the UI and for sorting.
> > I'm all for it.
> > That’s why I started to look into this.
> >
> > What I have now is a bit of a hack and takes advantage of the
> syndicatedepisodenumber being updated with the right info by
> mythfilldatabase with the xmltv season and episode info.
> 
> You can't use syndicatedepisodenumber.  That's totally different--just
> because it sometimes has something we humans can identify as season and
> episode information doesn't mean that it always does.  It is the
> episode
> number as defined by the production company--whose format is chosen by
> the production company and is generally meaningless for a great number
> of shows.
> 
> You would need to add fields to hold season and episode to the program
> table.  Or, just wait for the changes I'm about to start making that
> completely change the entire schema we'll be using.
> 
> Also, you will have to worry about the fact that your listings provider
> will use different numbering schemes than ttvdb.com uses, so you'll
> likely need to fix all the metadata grabbers to "do the right thing" in
> the face of differences.
> 
> Mike

I know it is not the right way to do it.

But the reason it does work is because of this section in mythfilldatabase.
At around line 460 in xmltvparser.cpp:
----------
else if (info.attribute("system") == "xmltv_ns")
{

int tmp;
QString episodenum(getFirstText(info));
episode = episodenum.section('.',1,1);
episode = episode.section('/',0,0).trimmed();
season = episodenum.section('.',0,0).trimmed();
QString part(episodenum.section('.',2,2));
QString partnumber(part.section('/',0,0).trimmed());
QString parttotal(part.section('/',1,1).trimmed());

pginfo->categoryType = kCategorySeries;

if (!episode.isEmpty())
{
	tmp = episode.toInt() + 1;
	episode = QString::number(tmp);
	pginfo->syndicatedepisodenumber = QString('E' + episode);
}

if (!season.isEmpty())
{
	tmp = season.toInt() + 1;
	season = QString::number(tmp);
	pginfo->syndicatedepisodenumber.append(QString('S' + season));
}
----------

As you can see the episode and season is put into the syndicatedepisodenumber and in my case the only guide data I have is from xmltv (eit doesn’t count since it is not so good)

A proper fix is of course much better than my hack.




More information about the mythtv-dev mailing list