Re: Duplicate <rating> tags in sd_json output

Nick Morrott <[email protected]>
Newsgroups gmane.comp.tv.xmltv.devel
Message-ID <CAOQWjw1deP4CQ8t6xA2N2tsr++qgeCwx6Ouwdq0jrn44uyGsKg@mail.gmail.com>
On 23 May 2016 at 09:55, Ian Campbell <[email protected]> wrote:
> My mythfilldatabase runs are complaining:
>
>     2016-05-23 06:35:03.532635 E  DB Error (programrating insert):
>     Query was:
>     INSERT INTO programrating        ( chanid, starttime, system, rating) VALUES (?, ?,    ?,  ?)
>     Bindings were:
>     :CHANID=8173, :RATING="TVG", :START=2016-05-26T15:30:00Z,
>     :SYS="USA Parental Rating"
>     Driver error was [2/1062]:
>     QMYSQL3: Unable to execute statement
>     Database error was:
>     Duplicate entry '8173-2016-05-26 15:30:00-USA Pare-TVG' for key 'chanid'
>
> chaid=8173 is "BBC ONE East W" AKA xmltvid 24321 and indeed I see there
> are two identical <rating> tags in the XML (and two identical
> <presenter> FWIW):
>
>   <programme start="20160526153000 +0000" stop="20160526161500 +0000" channel="24321">
>     <title>Flog It!</title>
>     <sub-title>Sandon Hall 42</sub-title>
>     <desc>"Flog It!" [...].</desc>
>     <credits>
>       <presenter>Paul Martin</presenter>
>       <presenter>Paul Martin</presenter>
>     </credits>
>     <category>Collectibles</category>
>     <category>Auction</category>
>     <category>Arts/crafts</category>
>     <category>Series</category>
>     <category>series</category>
>     <episode-num system="xmltv_ns">13.44.</episode-num>
>     <episode-num system="dd_progid">EP012584290968</episode-num>
>     <audio>
>       <stereo>stereo</stereo>
>     </audio>
>     <previously-shown start="20160526000000 +0100" />
>     <new />
>     <subtitles type="teletext" />
>     <rating system="USA Parental Rating">
>       <value>TVG</value>
>     </rating>
>     <rating system="USA Parental Rating">
>       <value>TVG</value>
>     </rating>
>   </programme>
>
> which is reflected in the JSON
>
> [
>    {
>       "originalAirDate" : "2016-05-26",
>       "titles" : [
>          {
>             "title120" : "Flog It!"
>          }
>       ],
>       "contentRating" : [
>          {
>             "code" : "TVG",
>             "body" : "USA Parental Rating"
>          },
>          {
>             "body" : "USA Parental Rating",
>             "code" : "TVG"
>          }
>       ],
>       "programID" : "EP012584290968"
>
> I'm unsure if this is expected/allowed at any level and therefore who
> (mythtv, xmltv, sd) is expected to consolidate/tolerate them so I'll st
> art by reporting here.

Zero or more <rating> elements are permitted for a <programme> element
per the XMLTV DTD.

There's nothing in XMLTV.pm (which is the last place grabber data is
checked before writing to XML) to prevent writing identical (and
useless) <rating> elements. This could (and should) be improved to
ensure that no duplicate elements are output for a programme during
writing and can reach a consuming application like MythTV.

Robert K has stated this issue was an upstream error, so it appears no
software in the entire output chain was programmed to remove such
duplicates from the data output path :)

Cheers,
Nick

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.