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 error trapping #203

Closed misar1 closed 1 year ago

misar1 commented 1 year ago

xmltv.exe Ver 1.2 tv_grab_uk_tvguide Ver 2023-02-17.1139

My weekly EPG download aborted today with this error: Invalid local time for date in time zone: Europe/London A process of elimination shows that the problem is channel=926 ITVBe. If I remove it the grab works correctly.

This is probably a one-off error in a single programme related to the change to BST tonight. However, I raise it because it causes an entire 7 day grab to abort. It also happened with the same (final) day of my grab last week which I fixed by grabbing one day less. The xmltv.exe program and/or this script needs an error trap so that such errors are ignored (like channels with no programmes) rather than aborting the download.

honir commented 1 year ago

Yep this is something which has been considered many times. Due to the multitude of consuming apps/programs there is no reliable way of reporting errors to a downstream program.

The issue with silently ignoring an error is how do you know it has occurred? If you ignore an error how much reliance can you place on the rest of the data retrieved? (Obviously less of an issue where it appears localised to one channel, but suppose it was a general timezone problem such that many programmes in the 7-day fetch were an hour out - would you want to know, or do you want it to be silently ignored and your EPG to be one-hour off / have gaps?)

On balance, I think it is better to abort the fetch thereby bringing it to someone's attention, so it may be dealt with.

misar1 commented 1 year ago

I can't disagree as I am not the one putting in all the hard work on these applications (thank you) but that is a new take on error trapping in my programming experience. In support of my comment, the scripts already display warning messages about many other issues (eg no programmes found or programme duplication) without aborting.

It would at least help if the error message gave a bit more information such as the channel with the issue. I had to work it out approximately (from the percent completion and my .config list) then pin it down to 926 with trial and error by removing the most likely candidate(s).

honir commented 1 year ago

I'm glad you did pin it down as that helped me find the bug!

Although output to help with pin-pointing would undoubtedly be useful, it's not easy to do when the script isn't detecting the error itself (i.e. the error here came from Perls' timezone handler). Sometimes running with the option --debug can at least tell what was the last page being worked on prior to the crash.

Most times these scripts are run unattended (i.e. no human presence) so reporting errors is problematic...i.e. where to send them?

Bug fix version released into alpha.xmltv.exe

You can see that, if the problem you found had been silently ignored, the bug would have gone undetected.

misar1 commented 1 year ago

That was quick! Tested and OK - thanks.

honir commented 1 year ago

It's all thanks to your pointer of ITVBe :)