[mythtv] MFDB XMLTV import does not follow XMLTV spec for "OriginalAirDate"

Robert Johnston anaerin at gmail.com
Thu Jul 29 01:44:01 UTC 2010


Currently, the code looks like this:

415	                QString prevdate = info.attribute("start");
416	                pginfo->originalairdate =
417	                    QDate::fromString(prevdate, Qt::ISODate);
418	            }

However, the XMLTV spec states:

All dates and times in this DTD follow the same format, loosely based
on ISO 8601.  They can be 'YYYYMMDDhhmmss' *or some initial substring*, 
for example if you only know the year and month you can have 'YYYYMM'. 
You can also append a timezone to the end; if no explicit timezone is 
given, UTC is assumed.  Examples: '200007281733 BST', '200209', 
'19880523083000 +0300'.  (BST == +0100.)

So, something like the following would be a better fit for this requirement:

416	                pginfo->originalairdate =
417  QDate::fromString(prevdate.append("00000000").left(8), "yyyyMMdd");
418	            }

(Spacing on line 417 truncated to avoid wrapping in e-mail)

As you're only storing it as a Date anyway (Not a DateTime), this is all 
that is required, and it is a simple 1-line change. You could even 
implement it as a simple check if the initial parse fails.

The sample data given in the XMLTV spec parses with this parser just 
fine. It's a minor issue, admittedly, but as it's such a minor change, 
it should be more than easy enough to implement.


More information about the mythtv-dev mailing list