Beispiel #1
0
 def enable_gtts(self):
     """
     Use google text to speech for every text passed to jarvis.say()
     """
     self.update_data('gtts_status', True)
     g = self.get_data('gtts_status')
     self.speech = create_voice(self, g, rate=120)
    def __init__(self,
                 first_reaction_text,
                 prompt,
                 directories=[],
                 first_reaction=True,
                 enable_voice=False):
        """
        This constructor contains a dictionary with Jarvis Actions (what Jarvis can do).
        In alphabetically order.
        """
        Cmd.__init__(self)
        self.first_reaction = first_reaction
        self.first_reaction_text = first_reaction_text
        self.prompt = prompt
        self.enable_voice = enable_voice
        # Register do_quit() function to SIGINT signal (Ctrl-C)
        signal.signal(signal.SIGINT, self.interrupt_handler)

        self.memory = Memory()
        self.scheduler = schedule.Scheduler()
        self.speech = create_voice()

        self.fixed_responses = {
            "what time is it": "clock",
            "where am i": "pinpoint",
        }

        self._api = JarvisAPI(self)
        self._plugin_manager = PluginManager()

        for directory in directories:
            self._plugin_manager.add_directory(directory)

        self._activate_plugins()
        self._init_plugin_info()
Beispiel #3
0
    def __init__(self,
                 first_reaction_text,
                 prompt,
                 directories=[],
                 first_reaction=True):
        """
        This constructor contains a dictionary with Jarvis Actions (what Jarvis can do).
        In alphabetically order.
        """
        Cmd.__init__(self)
        command = " ".join(sys.argv[1:]).strip()
        self.first_reaction = first_reaction
        self.first_reaction_text = first_reaction_text
        self.prompt = prompt
        if (command):
            self.first_reaction = False
            self.first_reaction_text = ""
            self.prompt = ""
        # Register do_quit() function to SIGINT signal (Ctrl-C)
        signal.signal(signal.SIGINT, self.interrupt_handler)

        self.memory = Memory()
        self.scheduler = schedule.Scheduler()
        self._api = JarvisAPI(self)
        self.say = self._api.say

        # Remember voice settings
        self.enable_voice = self._api.get_data('enable_voice')
        self.speech_rate = self._api.get_data('speech_rate')

        if not self.speech_rate:
            self.speech_rate = 120

        # what if the platform does not have any engines, travis doesn't have sapi5 acc to me

        try:
            gtts_status = self._api.get_data('gtts_status')
            self.speech = create_voice(self,
                                       gtts_status,
                                       rate=self.speech_rate)
        except Exception as e:
            self.say("Voice not supported", Fore.RED)
            self.say(str(e), Fore.RED)

        self.fixed_responses = {
            "what time is it": "clock",
            "where am i": "pinpoint",
        }

        self._plugin_manager = PluginManager()

        for directory in directories:
            self._plugin_manager.add_directory(directory)

        if (not command):
            self._init_plugin_info()
        self._activate_plugins()

        if self.first_reaction:
            self._api.say(self.first_reaction_text)
Beispiel #4
0
 def enable_voice(self):
     """
     Use text to speech for every text passed to jarvis.say()
     """
     g = self.get_data('gtts_status')
     self._jarvis.speech = create_voice(self, g, rate=120)
     self._jarvis.enable_voice = True
     self.update_data('enable_voice', True)
Beispiel #5
0
    def __init__(self,
                 first_reaction_text,
                 prompt,
                 directories=[],
                 first_reaction=True,
                 enable_voice=False):
        """
        This constructor contains a dictionary with Jarvis Actions (what Jarvis can do).
        In alphabetically order.
        """
        Cmd.__init__(self)
        self.first_reaction = first_reaction
        self.first_reaction_text = first_reaction_text
        self.prompt = prompt
        self.enable_voice = enable_voice
        # Register do_quit() function to SIGINT signal (Ctrl-C)
        signal.signal(signal.SIGINT, self.interrupt_handler)

        self.memory = Memory()
        self.scheduler = schedule.Scheduler()
        self.speech = create_voice()

        self.actions = [
            {
                "check": ("ram", "weather", "time", "forecast")
            },
            "directions",
            "help",
            "how_are_you",
            "near",
            "pinpoint",
            "umbrella",
            {
                "update": ("location", "system")
            },
            "weather",
        ]

        self.fixed_responses = {
            "what time is it": "clock",
            "where am i": "pinpoint",
            "how are you": "how_are_you"
        }

        self._api = JarvisAPI(self)
        self._plugin_manager = PluginManager()

        for directory in directories:
            self._plugin_manager.add_directory(directory)

        self._activate_plugins()
Beispiel #6
0
    def __init__(self,
                 first_reaction_text,
                 prompt,
                 directories=[],
                 first_reaction=True,
                 enable_voice=False):
        """
        This constructor contains a dictionary with Jarvis Actions (what Jarvis can do).
        In alphabetically order.
        """
        Cmd.__init__(self)
        self.first_reaction = first_reaction
        self.first_reaction_text = first_reaction_text
        self.prompt = prompt
        self.enable_voice = enable_voice
        # Register do_quit() function to SIGINT signal (Ctrl-C)
        signal.signal(signal.SIGINT, self.interrupt_handler)

        self.memory = Memory()
        self.scheduler = schedule.Scheduler()
        # what if the platform does not have any engines, travis doesn't have sapi5 acc to me
        try:
            self.speech = create_voice()
        except Exception as e:
            print_say("Voice not supported", self, Fore.RED)
            print_say(str(e), self, Fore.RED)

        self.fixed_responses = {
            "what time is it": "clock",
            "where am i": "pinpoint",
        }

        self._api = JarvisAPI(self)
        self._plugin_manager = PluginManager()

        for directory in directories:
            self._plugin_manager.add_directory(directory)

        self._activate_plugins()
        self._init_plugin_info()
Beispiel #7
0
    def __init__(self):
        self.spinner_running = False

        self.memory = Memory()
        self.scheduler = schedule.Scheduler()

        # Remember voice settings
        self.enable_voice = self.get_data('enable_voice')
        self.speech_rate = self.get_data('speech_rate')

        if not self.speech_rate:
            self.speech_rate = 120

        self.io = DummyIO()

        # what if the platform does not have any engines, travis doesn't have sapi5 acc to me
        try:
            gtts_status = self.get_data('gtts_status')
            self.speech = create_voice(self, gtts_status, rate=self.speech_rate)
        except Exception as e:
            self.say("Voice not supported", self, Fore.RED)
            self.say(str(e), self, Fore.RED)