Error in the logs with "XBMC.Container.Update()"
#1
My plugin creates a view with an entry calling a function that ends with this code:

Code:
url = plugin.url_for('muestra_servidores')
    url = url.replace('"', '%22')  # Escapamos comillas

# Volvemos a la página principal, eliminando la historia
    return xbmc.executebuiltin('XBMC.Container.Update("%s", "replace")' %url)

It works as expected: Kodi calls the specified function in my plugin and the screen is correctly updated. Good.

The problem is that I am seeing this in the "kodi.log" file:

Code:
13:13:50 709.894470 T:1356854256  NOTICE: [xbmcswift2] Request for "/borrar_cache_all" matches rule for function "borrar_cache_all"
13:13:50 710.307007 T:1957262256   ERROR: GetDirectory - Error getting plugin://plugin.video.jcea/borrar_cache_all
13:13:50 710.310181 T:1957262256   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.jcea/borrar_cache_all) failed
13:13:53 713.128296 T:1739322352  NOTICE: [xbmcswift2] Request for "/" matches rule for function "muestra_servidores"

The first line is the invocation of my function. The last line is the effect of "XBMC.Container.Update()". My issue is the two middle lines.

Why I am seeing those errors and how to solve them?. Everything works fine, but those errors bug me.

Kodi 16.1 here.

Thanks.
Reply
#2
Thread moved to add-on development section
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#3
Show your full xbmcswift2 plugin route, not just a couple of unrelated strings if you want to get real help. But, as far as I understand, xbmcswift2 expects some return value from a route while xbmc.executebuiltin returns None.

And xbmcswift2 is long abandoned and outdated, so I strongly don't recommend to use it for any new plugins.
Reply
#4
Roman, thanks for the pointer. You are probably right, but I think that the code waiting a return value is not xbmcswift2 but Kodi core. The suggestion is good, nonetheless. I will explore the idea. Thanks.

This plugin has been in production since 2014. What would you suggest to replace xbmcswift2?. I am specially interested in the route logic. What addon helpers are being used by current addon developers?.

The relevant code is this.

In a view I create a link to the problematic function with this:

Code:
...
    items.append({
           'label': u'Actualizar todos los directorios',
            'path':plugin.url_for('borrar_cache_all')
        })

    return finish(items, add_sort = False)

And then the complete function is:

Code:
@plugin.route('/borrar_cache_all')
def borrar_cache_all() :
    for dummy, directorio in directorios :
        cache.drop(directorio)
    url = plugin.url_for('muestra_servidores')
    url = url.replace('"', '%22')  # Escapamos comillas

    # Volvemos a la página principal, eliminando la historia
    return xbmc.executebuiltin('XBMC.Container.Update("%s", "replace")' %url)

What should I return in this case, if I were not using xbmcswift2?

Thanks a lot!.
Reply
#5
(2016-08-13, 04:59)jcea Wrote: Roman, thanks for the pointer. You are probably right, but I think that the code waiting a return value is not xbmcswift2 but Kodi core.

Kodi core does not need any return value, it expects your plugin to do 1 of 3 possible actions: build a virtual directory, resolve a playable URL or do anything else. A possible action is defined by a combination of isFolder parameter values of of xbmcplugin.addDirectoryItem and 'IsPlayable' property of you ListItem. xbmcswift2 supports only variants 1 and 2, so the variant 3 which is your case gives an error. That is one of xbmcswift2's limitations. But you can simply ignore that error.


Quote:This plugin has been in production since 2014. What would you suggest to replace xbmcswift2?. I am specially interested in the route logic. What addon helpers are being used by current addon developers?.

I guess most of Kodi developers use ad-hoc solutions. There is an opinion that you shouldn't use any plugin frameworks to avoid lock-in to a library that can eventually be abandoned and broken after some Kodi Python API change. xbmcswift2 still works but it is abandoned long ago and there is no guarantee that it won' break after another Kodi Python API change. In fact, there is a strong possibility that in Krypton at least some of xbmcswift2's features won't work any more, like setting ListItem graphics (thumb, poster, fanart etc), because now all graphics must be set via ListItem.setArt and xbmcswift2 does not support this method.

Also there is a nice script.module.routing library that does only routing and nothing more, so you completely safe as far as Kodi Python API changes are concerned. You can use it for routing and do the rest via the plain Kodi Python API. The library is in the Kodi official repo so you can simply add it to your dependencies.

For my private projects I use my own plugin library that was influenced by xbmcswift2 but its latest version is not in the Kodi official repo (I'm too lazy to add it there), and once again, there is no guarantee that I won't abandon it eventually when my interests change.

Quote:The relevant code is this.

Code:
return xbmc.executebuiltin('XBMC.Container.Update("%s", "replace")' %url)

What should I return in this case, if I were not using xbmcswift2?

Nothing. The string
Code:
return xbmc.executebuiltin('XBMC.Container.Update("%s", "replace")' %url)
is simply wrong because xbmc.executebuiltin does not return anything, it has no return value (technically it returns None but it's essentially the same).
Reply

Logout Mark Read Team Forum Stats Members Help
Error in the logs with "XBMC.Container.Update()"0