Scripting output switching (hdmi/dvi/etc...) + Applying a work around

  • Hello.

    As there is a bug when switching output (cf Display bug when switching output from hdmi to dvi or dvi to hdmi) , I would like to script output change + applying work around.

    The script is launched from a keyboard shortcut configured in /storage/.kodi/userdata/keymaps/remote.xml

    Here is what I did so far :

    1st pyton script that change output :

    import xbmc, xbmcgui

    xbmc.executebuiltin('Dialog.Close(all,true)')

    xbmc.executebuiltin("ActivateWindow(systemsettings)")

    xbmc.executebuiltin("Action(Right)")

    xbmc.executebuiltin("Action(Select)")

    xbmc.executebuiltin('Dialog.Close(all,true)')


    It works, but I don't manage to close last dialogbox by confirming "Yes"

    Then I apply my workaround (change skin by script) :

    import xbmc, xbmcgui

    xbmc.executebuiltin('Dialog.Close(all,true)')

    xbmc.executebuiltin("ActivateWindow(interfacesettings)")

    xbmc.executebuiltin("Action(Right)")

    xbmc.executebuiltin("Action(Select)")

    xbmc.executebuiltin("Action(Down)")

    xbmc.executebuiltin("Action(Select)")

    xbmc.executebuiltin("Dialog.Close(all,true)")

    But same problem, I don't manage to confirm and close last dialogbox (Cf ConfirmSkinSwitch.jpg).

    Does anyone know how I could emulate confirmation to those dialogbox using xbmc.executebuiltin within my script?

    Thanks

  • vpeter:

    In fact I did try the pyton sleep command, but it did not work.

    And this xbmc sleep command is not documented here : List of built-in functions - Official Kodi Wiki

    I did try it, and it finally work:

    To change output :

    Python
    import xbmc, xbmcgui
    xbmc.executebuiltin('Dialog.Close(all,true)')
    xbmc.executebuiltin("ActivateWindow(systemsettings)")
    xbmc.executebuiltin("Action(Right)")
    xbmc.executebuiltin("Action(Select)")
    xbmc.sleep(4000)
    xbmc.executebuiltin("Action(Left)")
    xbmc.executebuiltin("Action(Select)")
    xbmc.sleep(2000)
    xbmc.executebuiltin("Action(Back)")

    And to apply work around (change skin, and change it back. Prerequisite : having 2 skin installed):

  • Agree, there should be some smarter way of doing this. Doesn't kodi restarts faster than 7 seconds?

    Or like trogggy suggested:

    Code
    kodi-send -a "ReloadSkin()"