示例#1
0
#!/usr/bin/python

# Adds a lead-in message to each mp3 file of a directory storing the result in another directory.
# So - when played e.g. on a TonUINO - you first will hear the title of the track, then the track itself.

import argparse, base64, json, os, re, subprocess, sys, text_to_speech

argFormatter = lambda prog: argparse.RawDescriptionHelpFormatter(
    prog, max_help_position=27, width=100)
argparser = text_to_speech.PatchedArgumentParser(
    description=
    'Adds a lead-in message to each mp3 file of a directory storing the result in another directory.\n'
    +
    'So - when played e.g. on a TonUINO - you first will hear the title of the track, then the track itself.\n\n'
    + text_to_speech.textToSpeechDescription,
    usage='%(prog)s -i my/source/dir -o my/output/dir [optional arguments...]',
    formatter_class=argFormatter)
argparser.add_argument(
    '-i',
    '--input',
    type=str,
    required=True,
    help='The input directory or mp3 file to process (input won\'t be changed)'
)
argparser.add_argument(
    '-o',
    '--output',
    type=str,
    required=True,
    help=
    'The output directory where to write the mp3 files (will be created if not existing)'
示例#2
0
#!/usr/bin/env python3

# Creates the audio messages needed by TonUINO.

import argparse, os, re, shutil, sys, text_to_speech

if __name__ == '__main__':
    argFormatter = lambda prog: argparse.RawDescriptionHelpFormatter(
        prog, max_help_position=30, width=100)
    argparser = text_to_speech.PatchedArgumentParser(
        description='Creates the audio messages needed by TonUINO.\n\n' +
        text_to_speech.textToSpeechDescription,
        usage='%(prog)s [optional arguments...]',
        formatter_class=argFormatter)
    argparser.add_argument(
        '-i',
        '--input',
        type=str,
        default='.',
        help=
        'The directory where `audio_messages_*.txt` files are located. (default: current directory)'
    )
    argparser.add_argument(
        '-o',
        '--output',
        type=str,
        default='sd-card',
        help=
        'The directory where to create the audio messages. (default: `sd-card`)'
    )
    text_to_speech.addArgumentsToArgparser(argparser)