Hi @Collabsvito , since roughly two weeks some categories are not displayed anymore, especially the "10 years" and "all" categories. The log documents the following error:
2023-12-20 20:45:03.311 T:2513 error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'KeyError'>
Error Contents: 'mediumBrandImageUrl'
Traceback (most recent call last):
File "/home/kodi/.kodi/addons/plugin.video.kika_de/default.py", line 70, in <module>
run()
File "/home/kodi/.kodi/addons/plugin.video.kika_de/default.py", line 55, in run
navigator.listShows(url, extras)
File "/home/kodi/.kodi/addons/plugin.video.kika_de/resources/lib/navigator.py", line 55, in listShows
addDir(name, item['mediumBrandImageUrl'], {'mode': 'listEpisodes', 'url': item['_links']['videos']['href']}, item['description'], item['largeTeaserImageUrl'])
~~~~^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'mediumBrandImageUrl'
-->End of Python script error report<--
2023-12-20 20:45:03.392 T:2512 error <general>: GetDirectory - Error getting plugin://plugin.video.kika_de/?mode=listShows&url=%2fapi%2fbrands%3foffset%3d0%26limit%3d100%26orderBy%3dtitle%26orderDirection%3dasc
2023-12-20 20:45:03.406 T:1049 error <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.kika_de/?mode=listShows&url=%2fapi%2fbrands%3foffset%3d0%26limit%3d100%26orderBy%3dtitle%26orderDirection%3dasc) failed
I figured out that one show is missing the mediumBrandImageUrl ("Schloss Webstein") provided by the API. I added some checks to prevent this in the future (but this obviously only a workaround and practically more hardening would be required).
def listShows(url, EXTRA):
xbmcplugin.addSortMethod(ADDON_HANDLE, xbmcplugin.SORT_METHOD_LABEL)
debug_MS("(navigator.listShows) ------------------------------------------------ START = listShows -----------------------------------------------")
content = {'_links': {'next': {'href': url}}}
i=0
while 'next' in content['_links']:
content = getUrl(MOBIL_API+content['_links']['next']['href'])
for item in content['_embedded']['items']:
name = translation(30621).format(item['title'], str(item['totalVideos'])) if item.get('totalVideos', '') else item['title']
if 'mediumBrandImageUrl' in item: imageURL = item['mediumBrandImageUrl']
else:
imageURL = item['mediumTeaserImageUrl']
log('mediumBrandImageUrl was not available for ' + name)
try:
addDir(name, imageURL, {'mode': 'listEpisodes', 'url': item['_links']['videos']['href']}, item['description'], item['largeTeaserImageUrl'])
debug_MS("(navigator.listShows[1]) no.01 ##### GROUP : {} || TITLE : {} || THUMB : {} #####".format(str(item['targetGroup']), name, imageURL))
except KeyError:
failing('Error retrieving data for ' + name + ': ' + str(i))
i+=1
if EXTRA == 'nopager':
break
xbmcplugin.endOfDirectory(ADDON_HANDLE)
if forceView:
xbmc.executebuiltin('Container.SetViewMode('+viewIDShows+')')
Hi @Collabsvito , since roughly two weeks some categories are not displayed anymore, especially the "10 years" and "all" categories. The log documents the following error:
I figured out that one show is missing the mediumBrandImageUrl ("Schloss Webstein") provided by the API. I added some checks to prevent this in the future (but this obviously only a workaround and practically more hardening would be required).