def text_to_speech_mp3_argparse():
description = 'Google TTS Downloader.'
parser = argparse.ArgumentParser(description=description,
epilog='tunnel snakes rule')
parser.add_argument('-o', '--output',
action='store', nargs='?',
help='Filename to output audio to',
type=argparse.FileType('wb'), default='out.mp3')
parser.add_argument('-l', '--language',
action='store',
nargs='?',
help='Language to output text to.', default='en')
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-f', '--file',
type=argparse.FileType('r'),
help='File to read text from.')
group.add_argument('-s', '--string',
action='store',
nargs='+',
help='A string of text to convert to speech.')
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
return parser.parse_args()
评论列表
文章目录