def handleIncomingCall(self, line): if line.number_called in self.Mon.exnum_list: self.__hide = True return self.handlePlayerProps('incoming') if len(line.number_caller) > 0: caller_num = line.number_caller tools.writeLog( 'trying to resolve name from incoming number %s' % (caller_num), xbmc.LOGNOTICE) record = self.getRecordByNumber(caller_num) name = record['name'] icon = __IconOk__ if record['imageBMP'] == '' else record[ 'imageBMP'] if not name: name = self.getNameByKlickTel(caller_num) if name: icon = __IconKlickTel__ else: icon = __IconUnknown__ name = __LS__(30012) else: name = __LS__(30012) caller_num = __LS__(30016) icon = __IconUnknown__ tools.writeLog('Incoming call from %s (%s)' % (name, caller_num), xbmc.LOGNOTICE) tools.notify(__LS__(30010), __LS__(30011) % (name, caller_num), icon, self.Mon.dispMsgTime)
def connect(self, notify=False): if self.__s is not None: self.__s.close() self.__s = None try: self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__s.settimeout(30) self.__s.connect((self.Mon.server, LISTENPORT)) except socket.error as e: if notify: tools.notify(__LS__(30030), __LS__(30031) % (self.Mon.server, LISTENPORT), __IconError__) tools.writeLog('Could not connect to %s:%s' % (self.Mon.server, LISTENPORT), level=xbmc.LOGERROR) tools.writeLog('%s' % (e), level=xbmc.LOGERROR) return False except Exception as e: tools.writeLog('%s' % (e), level=xbmc.LOGERROR) return False else: tools.writeLog( 'Connected, listen to %s on port %s' % (self.Mon.server, LISTENPORT), xbmc.LOGNOTICE) self.__s.settimeout(0.2) return True
def handleIncomingCall(self, line): if line.number_called in self.Mon.exnum_list: self.__hide = True return self.handlePlayerProps('incoming') if len(line.number_caller) > 0: caller_num = line.number_caller tools.writeLog( 'trying to resolve name from incoming number %s' % (tools.mask(caller_num)), xbmc.LOGNOTICE) record = self.getRecordByNumber(caller_num) name = record['name'] icon = ICON_OK if record['imageBMP'] == '' else record['imageBMP'] if not name: name = LOC(30012) icon = ICON_UNKNOWN else: caller_num = LOC(30016) name = LOC(30012) icon = ICON_UNKNOWN tools.writeLog( 'Incoming call from %s (%s)' % (tools.mask(name), tools.mask(caller_num)), xbmc.LOGNOTICE) tools.notify(LOC(30010), LOC(30011) % (name, caller_num), icon, self.Mon.dispMsgTime, deactivateSS=True)
def connect(self, notify=False): if self.__s is not None: self.__s.close() self.__s = None try: self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__s.settimeout(30) self.__s.connect((self.Mon.server, LISTENPORT)) except socket.error, e: if notify: tools.notify(LOC(30030), LOC(30031) % (self.Mon.server, LISTENPORT), ICON_ERROR) tools.writeLog('Could not connect to %s:%s' % (self.Mon.server, LISTENPORT), level=xbmc.LOGERROR) tools.writeLog(e.message, level=xbmc.LOGERROR) return False
def handleOutgoingCall(self, line): if line.number_used in self.Mon.exnum_list: self.__hide = True return if self.Mon.optShowOutgoing: self.handlePlayerProps('outgoing') record = self.getRecordByNumber(line.number_called) name = __LS__(30012) if record['name'] == '' else record['name'] icon = __IconDefault__ if record['imageBMP'] == '' else record[ 'imageBMP'] tools.notify(__LS__(30013), __LS__(30014) % (name, line.number_called), icon) tools.writeLog( 'Outgoing call from %s to %s' % (line.number_used, line.number_called), xbmc.LOGNOTICE)
def handleOutgoingCall(self, line): if line.number_used in self.Mon.exnum_list: self.__hide = True return if self.Mon.optShowOutgoing: self.handlePlayerProps('outgoing') record = self.getRecordByNumber(line.number_called) name = LOC(30012) if record['name'] == '' else record['name'] icon = ICON_OK if record['imageBMP'] == '' else record['imageBMP'] tools.notify(LOC(30013), LOC(30014) % (name, line.number_called), icon, deactivateSS=True) tools.writeLog( 'Outgoing call from %s to %s' % (tools.mask(line.number_used), tools.mask(line.number_called)), xbmc.LOGNOTICE)
def getPhonebook(self): if self.__phoneBookFacade is None: self.__phoneBookFacade = PhoneBookFacade(imagepath=__ImageCache__) setting_keys = self.__phoneBookFacade.get_setting_keys() for key in setting_keys: setting_keys[key] = __addon__.getSetting(key) self.__phoneBookFacade.set_settings(setting_keys) if self.__phonebook is None: try: self.__phonebook = self.__phoneBookFacade.getPhonebook() tools.writeLog( '%s entries from %s loaded, %s images cached' % (len(self.__phonebook), self.Mon.server, self.__phoneBookFacade.imagecount()), xbmc.LOGNOTICE) except self.__phoneBookFacade.HostUnreachableException: tools.writeLog('Host %s unreachable' % (self.Mon.server), level=xbmc.LOGERROR) tools.notify(__LS__(30030), __LS__(30031) % (self.Mon.server, LISTENPORT), __IconError__) except self.__phoneBookFacade.LoginFailedException: tools.writeLog('Login failed. Check username/password', level=xbmc.LOGERROR) tools.notify(__LS__(30033), __LS__(30034), __IconError__) except self.__phoneBookFacade.InternalServerErrorException: tools.writeLog('Internal server error', level=xbmc.LOGERROR) tools.notify(__LS__(30035), __LS__(30036), __IconError__)