From 1e39e0d283ad06a4a8212abbe2c817eb6e3f5b91 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Oct 2020 14:44:33 +0200 Subject: toggle script --- animism-align/cli/commands/peaks/parse.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'animism-align/cli') diff --git a/animism-align/cli/commands/peaks/parse.py b/animism-align/cli/commands/peaks/parse.py index b6a9f82..f5b36a4 100644 --- a/animism-align/cli/commands/peaks/parse.py +++ b/animism-align/cli/commands/peaks/parse.py @@ -5,7 +5,7 @@ Extract peaks from an MP3 file. import click @click.command() -@click.option('-i', '--input', 'fp_in', required=False, +@click.option('-i', '--input', 'fp_in', required=True, help='Input file') @click.pass_context def cli(ctx, fp_in): @@ -19,6 +19,10 @@ def cli(ctx, fp_in): from app.settings import app_cfg + if not os.path.exists(fp_in): + print(f"fp_in does not exist: {fp_in}") + return + print(f"Loading {fp_in}") y, sr = librosa.load(fp_in, sr=None) @@ -36,3 +40,5 @@ def cli(ctx, fp_in): with open(os.path.join(app_cfg.DIR_DATA_STORE, 'peaks/peaks.json'), 'w') as fp_out: json.dump(peaks.tolist(), fp_out, separators=(',', ':')) + + print("Wrote peaks.json") -- cgit v1.2.3-70-g09d2