mirror of
https://github.com/kastdeur/lilydrum.git
synced 2024-12-22 17:23:32 +01:00
Only try to check for drum/pipe file if they are not set to ''
This commit is contained in:
parent
94c729bd00
commit
e0ee5bb7e0
1 changed files with 17 additions and 14 deletions
31
makedrum
31
makedrum
|
@ -29,10 +29,10 @@ class MakeDrum:
|
||||||
help='show Lilypond version and exit')
|
help='show Lilypond version and exit')
|
||||||
|
|
||||||
parser.add_argument('-x', '--drumfile',
|
parser.add_argument('-x', '--drumfile',
|
||||||
dest='lilydrum', default=os.path.join(self.MASTER_DIR,'lilydrum.ly'),
|
dest='lilydrum', nargs='+', default=os.path.join(self.MASTER_DIR,'lilydrum.ly'),
|
||||||
help='Use the specified file for drums')
|
help='Use the specified file for drums')
|
||||||
parser.add_argument('-c', '--pipefile',
|
parser.add_argument('-c', '--pipefile',
|
||||||
dest='lilypipe', default='bagpipe.ly',
|
dest='lilypipe', nargs='+', default=os.path.join(self.MASTER_DIR,'bagpipe.ly'),
|
||||||
help='Use the specified file for pipes')
|
help='Use the specified file for pipes')
|
||||||
parser.add_argument('-i', '--include',
|
parser.add_argument('-i', '--include',
|
||||||
dest='includes', nargs='*', default=[],action='append',
|
dest='includes', nargs='*', default=[],action='append',
|
||||||
|
@ -96,9 +96,9 @@ class MakeDrum:
|
||||||
|
|
||||||
# Input files
|
# Input files
|
||||||
if self.args.list_file != '':
|
if self.args.list_file != '':
|
||||||
with io.open(self.args.list_file, 'r', encoding='utf8') as list_file:
|
with io.open(self.args.list_file, 'r', encoding='utf8') as list_file:
|
||||||
for line in list_file.readlines():
|
for line in list_file.readlines():
|
||||||
self.args.music_file.append(line)
|
self.args.music_file.append(line)
|
||||||
|
|
||||||
# Check for files
|
# Check for files
|
||||||
if not self.args.music_file:
|
if not self.args.music_file:
|
||||||
|
@ -185,21 +185,23 @@ class MakeDrum:
|
||||||
include_drum_file = False
|
include_drum_file = False
|
||||||
include_pipe_file = False
|
include_pipe_file = False
|
||||||
# find out whether drum, pipes, or full score
|
# find out whether drum, pipes, or full score
|
||||||
for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
|
if self.args.lilydrum and self.args.lilydrum != '':
|
||||||
if ext in file:
|
for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
|
||||||
include_drum_file = True
|
if ext in file:
|
||||||
break
|
include_drum_file = True
|
||||||
|
break
|
||||||
for ext in ['full', 'pipes']:
|
if self.args.lilypipe and self.args.lilypipe != '':
|
||||||
if ext in file:
|
for ext in ['full', 'pipes']:
|
||||||
include_pipe_file = True
|
if ext in file:
|
||||||
break
|
include_pipe_file = True
|
||||||
|
break
|
||||||
|
|
||||||
if include_drum_file:
|
if include_drum_file:
|
||||||
self.args.includes.insert(0, self.args.lilydrum)
|
self.args.includes.insert(0, self.args.lilydrum)
|
||||||
|
|
||||||
if include_pipe_file:
|
if include_pipe_file:
|
||||||
self.args.includes.insert(0, self.args.lilypipe)
|
self.args.includes.insert(0, self.args.lilypipe)
|
||||||
|
|
||||||
# set up a tmp file with template and file combined
|
# set up a tmp file with template and file combined
|
||||||
tmp_file = os.path.join(tmp_dir, self.TMP_PREFIX + os.path.relpath(file).replace('../','').replace('music/','',1).replace('/', '-')[:-3] + self.args.suffix + '.ly')
|
tmp_file = os.path.join(tmp_dir, self.TMP_PREFIX + os.path.relpath(file).replace('../','').replace('music/','',1).replace('/', '-')[:-3] + self.args.suffix + '.ly')
|
||||||
|
|
||||||
|
@ -217,6 +219,7 @@ class MakeDrum:
|
||||||
if not incline.startswith('\\'): #already absolute
|
if not incline.startswith('\\'): #already absolute
|
||||||
incline = os.path.join(os.path.abspath(os.path.dirname(relpath)), incline)
|
incline = os.path.join(os.path.abspath(os.path.dirname(relpath)), incline)
|
||||||
|
|
||||||
|
|
||||||
if compilable:
|
if compilable:
|
||||||
try:
|
try:
|
||||||
inc_file = io.open(incline,'r',encoding='utf8')
|
inc_file = io.open(incline,'r',encoding='utf8')
|
||||||
|
|
Loading…
Reference in a new issue