From b9e625ee903f81bca7b697d209ebd0f1558b2b15 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 16 Nov 2010 12:54:35 -0500 Subject: [PATCH] Allow specific refnum selection with abcplay.py (e.g. collection.abc:1:5:6). --- posts/abcplay/abcplay.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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: -- 2.26.2