XMLTV / xmltv

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

tv_grab_fi / telsu.fi / Grab fails when title is empty #121

Closed peltokukka closed 3 years ago

peltokukka commented 3 years ago

Grab from source telsu.fi fails on XMLTV 0.6.3 and tv_grab_fi when title of a programme is empty. This is kind of an error in program data is rare (this is the second time I've seen it), but unfortunately a single missing title will cause the entire run to exit.

An example of the error can be seen at https://www.telsu.fi/20201127 on channel MTV3 with the program starting at 02:40. The html source looks like this:

<a href="/" class="c6" rel="9116514" style="">02.40<b><em class="re" title="Ohjelma on uusinta.">u</em></b></a>

The \<b> element will be located successfully, but it contains no text data. Thus, an error will be thrown when creating a programme object: "fi::programme::new called without valid title or start at ...".

I successfully fixed the issue by adding the following at grab/fi/fi/source/telsu.pm inside the foreach-loop of the grab procedure after reading the $title = $title->as_text();:

if (length($title == 0)) {
  next;
}

I don't know perl and I don't know if this problem affects the other sources, and as such I leave it to the maintainers to decide if and how to fix the issue.

stefanb2 commented 3 years ago

Thanks for the report. Looks like two sources are missing the mandatory empty title check.

There really seems to be a TV series without a title, i.e. I can see the same empty title in the other sources too. Maybe it's just the usual data entry error.