index 65d630f..4ec57b1 100644 --- "a/__init__.py" +++ "b/__init__.py" @@ -1032,6 +1032,18 @@ class SendNotification(eg.ActionClass): while panel.Affirmed(): panel.SetResult(Title.GetValue(), Message.GetValue()) +class Get3DMode(eg.ActionClass): + description = 'Get GUI rendering mode (3D or 2D). After this action, either "Kodi.2D" or "Kodi.3D" event will be triggered' + + def __call__(self): + response = self.plugin.JSON_RPC.send('GUI.GetProperties', json.loads('{"properties": ["stereoscopicmode"]}')) + if response.has_key("result"): + mode = response["result"]["stereoscopicmode"]["mode"] + if mode == "off" or mode == "monoscopic": + eg.TriggerEvent('Kodi.2D') + else: + eg.TriggerEvent('Kodi.3D') + class HTTPAPI(eg.ActionClass): description = "Run any XBMC HTTP API command." @@ -1532,6 +1544,7 @@ class XBMC2(eg.PluginClass): TestGroup.AddAction(BuiltInFunctions) TestGroup.AddAction(GetCurrentlyPlayingFilename) TestGroup.AddAction(SendNotification) + TestGroup.AddAction(Get3DMode) # self.AddAction(StopRepeating) self.xbmc = XBMCClient("EventGhost")