From d4a1b0e9af5f0c97839952c1cbfd744e0d7cdd98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Bo=CC=88ck?= Date: Fri, 21 Jan 2022 16:48:00 +0100 Subject: [PATCH] fix scripts failing with no processing mode set fixes #499 --- bin/BarTracker | 1 + bin/evaluate | 5 +++++ madmom/processors.py | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/bin/BarTracker b/bin/BarTracker index 0f40d62eb..99ea537ee 100755 --- a/bin/BarTracker +++ b/bin/BarTracker @@ -79,6 +79,7 @@ def main(): # signal processor signal_processor = SignalProcessor(**vars(args)) # beats processor + load_beats_processor = None if hasattr(args, 'infile'): # single mode: read the beats from STDIN load_beats_processor = LoadBeatsProcessor(**vars(args)) diff --git a/bin/evaluate b/bin/evaluate index d57a2a458..bad651f33 100755 --- a/bin/evaluate +++ b/bin/evaluate @@ -52,6 +52,11 @@ def main(): # parse the args args = p.parse_args() + # print usage if no evaluation mode was set + if not getattr(args, 'eval', False): + p.print_usage() + exit(0) + # print the arguments if args.verbose >= 2: print(args) diff --git a/madmom/processors.py b/madmom/processors.py index 10399058a..91d0f9abc 100644 --- a/madmom/processors.py +++ b/madmom/processors.py @@ -947,6 +947,14 @@ def io_arguments(parser, output_suffix='.txt', pickle=True, online=False): # add general options parser.add_argument('-v', dest='verbose', action='count', help='increase verbosity level') + + # print usage if no processing mode is set + def print_usage(*args, **kwargs): + parser.print_usage() + exit(0) + + parser.set_defaults(func=print_usage) + # add subparsers sub_parsers = parser.add_subparsers(title='processing options')