def setup_all( self ): self.getControl( MAIN_LABEL ).setLabel( "Radio RDS") openbm.setOnTitleChange(self.onTitleChange) openbm.setOnButtonFieldChange(self.onButtonFieldChange) openbm.setOnRadioStateChange(self.onRadioState) self.onRadioState(self.radioState) openbm.midReqUpdateFields()
def runRadioGUI(): # pause XBMC player xbmc.executebuiltin('XBMC.PlayerControl(play)') # show radio GUI uiMid = radio.GUI( "radio-skin.xml", _cwd) uiMid.setRadioState(_radioState) uiMid.doModal() del uiMid # resume if played before xbmc.executebuiltin('XBMC.PlayerControl(play)') # reset callback method openbm.setOnRadioStateChange(onRadioState) openbm.setOnMessage(onMessage)
def runRadioGUI(): # pause XBMC player xbmc.executebuiltin('XBMC.PlayerControl(play)') # show radio GUI uiMid = radio.GUI("radio-skin.xml", _cwd) uiMid.setRadioState(_radioState) uiMid.doModal() del uiMid # resume if played before xbmc.executebuiltin('XBMC.PlayerControl(play)') # reset callback method openbm.setOnRadioStateChange(onRadioState) openbm.setOnMessage(onMessage)
def setup_all(self): self.getControl(MAIN_LABEL).setLabel("Radio RDS") # try to connect to dbus, if fails, then error message try: openbm.setOnTitleChange(self.onTitleChange) openbm.setOnDisconnect(self.onStop) openbm.setOnButtonFieldChange(self.onButtonFieldChange) openbm.setOnRadioStateChange(self.onRadioState) openbm.setOnMessage(self.onIBusMessage) openbm.midEnableEmulation() openbm.start() openbm.midReqUpdateFields() except openbm.error, e: dialog = xbmcgui.Dialog() dialog.ok("connection to gateway failed", str(e)) xbmc.output(str(e), xbmc.LOGDEBUG)
def setup_all( self ): self.getControl( MAIN_LABEL ).setLabel( "Radio RDS") # try to connect to dbus, if fails, then error message try: openbm.setOnTitleChange(self.onTitleChange) openbm.setOnDisconnect(self.onStop) openbm.setOnButtonFieldChange(self.onButtonFieldChange) openbm.setOnRadioStateChange(self.onRadioState) openbm.setOnMessage(self.onIBusMessage) openbm.midEnableEmulation() openbm.start() openbm.midReqUpdateFields() except openbm.error,e: dialog = xbmcgui.Dialog() dialog.ok("connection to gateway failed", str(e)) xbmc.output(str(e), xbmc.LOGDEBUG)
#--------------------------------------------------------------------- # Main Function - run a daemon checking for actions on ibus # it will execute corresponding scripts based on ibus messages #--------------------------------------------------------------------- if ( __name__ == "__main__" ): # write file to lock execution (remove previous one) if os.path.exists(_processPID): os.remove(_processPID) file( _processPID , "w" ).write( "" ) try: openbm.setOnDisconnect(onDisconnect) openbm.midEnableEmulation() openbm.setOnRadioStateChange(onRadioState) openbm.setOnMessage(onMessage) _connectionLost = True # try to connect to IBus client, repeat the retries while (_connectionLost == True): try: openbm.start() _connectionLost = False xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,%s)"%("Connected", "BMW I-Bus connected...", bmwLogoSmallImg)) except openbm.error,e: xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,%s)"%("Wait for I-BUS", "BMW I-Bus not found, connect...", bmwLogoSmallImg)) xbmc.sleep(2000)
#--------------------------------------------------------------------- # Main Function - run a daemon checking for actions on ibus # it will execute corresponding scripts based on ibus messages #--------------------------------------------------------------------- if (__name__ == "__main__"): # write file to lock execution (remove previous one) if os.path.exists(_processPID): os.remove(_processPID) file(_processPID, "w").write("") try: openbm.setOnDisconnect(onDisconnect) openbm.midEnableEmulation() openbm.setOnRadioStateChange(onRadioState) openbm.setOnMessage(onMessage) # try to connect to IBus client, repeat the retries try: openbm.start() _connectionLost = False # perform greetings and say current time #xbmc.executebuiltin("XBMC.Notification(%s,%s,2000,'')"%("Settings", __settings__.getSetting( "speech.greetings"))) if (__settings__.getSetting("speech.greetings") == 'true'): now = datetime.datetime.now() greeting = "" if (now.hour < 4): greeting = 'Good night, ' elif (now.hour < 12):