From 4ae59c32144437426326e3c547b007d93bbc05cc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 16 Nov 2010 20:37:15 -0500 Subject: [PATCH] Add --help option to abcplay.py. --- posts/abcplay/abcplay.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/posts/abcplay/abcplay.py b/posts/abcplay/abcplay.py index 8f76f03..2083edd 100755 --- a/posts/abcplay/abcplay.py +++ b/posts/abcplay/abcplay.py @@ -16,6 +16,20 @@ # License along with this program. If not, see # . +"""Play ABC_ files using abc2midi_ and timidity_. + +For example:: + + abcplay.py my_collection.abc:3:7:8 another_collection.abc + +SIGINT (usually ^C) will kill the current tune and proceed the next +one. Two SIGINTs in less than one second will kill the abcplay.py +process. + +.. _abc2midi: http://abc.sourceforge.net/abcMIDI/ +.. _timidity: http://timidity.sourceforge.net/ +""" + from subprocess import Popen from tempfile import mkstemp from time import time @@ -92,6 +106,14 @@ class ABCPlayer (object): if __name__ == '__main__': import sys + import optparse + + usage = '%prog file[:refnum[:refnum:...]] ...' + epilog = __doc__ + p = optparse.OptionParser(usage=usage, epilog=epilog) + p.format_epilog = lambda formatter: epilog+'\n' + options,args = p.parse_args() + del p p = ABCPlayer() try: -- 2.26.2