How to use the gtts.__version__ function in gTTS

To help you get started, we’ve selected a few gTTS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pndurette / gTTS / bin / gtts-cli.py View on Github external
#! /usr/bin/python

from __future__ import print_function
from gtts import gTTS
from gtts import __version__
import sys
import argparse
import os
import codecs

def languages():
    """Sorted pretty printed string of supported languages"""
    return ", ".join(sorted("{}: '{}'".format(gTTS.LANGUAGES[k], k) for k in gTTS.LANGUAGES))

# Args
desc = "Creates an mp3 file from spoken text via the Google Text-to-Speech API ({v})".format(v=__version__)
parser = argparse.ArgumentParser(description=desc, formatter_class=argparse.RawTextHelpFormatter)

text_group = parser.add_mutually_exclusive_group(required=True)
text_group.add_argument('text', nargs='?', help="text to speak")      
text_group.add_argument('-f', '--file', help="file to speak")

parser.add_argument("-o", '--destination', help="destination mp3 file", action='store')
parser.add_argument('-l', '--lang', default='en', help="ISO 639-1/IETF language tag to speak in:\n" + languages())
parser.add_argument('--slow', action="store_true", help="slower read speed")
parser.add_argument('--debug', action="store_true")

args = parser.parse_args()

try:
    if args.text:
        if args.text == "-":
github pndurette / gTTS / gtts / cli.py View on Github external
@click.version_option(version=__version__)
def tts_cli(text, file, output, slow, lang, nocheck):
    """ Read