Kodi Community Forum
Home Main-Menu (Metro) move with RB/LB 360 Controller? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Skins Support (https://forum.kodi.tv/forumdisplay.php?fid=67)
+---- Forum: Skin Archive (https://forum.kodi.tv/forumdisplay.php?fid=179)
+----- Forum: Xperience1080 (https://forum.kodi.tv/forumdisplay.php?fid=197)
+----- Thread: Home Main-Menu (Metro) move with RB/LB 360 Controller? (/showthread.php?tid=176397)



Home Main-Menu (Metro) move with RB/LB 360 Controller? - AlterOdin - 2013-10-23

Hi all.

I currently investigating the possibles to map my RB og LB on my xbox 360 controller to move the main-menu in the Home section, regardless of where you are in the home section. (Metro View)

In example: If my focus is on EGP (sub-menu) on the LiveTV menu, RB should move to the next menu (Movies), and select the first submenu item.

Currently I have the following (note this is my first python experience).

Keymap:
Code:
<Home>
  <joystick name="Controller (XBOX 360 For Windows)">
      <button id="5">RunScript(special://masterprofile/HomeLeft.py)</button>
      <button id="6">RunScript(special://masterprofile/HomeRight.py)</button>
  </joystick>
  </Home>

Python:
Code:
import xbmc

xbmc.executebuiltin("Action(PageUp)")
xbmc.executebuiltin("Action(Up)")
xbmc.executebuiltin("Action(Left)")
xbmc.executebuiltin("Action(Down)")

This works "okay", but only if your focus is on the the sub-menus on the home section. If your focus is on the main menu, of power options (everywhere except the sub-menu), etc, it does not work as hoped (because the script logic is not good enough).

For a good script I was thinking of something like this (if all possible):
Code:
import xbmc

function to select/focus on the active main menu (search, livetv, movies, tvshows, settings, etc)
xbmc.executebuiltin("Action(Left)")
xbmc.executebuiltin("Action(Down)")

Is this possible?

Or another approach:
Code:
import xbmc
var id = _MAINMENUID
var currentfocusId = functionToGetWhereYouareNow

while(id != currentfocusId)
{
xbmc.executebuiltin("Action(Up)")
currentfocusId = functionToGetWhereYouareNow
}
xbmc.executebuiltin("Action(Left)")
xbmc.executebuiltin("Action(Down)")

Cheers.