From 19bb576edefd1bf8ecc9a03c1d4f7a233a9d3369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 23 Dec 2016 10:53:01 +0100 Subject: Allow no output by printing ignored message just when -v specified --- tlo-midi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tlo-midi.py b/tlo-midi.py index 5f89ba4..d7776ed 100755 --- a/tlo-midi.py +++ b/tlo-midi.py @@ -12,7 +12,8 @@ from colour import Color # Parse arguments parser = argparse.ArgumentParser(description='Turris leds midi track player') parser.add_argument('-c', nargs=1, type=int, help="Choose channel") -parser.add_argument('-d', nargs=1, type=str, help="Color in format 0xFFF") +parser.add_argument('-d', nargs=1, type=str, help="Color in format #FFFFFF") +parser.add_argument('-v', action='store_true', help="Print verbose messages") parser.add_argument('-t', action='store_true', help="If it is test run (print output to console)") parser.add_argument('FILE', nargs=1, type=str, help="Midi audio file") @@ -114,7 +115,7 @@ for msg in midi: if (msg.type == "note_on" or msg.type == "note_off") and \ msg.channel == channel: note(msg.note, msg.velocity, msg.time, msg.type == "note_off") - else: + elif args.v: print("Ignoring message: " + str(msg)) output_line() -- cgit v1.2.3