1234567891011121314151617181920212223242526272829303132333435 |
- import click
- import logging
- from rich.logging import RichHandler
- from vibroscopio.fingerprint import correlate, signature
- @click.group()
- @click.option('--verbosity', '-v', default=2, count=True)
- def cli(verbosity):
- FORMAT = "%(message)s"
- logging.basicConfig(
- level=verbosity * 10,
- format=FORMAT,
- datefmt="[%X]",
- handlers=[RichHandler()])
- @click.command()
- @click.argument('file')
- def fingerprint(path):
- s = signature(path)
- print(s)
- @click.command()
- @click.option('--source', '-s', help='source is expected to be bigger than target', type=click.Path(exists=True))
- @click.option('--target', '-t', help='target is supposed to be smaller than source', type=click.Path(exists=True))
- @click.option('--length', '-l', default=120, help='seconds of source length')
- @click.option('--span', '-s', default=60, help='allowd span allignment in seconds')
- def compare(source, target, length, span):
- correlate(source, target, length, length * 7)
- cli.add_command(fingerprint)
- cli.add_command(compare)
- def main():
- cli()
|