コード例 #1
0
ファイル: __init__.py プロジェクト: cosimoiaia/AlviBot
                          dest="verbosity",
                          help="Level of logging output")
  args = arg_parser.parse_args()

  # setup logger
  logging_level = {"warning": logging.WARNING,
                   "normal": logging.INFO,
                   "debug": logging.DEBUG}
  logging.getLogger().setLevel(logging_level[args.verbosity])
  logging.getLogger("requests").setLevel(logging.ERROR)
  logging.getLogger("urllib3").setLevel(logging.ERROR)
  if logging_level[args.verbosity] == logging.DEBUG:
    fmt = "%(asctime)s %(threadName)s: %(message)s"
  else:
    fmt = "%(message)s"
  logging_formatter = colored_logging.ColoredFormatter(fmt=fmt)
  logging_handler = logging.StreamHandler()
  logging_handler.setFormatter(logging_formatter)
  logging.getLogger().addHandler(logging_handler)

  # main
  main(args.speech, args.lang, args.sox_effects)


# check deps
bin_dep.check_bin_dependency(("play",))


if __name__ == "__main__":
  cl_main()
コード例 #2
0
    logging.getLogger().setLevel(logging_level[args.verbosity])
    logging.getLogger("requests").setLevel(logging.ERROR)
    logging.getLogger("urllib3").setLevel(logging.ERROR)
    if logging_level[args.verbosity] == logging.DEBUG:
        fmt = "%(asctime)s %(threadName)s: %(message)s"
    else:
        fmt = "%(message)s"
    logging_formatter = colored_logging.ColoredFormatter(fmt=fmt)
    logging_handler = logging.StreamHandler()
    logging_handler.setFormatter(logging_formatter)
    logging.getLogger().addHandler(logging_handler)

    if (args.output is not None) and args.sox_effects:
        logging.getLogger().debug(
            "Effects are not supported when saving to a file")
        exit(1)

    # do the job
    speech = Speech(args.speech, args.lang)
    if args.output:
        speech.save(args.output)
    else:
        speech.play(args.sox_effects)


# check deps
bin_dep.check_bin_dependency(("sox", ))

if __name__ == "__main__":
    cl_main()
コード例 #3
0
ファイル: __init__.py プロジェクト: EzhikTT/GoogleSpeech
                          dest="verbosity",
                          help="Level of logging output")
  args = arg_parser.parse_args()

  # setup logger
  logging_level = {"warning": logging.WARNING,
                   "normal": logging.INFO,
                   "debug": logging.DEBUG}
  logging.getLogger().setLevel(logging_level[args.verbosity])
  logging.getLogger("requests").setLevel(logging.ERROR)
  logging.getLogger("urllib3").setLevel(logging.ERROR)
  if logging_level[args.verbosity] == logging.DEBUG:
    fmt = "%(asctime)s %(threadName)s: %(message)s"
  else:
    fmt = "%(message)s"
  logging_formatter = colored_logging.ColoredFormatter(fmt=fmt)
  logging_handler = logging.StreamHandler()
  logging_handler.setFormatter(logging_formatter)
  logging.getLogger().addHandler(logging_handler)

  # main
  main(args.speech, args.lang, args.sox_effects)


# check deps
bin_dep.check_bin_dependency(("sox",))


if __name__ == "__main__":
  cl_main()