Kodi Community Forum

Full Version: listitem setinfo date bug
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I believe I've found a bug, but wondering if this is expected or not, or if there's a workaround.

I pass dates to Kodi listitems via a dictionary:
python:

li.setInfo(media_type,{'date':parsed_date})

The docs state the format needs to be:
date string (d.m.Y / 01.01.2009) - file date

So I have a function that parses an unformatted date I get from outside sources:
python:

try:
return date_parser.parse(date_in).strftime('%d.%m.%Y')
except:
return None

The problem is, when I recieve garbage from my outside source, (for example date_in = 'blah'), then when I pass None to setinfo date the logs are spammed with:
python:

ERROR <general>: NEWADDON Invalid Date Format ""

Is there a value I can pass to setinfo that will both be valid and be "None"? Since I can't control the data I receive, I need to have a fallback value to be able to pass.

Thanks in advance for any suggestions.
can't you simply omit the date when it's invalid?
python:

info = {}
info['title'] = title
info['genre'] = genre
if parsed_date:
    info['date'] = parsed_date

li.setInfo(media_type,info)
(2020-09-13, 00:13)ronie Wrote: [ -> ]can't you simply omit the date when it's invalid?
python:

info = {}
info['title'] = title
info['genre'] = genre
if parsed_date:
    info['date'] = parsed_date

li.setInfo(media_type,info)

Thanks. Yes I could do that, but from a coding standpoint, I pass all info tags in one dict:
python:

li.setInfo(media_type,dict_in.get('info'))
Where dict_in contains a bunch of info tags (roughly 20). This appears to be the only one that complains when it's passed None.
looking at the source-code: https://github.com/xbmc/xbmc/blob/master...#L439-L450
kodi will only log the error if the date string isn't 10 characters long.
so try to set it to 10 spaces:
python:
li.setInfo('video', {'date': '          '})