Exemplo n.º 1
0
def preInstalledFirstRun():
    if not util.isPreInstalled(): #Do as little as possible if there is no pre-install
        if util.wasPreInstalled():
            util.LOG('PRE INSTALL: REMOVED')
            # Set version to 0.0.0 so normal first run will execute and fix the keymap
            util.setSetting('version','0.0.0')
            import enabler
            enabler.markPreOrPost() # Update the install status
        return False

    import enabler

    lastVersion = util.getSetting('version')

    if not enabler.isPostInstalled() and util.wasPostInstalled():
        util.LOG('POST INSTALL: UN-INSTALLED OR REMOVED')
        # Add-on was removed. Assume un-installed and treat this as a pre-installed first run to disable the addon
    elif lastVersion:
        enabler.markPreOrPost() # Update the install status
        return False

    # Set version to 0.0.0 so normal first run will execute on first enable
    util.setSetting('version','0.0.0')

    util.LOG('PRE-INSTALLED FIRST RUN')
    util.LOG('Installing basic keymap')

    # Install keymap with just F12 enabling included
    from lib import keymapeditor
    keymapeditor.installBasicKeymap()

    util.LOG('Pre-installed - DISABLING')

    enabler.disableAddon()
    return True
Exemplo n.º 2
0
def preInstalledFirstRun():
    if not util.isPreInstalled(): #Do as little as possible if there is no pre-install
        if util.wasPreInstalled():
            util.LOG('PRE INSTALL: REMOVED')
            # Set version to 0.0.0 so normal first run will execute and fix the keymap
            util.setSetting('version','0.0.0')
            import enabler
            enabler.markPreOrPost() # Update the install status
        return False

    import enabler

    lastVersion = util.getSetting('version')

    if not enabler.isPostInstalled() and util.wasPostInstalled():
        util.LOG('POST INSTALL: UN-INSTALLED OR REMOVED')
        # Add-on was removed. Assume un-installed and treat this as a pre-installed first run to disable the addon
    elif lastVersion:
        enabler.markPreOrPost() # Update the install status
        return False

    # Set version to 0.0.0 so normal first run will execute on first enable
    util.setSetting('version','0.0.0')

    util.LOG('PRE-INSTALLED FIRST RUN')
    util.LOG('Installing basic keymap')

    # Install keymap with just F12 enabling included
    from lib import keymapeditor
    keymapeditor.installBasicKeymap()

    util.LOG('Pre-installed - DISABLING')

    enabler.disableAddon()
    return True
Exemplo n.º 3
0
    def start(self):
        self.checkNewVersion()
        try:
            while (not xbmc.abortRequested) and (not self.stop):
                #Interface reader mode
                while self.readerOn and (not xbmc.abortRequested) and (
                        not self.stop):
                    xbmc.sleep(self.interval)
                    try:
                        self.checkForText()
                    except RuntimeError:
                        util.ERROR('start()', hide_tb=True)
                    except SystemExit:
                        if util.DEBUG:
                            util.ERROR('SystemExit: Quitting')
                        else:
                            util.LOG('SystemExit: Quitting')
                        break
                    except TTSClosedException:
                        util.LOG('TTSCLOSED')
                    except:  #Because we don't want to kill speech on an error
                        util.ERROR('start()', notify=True)
                        self.initState(
                        )  #To help keep errors from repeating on the loop

                #Idle mode
                while (not self.readerOn) and (not xbmc.abortRequested) and (
                        not self.stop):
                    try:
                        text, interrupt = self.noticeQueue.get_nowait()
                        self.sayText(text, interrupt)
                        self.noticeQueue.task_done()
                    except Queue.Empty:
                        pass
                    except RuntimeError:
                        util.ERROR('start()', hide_tb=True)
                    except SystemExit:
                        if util.DEBUG:
                            util.ERROR('SystemExit: Quitting')
                        else:
                            util.LOG('SystemExit: Quitting')
                        break
                    except TTSClosedException:
                        util.LOG('TTSCLOSED')
                    except:  #Because we don't want to kill speech on an error
                        util.ERROR('start()', notify=True)
                        self.initState(
                        )  #To help keep errors from repeating on the loop
                    for x in range(
                            5
                    ):  #Check the queue every 100ms, check state every 500ms
                        if self.noticeQueue.empty(): xbmc.sleep(100)
        finally:
            self._tts._close()
            self.end()
            util.playSound('off')
            util.LOG('SERVICE STOPPED')
            if self.disable:
                import enabler
                enabler.disableAddon()
Exemplo n.º 4
0
    def start(self):
        self.checkNewVersion()
        try:
            while (not xbmc.abortRequested) and (not self.stop):
                #Interface reader mode
                while self.readerOn and (not xbmc.abortRequested) and (not self.stop):
                    xbmc.sleep(self.interval)
                    try:
                        self.checkForText()
                    except RuntimeError:
                        util.ERROR('start()',hide_tb=True)
                    except SystemExit:
                        if util.DEBUG:
                            util.ERROR('SystemExit: Quitting')
                        else:
                            util.LOG('SystemExit: Quitting')
                        break
                    except TTSClosedException:
                        util.LOG('TTSCLOSED')
                    except: #Because we don't want to kill speech on an error
                        util.ERROR('start()',notify=True)
                        self.initState() #To help keep errors from repeating on the loop

                #Idle mode
                while (not self.readerOn) and (not xbmc.abortRequested) and (not self.stop):
                    try:
                        text, interrupt = self.noticeQueue.get_nowait()
                        self.sayText(text,interrupt)
                        self.noticeQueue.task_done()
                    except Queue.Empty:
                        pass
                    except RuntimeError:
                        util.ERROR('start()',hide_tb=True)
                    except SystemExit:
                        if util.DEBUG:
                            util.ERROR('SystemExit: Quitting')
                        else:
                            util.LOG('SystemExit: Quitting')
                        break
                    except TTSClosedException:
                        util.LOG('TTSCLOSED')
                    except: #Because we don't want to kill speech on an error
                        util.ERROR('start()',notify=True)
                        self.initState() #To help keep errors from repeating on the loop
                    for x in range(5): #Check the queue every 100ms, check state every 500ms
                        if self.noticeQueue.empty(): xbmc.sleep(100)
        finally:
            self._tts._close()
            self.end()
            util.playSound('off')
            util.LOG('SERVICE STOPPED')
            if self.disable:
                import enabler
                enabler.disableAddon()