コード例 #1
0
ファイル: CmdInterpreter.py プロジェクト: rgdoliveira/Jarvis
    def __init__(self, first_reaction_text, prompt, 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.actions = ("ask",
                        "calculate",
                        "chat",
                        {"check": ("ram", "weather", "time", "forecast")},
                        "chuck",
                        {"decrease": ("volume",)},
                        "directions",
                        {"disable": ("sound",)},
                        {"enable": ("sound",)},
                        "error",
                        "evaluate",
                        "exit",
                        "goodbye",
                        "help",
                        {"hotspot": ("start", "stop")},
                        {"increase": ("volume",)},
                        "match",
                        "movies",
                        "music",
                        "near",
                        "news",
                        {"open": ("camera",)},
                        "play",
                        "pinpoint",
                        "os",
                        "quit",
                        "remind",
                        "say",
                        {"screen": ("off",)},
                        {"display": ("pics",)},
                        "shutdown",
                        "reboot",
                        "todo",
                        {"tell": ("joke",)},
                        "umbrella",
                        {"update": ("location", "system")},
                        "weather",
                        )

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

        self.speech = voice.Voice()
コード例 #2
0
ファイル: Jarvis.py プロジェクト: KnightOfRealm/Jarvis
 def __init__(self):
     """
     This constructor contains a dictionary with Jarvis Actions (what Jarvis can do).
     In alphabetically order.
     """
     self.actions = {
         "ask jarvis": "ask_jarvis",
         "chat": "ask_jarvis",
         "check ram": "check_ram",
         "decrease volume": "decrease_volume",
         "directions": "directions",  # Doesn't check if 'to' exist
         "disable sound": "disable_sound",
         "enable sound": "enable_sound",
         "error": "error",
         "evaluate": "evaluate",
         "exit": "close",
         "goodbye": "close",
         "help": "help_jarvis",
         "hotspot start": "hotspot_start",
         "hotspot stop": "hotspot_stop",
         "how are you": "how_are_you",
         "increase volume": "increase_volume",
         "movies": "movies",
         "music": "music",
         "near": "near",
         "news": "news",
         "open camera": "open_camera",
         "os": "os_detection",
         "quit": "close",
         "remind": "remind",
         "search for a string in file": "string_pattern",
         "show me pics of": "display_pics",
         "shutdown -c": "cancel_shutdown",
         "shutdown system": "shutdown",
         "reboot system": "reboot",
         "todo": "todo",
         "weather": "weather",
         "what time is it": "clock",
         "where am i": "pinpoint",
         "what about chuck": "what_about_chuck",
     }
     self.speech = voice.Voice()
コード例 #3
0
ファイル: CmdInterpreter.py プロジェクト: VainExpert/Jarvis-1
    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.actions = [
            "ask",
            {
                "check": ("ram", "weather", "time", "forecast")
            },
            "clear",
            "cricket",
            {
                "decrease": ("volume", )
            },
            "dictionary",
            "directions",
            {
                "disable": ("sound", )
            },
            {
                "display": ("pics", )
            },
            {
                "enable": ("sound", )
            },
            "file_organise",
            "fb",
            "hackathon",
            "help",
            {
                "hotspot": ("start", "stop")
            },
            "how_are_you",
            "imgur",
            "lyrics",
            "match",
            {
                "movie": (
                    "cast",
                    "director",
                    "plot",
                    "producer",
                    "rating",
                    "year",
                )
            },
            "movies",
            "music",
            "near",
            "news",
            {
                "open": ("camera", )
            },
            "pinpoint",
            "play",
            "quote",
            "currencyconv",
            "remind",
            "say",
            "tempconv",
            "todo",
            "translate",
            {
                "twitter": ("login", "tweet")
            },
            "umbrella",
            {
                "update": ("location", "system")
            },
            "weather",
        ]

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

        self.speech = voice.Voice()

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

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

        self._activate_plugins()