Пример #1
0
def main():
  configurations.parseArgs(sys.argv)
  listener = Listener()
  if configurations.ARGS["quiet"]:
    print("Running in quiet mode")
  while True:
    try:
      print("What's up?")
      if not configurations.ARGS["quiet"]:
        command = Command(listener.listen())
      else:
        command = Command(input())

      if command is not None and command.name is not None:
        print("Command " + command.name)
        if command.command_type == CommandTypes.AUDIO:
          # Music procssor here
          audioProcessor = AudioProcessor()
          audioProcessor.process(command)
        elif command.command_type == CommandTypes.SYSTEM:
          #System processor here
          systemProcessor = SystemProcessor()
          systemProcessor.process(command)
        elif command.command_type == CommandTypes.SOCIAL:
          mediaProcessor = SocialMediaProcessor()
          mediaProcessor.process(command)
        elif command.name.lower() == "exit":
          print("Exiting")
          sys.exit(0)
        else:
          print("Command not recognized.")
      else:
        print("I'm sorry, I didn't catch that")
    except CancelCommand:
      pass
Пример #2
0
def main():
    configurations.parseArgs(sys.argv)
    listener = Listener()
    if configurations.ARGS["quiet"]:
        print("Running in quiet mode")
    while True:
        try:
            print("What's up?")
            if not configurations.ARGS["quiet"]:
                command = Command(listener.listen())
            else:
                command = Command(input())

            if command is not None and command.name is not None:
                print("Command " + command.name)
                if command.command_type == CommandTypes.AUDIO:
                    # Music procssor here
                    audioProcessor = AudioProcessor()
                    audioProcessor.process(command)
                elif command.command_type == CommandTypes.SYSTEM:
                    #System processor here
                    systemProcessor = SystemProcessor()
                    systemProcessor.process(command)
                elif command.command_type == CommandTypes.SOCIAL:
                    mediaProcessor = SocialMediaProcessor()
                    mediaProcessor.process(command)
                elif command.name.lower() == "exit":
                    print("Exiting")
                    sys.exit(0)
                else:
                    print("Command not recognized.")
            else:
                print("I'm sorry, I didn't catch that")
        except CancelCommand:
            pass