(2021-12-01, 15:46)MetalChris Wrote: (2021-12-01, 04:17)jbinkley60 Wrote: If folks are having an issue displaying Live Events right now on the CBC Sports website the issue is a bad time format coming from CBC for the first Live Event in the list. It is a typo on their website. The end time for the first event is missing a colon in the time.
stt"12/01/2021 11:15 EST"
end"12/01/2021 1730 EST"
stt is the start time and end is the end time. You can see the missing colon.
I've added a check / fix for it in version 1.0.2f . This is a test release but addresses the issue. The fix will be rolled into the 1.0.2 production release.
Thanks,
Jeff
Just like the CBC to throw another wrench into the works...
Yea, I am not going to write a parser for every potential time format mismatch. I am going to do a couple of basic checks and then try to error out and skip an event if the time format is too mangled. One thing I've been struggling to find is a way for Python to catch an exception like this:
2021-12-01 07:32:18.681 T:57284 ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'ValueError'>
Error Contents: time data '12/01/2021 1730 ' does not match format '%m/%d/%Y %H:%M'
Traceback (most recent call last):
File "C:\Users\Audio1\AppData\Roaming\Kodi\addons\plugin.video.cbc-sports\addon.py", line 93, in INDEX
starttime = datetime.strptime(etime[:16],'%m/%d/%Y %H:%M')
TypeError: 'NoneType' object is not callable
A typical Python Try / Except won't catch it. Everything I found online said fix the time format. Duhhh, if I could control that I wouldn't have to account for a formatting error
Do you know any tricks ? For now I am going to check that the slashes and colon are in the right place and the string is 20 characters long. Beyond that I am not sure how bad they could butcher it up.
Jeff