def _onMessageList(self, message):
     # Show instantly if enabled
     if common.getSetting('handling_list',0) == 0 and pushhandler.canHandle(message):
         pushhandler.handlePush(message)
     elif common.getSetting('handling_list',0) == 1:
         self.showNotificationFromMessage(message)
     else:
         return False
     return True
Exemple #2
0
 def _onMessageAddress(self, message):
     # Show instantly if enabled
     if common.getSetting('handling_address',
                          0) == 0 and pushhandler.canHandle(message):
         pushhandler.handlePush(message)
     elif common.getSetting('handling_address', 0) == 1:
         self.showNotificationFromMessage(message)
     else:
         return False
     return True
    def handleMediaPush(self, media_type, message):
        # Check if instant play is enabled for the media type and play
        if media_type in ('video', 'audio', 'image'):
            if common.getSetting('handling_{0}'.format(media_type), 0) == 0:
                return pushhandler.handlePush(message)

        if common.getSetting('handling_{0}'.format(media_type), 0) == 1:
            self.showNotificationFromMessage(message)
            return True
        return False
    def handleMediaPush(self, media_type, message):
        # Check if instant play is enabled for the media type and play
        if media_type in ('video','audio','image'):
            if common.getSetting('handling_{0}'.format(media_type),0) == 0:
                return pushhandler.handlePush(message)

        if common.getSetting('handling_{0}'.format(media_type),0) == 1:
            self.showNotificationFromMessage(message)
            return True
        return False
 def _onMessageNote(self, message):
     if not self.executeKodiCmd(message):
         # Show instantly if enabled
         if common.getSetting('handling_note',0) == 0 and pushhandler.canHandle(message):
             pushhandler.handlePush(message)
         # else show notification if enabled
         elif common.getSetting('handling_note',0) == 1:
             self.showNotificationFromMessage(message)
         else:
             return False
     return True
Exemple #6
0
 def _onMessageNote(self, message):
     if not self.executeKodiCmd(message):
         # Show instantly if enabled
         if common.getSetting('handling_note',
                              0) == 0 and pushhandler.canHandle(message):
             pushhandler.handlePush(message)
         # else show notification if enabled
         elif common.getSetting('handling_note', 0) == 1:
             self.showNotificationFromMessage(message)
         else:
             return False
     return True
    def run(self):
        """
        Run or restart service.
        """

        if self.pushbullet:
            common.log('Restarting')
            self.pushbullet.close()

        try:
            if not self.stg_pbAccessToken or not self.stg_pbClientIden:
                raise Exception(common.localise(30100))

            from lib.pushbullet import Pushbullet

            # init pushbullet
            self.pushbullet = Pushbullet(
                access_token=self.stg_pbAccessToken,
                ping_timeout=6,
                last_modified=common.getSetting('last_modified', 0),
                last_modified_callback=self.setLastModified,
                log_callback=common.log)

            # get device info (also if edited by user on Pushbullet panel)
            self._getDevice()

            # setup service and pushbullet (iden, mirroring, filter)
            self._setupService()

            # start listening websocket
            self.pushbullet.realTimeEventStream(
                on_open=self.push2Notification.onOpen,
                on_message=self.push2Notification.onMessage,
                on_error=self.push2Notification.onError,
                on_close=self.push2Notification.onClose)

            common.log('Service started successfully')

        except Exception as ex:
            common.traceError()
            message = ' '.join(str(arg) for arg in ex.args)

            common.log(message, xbmc.LOGERROR)
            common.showNotification(common.localise(30101), message,
                                    self.serviceNotifcationTime)
    def run(self):
        """
        Run or restart service.
        """

        if self.pushbullet:
            common.log('Restarting')
            self.pushbullet.close()

        try:
            if not self.stg_pbAccessToken or not self.stg_pbClientIden:
                raise Exception(common.localise(30100))

            from lib.pushbullet import Pushbullet

            # init pushbullet
            self.pushbullet = Pushbullet(   access_token=self.stg_pbAccessToken,
                                            ping_timeout=6,
                                            last_modified=common.getSetting('last_modified',0),
                                            last_modified_callback=self.setLastModified,
                                            log_callback=common.log)

            # get device info (also if edited by user on Pushbullet panel)
            self._getDevice()

            # setup service and pushbullet (iden, mirroring, filter)
            self._setupService()

            # start listening websocket
            self.pushbullet.realTimeEventStream(on_open=self.push2Notification.onOpen,
                                                on_message=self.push2Notification.onMessage,
                                                on_error=self.push2Notification.onError,
                                                on_close=self.push2Notification.onClose)

            common.log('Service started successfully')

        except Exception as ex:
            common.traceError()
            message = ' '.join(str(arg) for arg in ex.args)

            common.log(message, xbmc.LOGERROR)
            common.showNotification(common.localise(30101), message, self.serviceNotifcationTime)