Пример #1
0
def main():
    CliBuilder(
        'trimmer',
        version=__version__,
        help='MP3 song normalizer',
        run=trim_from_source,
        help_on_empty=True
    ).has(
        argument('source',
                 help='song source (youtube URL or MP3 file)',
                 choices=file_completer),
        parameter('artist', help='song artist', type=str),
        parameter('title', help='song title', type=str),
        parameter('trim-start',
                  help='trim given seconds at the beginning',
                  type=float),
        parameter('trim-end', help='trim given seconds at the end',
                  type=float),
        parameter('gain', help='increase volume by given dB', type=float),
        parameter('output',
                  help='output MP3 file (Artist - Title.mp3 by default)'),
        flag('no-normalize', help='skip normalizing volume level'),
        flag('no-trim', help='skip trimming silence at the edges of song'),
        flag('no-fade', help='skip applying fade-in & fade-out'),
        flag('no-rename',
             help=
             'skip renaming song to normalized filename (Artist - Title.mp3)'),
    ).run()
Пример #2
0
def main():
    CliBuilder(
        'regex-rename',
        version=__version__,
        run=_bulk_rename,
        help_on_empty=True,
        log_error=True,
        help=
        'Bulk rename tool based on regular expressions to rename multiple files at once',
    ).has(
        argument('pattern', help='Regex pattern to match filenames'),
        argument('replacement',
                 required=False,
                 help='Replacement regex pattern for renamed files. '
                 'Use \\1, \\2 syntax to make use of matched groups'),
        flag(
            'rename',
            'r',
            help=
            'Does actual renaming files instead of just testing replacement pattern'
        ),
        flag('full', help='Enforces matching full filename against pattern'),
        flag('recursive', help='Search directories recursively'),
        parameter(
            'pad-to',
            type=int,
            help=
            'Applies padding with leading zeros with given length on matched numerical groups'
        ),
    ).run()
Пример #3
0
def main():
    CliBuilder(
        'copymon',
        version=__version__,
        run=action_monitor_meminfo,
        help=
        'Dirty-Writeback memory stream monitor,\nType [s], [Enter] to force sync when monitoring memory',
    ).has(flag('--sync', help='run sync continuously'), ).run()
Пример #4
0
def main():
    with log_error():
        CliBuilder('Watchmaker OS tool', version='1.1.0').has(
            subcommand('create', run=create_os, help='flash Watchmaker OS to a portable drive').has(
                argument('disk', help='disk drive name (/dev/sdc)'),
                flag('persistence', help='Create additional persistence partition'),
                parameter('boot-surplus', help='Boot partition storage surplus (MiB)', type=int, default=300),
                parameter('--module', name='module', help='Add optional module', multiple=True,
                          choices=install_module.optional_modules.keys(), strict_choices=True),
                flag('skip-fs', help='Skip copying squashed filesystem'),
            ),
            subcommand('prebuild', run=prebuild_tools, help='update current OS with latest tools').has(
                parameter('watchmaker-repo', help='a path to full watchmaker repository',
                          default='/media/user/data/ext/watchmaker'),
            ),
            subcommand('module', run=add_modules, help='install modules on existing OS').has(
                subcommand('list', run=install_module.list_modules, help='list installable modules'),
                arguments('modules', help='module names',
                          choices=install_module.optional_modules.keys(), strict_choices=True),
            ),
            subcommand('resquash', run=resquash_os, help='rebuild squashed filesystem and swap it on the run').has(
                parameter('storage-path', help='storage path for dumping new squashed filesystem snapshot',
                          default='/media/user/data/ext/watchmaker/squash'),
                parameter('exclude-file', help='EXCLUDE_FILE path for squashfs',
                          default='/media/user/data/ext/watchmaker/watchmake/EXCLUDE_FILE'),
                parameter('live-squash', help='target squashed filesytem to be replaced',
                          default='/mnt/BOOT/live/filesystem.squashfs'),
            ),
            subcommand('replicate', run=replicate_os, help='clone current OS itself to another drive').has(
                parameter('source-disk', help='source disk device name'),
                parameter('target-disk', help='target disk device name'),
            ),
            subcommand('iso', run=make_iso, help='make ISO from disk partitions').has(
                argument('source-disk', help='source disk device name'),
                argument('target-iso', help='target ISO filename'),
            ),
            flag('dry', help='dry run instead of invoking real shell commands'),
            flag('yes', help='skip confirmation'),
        ).run()
Пример #5
0
def main():
    CliBuilder('xman', run=setup_proxy, help_on_empty=True, version=__version__,
               help='HTTP proxy recording & replaying requests').has(
        argument('dst_url', help='destination base url', required=False, default='http://127.0.0.1:8000'),
        parameter('listen_port', help='listen port for incoming requests', type=int, default=8080),
        parameter('listen_ssl', help='enable https on listening side', type=boolean, default=True),
        parameter('record', help='enable recording requests & responses', type=boolean, default=False),
        parameter('record_file', help='filename with recorded requests', default='tape.json'),
        parameter('replay', help='return cached results if found', type=boolean, default=False),
        parameter('replay_throttle', type=boolean, default=False,
                  help='throttle response if too many requests are made'),
        parameter('replay_clear_cache', help='enable clearing cache periodically', type=boolean, default=False),
        parameter('replay_clear_cache_seconds', help='clearing cache interval in seconds', type=int, default=60),
        parameter('config', help='load extensions from Python file'),
        flag('verbose', 'v', multiple=True, help='show more details in output'),
    ).run()
Пример #6
0
def main():
    CliBuilder(
        'diffs',
        run=show_diff,
        help_on_empty=True,
        version=__version__,
        help='Command output changes monitor').has(
            parameter(
                'interval',
                type=float,
                default=1,
                help='interval in seconds between consecutive executions'),
            flag('clear', help='clear terminal scrollback'),
            arguments('cmd',
                      joined_with=' ',
                      help='commmand to be invoked and compare its results'),
        ).run()
Пример #7
0
def main():
    with log_error():
        CliBuilder('volumen', help='Volume notification tool').has(
            subcommand('up', run=volume_up, help='Increase volume level'),
            subcommand('down', run=volume_down, help='Decrease volume level'),
            subcommand('show',
                       run=volume_show,
                       help='Show current volume level'),
            subcommand('spotify').has(
                subcommand('pause',
                           run=spotify_pause,
                           help='Pause / Play spotify'),
                subcommand('previous',
                           run=spotify_previous,
                           help='Previous spotify song'),
                subcommand('next', run=spotify_next, help='Next spotify song'),
            ),
            flag('pulse', help='force using pulseaudio pactl'),
        ).run()