From: W. Trevor King Date: Fri, 14 Sep 2012 16:32:56 +0000 (-0400) Subject: posts:gstreamer:beep: use argparse default values for frequency. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d62ffa36e4bd49fee99f918ed5b5ffa689188121;p=blog.git posts:gstreamer:beep: use argparse default values for frequency. --- diff --git a/posts/GStreamer/beep.py b/posts/GStreamer/beep.py index 55ecf63..50bb305 100755 --- a/posts/GStreamer/beep.py +++ b/posts/GStreamer/beep.py @@ -31,14 +31,11 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description='Play a pure tone') parser.add_argument( - '-f', '--frequency', type=float, help='tone frequency in Hz') + '-f', '--frequency', type=float, default=440, + help='tone frequency in Hz') args = parser.parse_args() - frequency = 440 - if args.frequency: - frequency = args.frequency - - start=Beep(frequency=frequency) + start=Beep(frequency=args.frequency) while True: time.sleep(10)