From: W. Trevor King Date: Wed, 17 Nov 2010 01:37:15 +0000 (-0500) Subject: Add --help option to abcplay.py. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4ae59c32144437426326e3c547b007d93bbc05cc;p=blog.git Add --help option to abcplay.py. --- 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: