Search code examples
pythonxbmc

How to set default view type in XBMC lists?


I am currently programming in python for XBMC, I found that an end user can change the view type of the list by using the left arrow and switching through the different available options. Is there a way I can specify in the source code which should be the default list view type?


Solution

  • You can switch the view type with this code:

    import xbmc
    xbmc.executebuiltin('Container.SetViewMode(%d)' % view_mode_id)
    

    where view_mode_id needs to be the integer ID of the desired view type. For a thumbnail-like view in most of skins you need to use 500.

    You should execute this command after adding ListItems and before calling endOfDirectory().