XMLTV / xmltv

Utilities to obtain, generate, and post-process TV listings data in XMLTV format
GNU General Public License v2.0
266 stars 93 forks source link

tv_grab_uk_tvguide xml "file is not valid according to the xmltv dtd" #195

Closed FizzyTea closed 1 year ago

FizzyTea commented 1 year ago

Thanks for taking the time to report an issue. Please take a moment to review our open/closed issues above, in case your issue has already been reported.

If you are reporting a new issue, please give your issue a descriptive title and fill out the blanks below, providing as much information as possible.

XMLTV Version?

XMLTV module version 1.1.2

XMLTV Component?

tv_grab_uk_tvguide version 1.1.2 tv_validate_file version 1.1.2

Perl Version

Perl v5.28.1

Operating System

Raspbian 10 Buster

What happened?

After producing the xml file with tv_grab_uk_tvguide --days 2 --nodetailspage | tv_sort > listings.xml (or indeed without using --nodetailspage option or piping to tv_sort) I run the command tv_validate_file listings.xml I get the following errors (full output attached)

The file is not valid according to the xmltv dtd:
 listings.xml:544: validity error : Element programme content does not follow the DTD, expecting (title+ , sub-title* , desc* , credits? , date? , category* , keyword* , language? , orig-language? , length? , icon* , url* , country* , episode-num* , video? , audio? , previously-shown? , premiere? , last-chance? , new? , subtitles* , rating* , star-rating* , review*), got (title sub-title desc category category url episode-num subtitles star-rating image )
listings.xml:556: validity error : No declaration for element image
listings.xml:556: validity error : No declaration for attribute type of element image
listings.xml:556: validity error : No declaration for attribute system of element image
listings.xml:558: validity error : Element programme content does not follow the DTD, expecting (title+ , sub-title* , desc* , credits? , date? , category* , keyword* , language? , orig-language? , length? , icon* , url* , country* , episode-num* , video? , audio? , previously-shown? , premiere? , last-chance? , new? , subtitles* , rating* , star-rating* , review*), got (title sub-title desc credits category category url episode-num star-rating image )
listings.xml:574: validity error : No declaration for element image
listings.xml:574: validity error : No declaration for attribute type of element image
listings.xml:574: validity error : No declaration for attribute system of element image

Relevant lines of xml (lines 544-575)

  <programme start="20230124100000 +0000" channel="520.tvguide.co.uk">
    <title lang="en">Unforgettable</title>
    <sub-title lang="en">A Moveable Feast</sub-title>
    <desc lang="en">Carrie and Al race against time as they investigate the link between the death of a coastguard officer and the disappearance of dangerous explosives.</desc>
    <category lang="en">Detective</category>
    <category lang="en">Thriller</category>
    <url>https://www.tvguide.co.uk/detail/2177478/81235121/unforgettable</url>
    <episode-num system="xmltv_ns">2.4/13.</episode-num>
    <subtitles type="teletext" />
    <star-rating>
      <value>7.1/10</value>
    </star-rating>
    <image type="backdrop" system="tvguide">https://cdn.tvguide.co.uk/HighlightImages/Large/unforgettable.jpg</image>
  </programme>
  <programme start="20230124110000 +0000" channel="520.tvguide.co.uk">
    <title lang="en">Person of Interest</title>
    <sub-title lang="en">Baby Blue</sub-title>
    <desc lang="en">Finch is surprised when the Machine directs him to an abandoned six-month-old girl with an anonymous benefactor. Meanwhile, Mob boss Carl Elias continues to flex his muscles, and Carter and Reese make his father Gianni Moretti an offer - if he testifies against his son, he will be given full protection. Drama, starring Jim Caviezel, Michael Emerson and Mark Margolis.</desc>
    <credits>
      <actor>Jim Caviezel</actor>
      <actor>Michael Emerson</actor>
      <actor>Mark Margolis</actor>
    </credits>
    <category lang="en">Detective</category>
    <category lang="en">Thriller</category>
    <url>https://www.tvguide.co.uk/detail/1758900/81235113/person-of-interest</url>
    <episode-num system="xmltv_ns">0.16/23.</episode-num>
    <star-rating>
      <value>7.7/10</value>
    </star-rating>
    <image type="backdrop" system="tvguide">https://cdn.tvguide.co.uk/HighlightImages/Large/person_of_interest.jpg</image>
  </programme>

Full xml file and validation output attached

What did you expect to happen?

I expect the grabber to produce valid xml which I can view using my epg program. I cannot view the produced xml file with my epg viewer.

Did you see any warnings/errors?

(Please paste any warnings/errors, if available) …

What steps are needed to reproduce this issue?

(Please provide the full commands you are running)

  1. tv_grab_uk_tvguide --days 2 --nodetailspage | tv_sort > listings.xml
  2. tv_validate_file listings.xml

OR

  1. tv_grab_uk_tvguide --days 2 --output listings.xml
  2. tv_validate_file listings.xml

Please attach your config file below:

(Remember to remove any usernames/passwords) …

Any other information?

I don't really see what the problem is due to lack of knowledge and experience of the xmltv spec but it appears to me the listings which cause a problem contain an image. Though the error complains "No declaration for element image", "No declaration for attribute type of element image", and "No declaration for attribute system of element image" it appears they do indeed contain these declarations but perhaps they are invalid in a way I am not seeing?

I could not upload a file with a .xml extension so added .txt to it.

listings.xml.txt

validation.txt

honir commented 1 year ago

It seems you are using an out-of-date version of the DTD (the file used by tv_validate_file containing the xml specification).

You can get the current DTD file here: https://github.com/XMLTV/xmltv/blob/master/xmltv.dtd

You can force use of this file by tv_validate_file --dtd-file xmltv.dtd listings.xml

XMLTV version 1.0.1 introduced the following changes:

  * xmltv.dtd:           add 'system' attribute to 'url' element
                         add 'image' element to 'programme'
                         add 'image' and 'url' as sub-elements to credits