From: W. Trevor King Date: Tue, 16 Nov 2010 17:54:35 +0000 (-0500) Subject: Allow specific refnum selection with abcplay.py (e.g. collection.abc:1:5:6). X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b9e625ee903f81bca7b697d209ebd0f1558b2b15;p=blog.git Allow specific refnum selection with abcplay.py (e.g. collection.abc:1:5:6). --- diff --git a/posts/abcplay/abcplay.py b/posts/abcplay/abcplay.py index 9d84089..8f76f03 100755 --- a/posts/abcplay/abcplay.py +++ b/posts/abcplay/abcplay.py @@ -22,6 +22,8 @@ from time import time from os import remove +REFNUM_SEP = ':' + class ABCPlayer (object): def __init__(self): f,self._tempfile = mkstemp(prefix='abcplay-', suffix='.midi') @@ -33,7 +35,12 @@ class ABCPlayer (object): def play_files(self, filenames): for filename in filenames: - refnums = list(self._refnums(filename)) + if REFNUM_SEP in filename: + fields = filename.split(REFNUM_SEP) + filename = fields[0] + refnums = fields[1:] + else: + refnums = list(self._refnums(filename)) while len(refnums) > 0: refnum = refnums.pop(0) try: