Exemplo n.º 1
0
def main():
    if os.path.exists(
        os.path.join(
            xbmc.translatePath("special://profile").decode("utf-8"), "addon_data", "service.xbmc.tts", "DISABLED"
        )
    ):
        xbmc.log("service.xbmc.tts: DISABLED - NOT STARTING")
        return

    arg = None
    if len(sys.argv) > 1:
        arg = sys.argv[1] or False
    extra = sys.argv[2:]
    if arg and arg.startswith("key."):  # Deprecated in Gotham - now using NotifyAll
        command = arg[4:]
        from lib import util

        util.sendCommand(command)
    elif arg and arg.startswith("keymap."):
        command = arg[7:]
        from lib import keymapeditor

        keymapeditor.processCommand(command)
    elif arg == "settings_dialog":
        from lib import util

        util.selectSetting(*extra)
    elif arg == "player_dialog":  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util

        util.selectPlayer(*extra)
    elif arg == "backend_dialog":  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util

        util.selectBackend()
    elif arg == "settings":  # No longer used, using XBMC.Addon.OpenSettings(service.xbmc.tts) in keymap instead
        from lib import util

        util.xbmcaddon.Addon().openSettings()
    elif arg is None:
        from service import startService

        startService()
Exemplo n.º 2
0
 def processCommand(self,command,data=None):
     from lib import util #Earlier import apparently not seen when called via NotifyAll
     util.LOG(command)
     if command == 'REPEAT':
         self.repeatText()
     elif command == 'EXTRA':
         self.sayExtra()
     elif command == 'ITEM_EXTRA':
         self.sayItemExtra()
     elif command == 'VOL_UP':
         self.volumeUp()
     elif command == 'VOL_DOWN':
         self.volumeDown()
     elif command == 'STOP':
         self.stopSpeech()
     elif command == 'SHUTDOWN':
         self.shutdown()
     elif command == 'SAY':
         if not data: return
         args = json.loads(data)
         if not args: return
         text = args.get('text')
         if text:
             self.queueNotice(util.safeDecode(text),args.get('interrupt'))
     elif command == 'SETTINGS.BACKEND_DIALOG':
         util.runInThread(util.selectBackend,name='SETTINGS.BACKEND_DIALOG')
     elif command == 'SETTINGS.PLAYER_DIALOG':
         if not data: return
         args = json.loads(data)
         if not args: return
         backend = args.get('backend')
         util.selectPlayer(backend)
     elif command == 'SETTINGS.SETTING_DIALOG':
         if not data: return
         args = json.loads(data)
         util.selectSetting(*args)
Exemplo n.º 3
0
 def processCommand(self,command,data=None):
     from lib import util #Earlier import apparently not seen when called via NotifyAll
     util.LOG(command)
     if command == 'REPEAT':
         self.repeatText()
     elif command == 'EXTRA':
         self.sayExtra()
     elif command == 'ITEM_EXTRA':
         self.sayItemExtra()
     elif command == 'VOL_UP':
         self.volumeUp()
     elif command == 'VOL_DOWN':
         self.volumeDown()
     elif command == 'STOP':
         self.stopSpeech()
     elif command == 'SHUTDOWN':
         self.shutdown()
     elif command == 'SAY':
         if not data: return
         args = json.loads(data)
         if not args: return
         text = args.get('text')
         if text:
             self.queueNotice(util.safeDecode(text),args.get('interrupt'))
     elif command == 'SETTINGS.BACKEND_DIALOG':
         util.runInThread(util.selectBackend,name='SETTINGS.BACKEND_DIALOG')
     elif command == 'SETTINGS.PLAYER_DIALOG':
         if not data: return
         args = json.loads(data)
         if not args: return
         backend = args.get('backend')
         util.selectPlayer(backend)
     elif command == 'SETTINGS.SETTING_DIALOG':
         if not data: return
         args = json.loads(data)
         util.selectSetting(*args)
Exemplo n.º 4
0
def main():
    if os.path.exists(
            os.path.join(
                xbmc.translatePath('special://profile').decode('utf-8'),
                'addon_data', 'service.xbmc.tts', 'DISABLED')):
        xbmc.log('service.xbmc.tts: DISABLED - NOT STARTING')
        return

    arg = None
    if len(sys.argv) > 1:
        arg = sys.argv[1] or False
    extra = sys.argv[2:]
    if arg and arg.startswith(
            'key.'):  # Deprecated in Gotham - now using NotifyAll
        command = arg[4:]
        from lib import util
        util.sendCommand(command)
    elif arg and arg.startswith('keymap.'):
        command = arg[7:]
        from lib import keymapeditor
        keymapeditor.processCommand(command)
    elif arg == 'settings_dialog':
        from lib import util
        util.selectSetting(*extra)
    elif arg == 'player_dialog':  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util
        util.selectPlayer(*extra)
    elif arg == 'backend_dialog':  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util
        util.selectBackend()
    elif arg == 'settings':  # No longer used, using XBMC.Addon.OpenSettings(service.xbmc.tts) in keymap instead
        from lib import util
        util.xbmcaddon.Addon().openSettings()
    elif arg is None:
        from service import startService
        startService()
Exemplo n.º 5
0
        arg = sys.argv[1] or False
    extra = sys.argv[2:]
    if arg and arg.startswith("key."):  # Deprecated in Gotham - now using NotifyAll
        command = arg[4:]
        from lib import util

        util.sendCommand(command)
    elif arg and arg.startswith("keymap."):
        command = arg[7:]
        from lib import keymapeditor

        keymapeditor.processCommand(command)
    elif arg == "settings_dialog":
        from lib import util

        util.selectSetting(*extra)
    elif arg == "player_dialog":  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util

        util.selectPlayer(*extra)
    elif arg == "backend_dialog":  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util

        util.selectBackend()
    elif arg == "settings":  # No longer used, using XBMC.Addon.OpenSettings(service.xbmc.tts) in keymap instead
        from lib import util

        util.xbmcaddon.Addon().openSettings()
    elif arg is None:
        from service import TTSService
Exemplo n.º 6
0
if __name__ == '__main__':
    arg = None
    if len(sys.argv) > 1:
        arg = sys.argv[1] or False
    extra = sys.argv[2:]
    if arg and arg.startswith(
            'key.'):  # Deprecated in Gotham - now using NotifyAll
        command = arg[4:]
        from lib import util
        util.sendCommand(command)
    elif arg and arg.startswith('keymap.'):
        command = arg[7:]
        from lib import keymapeditor
        keymapeditor.processCommand(command)
    elif arg == 'settings_dialog':
        from lib import util
        util.selectSetting(*extra)
    elif arg == 'player_dialog':  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util
        util.selectPlayer(*extra)
    elif arg == 'backend_dialog':  # Deprecated in 0.0.86 - now using NotifyAll
        from lib import util
        util.selectBackend()
    elif arg == 'settings':  # No longer used, using XBMC.Addon.OpenSettings(service.xbmc.tts) in keymap instead
        from lib import util
        util.xbmcaddon.Addon().openSettings()
    elif arg is None:
        from service import TTSService
        TTSService().start()