FILENAME = 'filename'
FILTER = 'filter'
FRAGMENT = 'fragment'
-LANG = 'lang' ## TODO: This is handled nowhere!
LAYOUT = 'layout'
LILYQUOTE = 'lilyquote'
LINE_WIDTH = 'line-width'
PRINTFILENAME,
DOCTITLE,
TEXIDOC,
- LANG,
VERBATIM,
FILENAME,
ALT,
-FRAGMENT_LY = r'''
-%(notes_string)s
-{
-
-
-%% ****************************************************************
-%% ly snippet contents follows:
-%% ****************************************************************
-%(code)s
-
-
-%% ****************************************************************
-%% end ly snippet
-%% ****************************************************************
-}
-'''
-
def classic_lilypond_book_compatibility (key, value):
if key == 'singleline' and value == None:
return (RAGGED_RIGHT, None)
\paper {
%(paper_string)s
- force-assignment = #""
line-width = #(- line-width (* mm %(padding_mm)f))
}
%% ****************************************************************
'''
+FRAGMENT_LY = r'''
+%(notes_string)s
+{
+
+%% ****************************************************************
+%% ly snippet contents follows:
+%% ****************************************************************
+%(code)s
+%% ****************************************************************
+%% end ly snippet
+%% ****************************************************************
+}
+'''
return self.option_list
def compose_ly (self, code):
- if FRAGMENT in self.option_dict:
- body = FRAGMENT_LY
- else:
- body = FULL_LY
# Defaults.
relative = 1
d = globals().copy()
d.update (locals())
d.update (self.global_options.information)
+ if FRAGMENT in self.option_dict:
+ body = FRAGMENT_LY
+ else:
+ body = FULL_LY
return (PREAMBLE_LY + body) % d
def get_checksum (self):
# UGH - junk self.global_options
skip_lily = self.global_options.skip_lilypond_run
- for required in [base + '.ly']:
+ for required in [base + '.ly',
+ base + '.txt']:
require_file (required)
if not skip_lily:
require_file (base + '-systems.count')
"""Pass input through cmd, and return the result."""
if self.global_options.verbose:
- progress (_ ("Opening filter `%s'\n") % cmd)
+ progress (_ ("Running through filter `%s'\n") % cmd)
# TODO: Use Popen once we resolve the problem with msvcrt in Windows:
(stdin, stdout, stderr) = os.popen3 (cmd)
status = 0
output = stdout.read ()
status = stdout.close ()
- error = stderr.read ()
+ err = stderr.read ()
if not status:
status = 0
signal = 0x0f & status
- if status or (not output and error):
+ if status or (not output and err):
exit_status = status >> 8
ly.error (_ ("`%s' failed (%d)") % (cmd, exit_status))
ly.error (_ ("The error log is as follows:"))
- ly.stderr_write (error)
+ ly.stderr_write (err)
ly.stderr_write (stderr.read ())
exit (status)
option_list.append ('--compressed')
self.compressed = True
opts = " ".join (option_list)
+ progress (_ ("Converting MusicXML file `%s'...\n") % self.filename)
ly_code = self.filter_pipe (self.contents, 'musicxml2ly %s --out=- - ' % opts)
return ly_code
if os.path.exists (xmlfilename):
diff_against_existing = self.filter_pipe (self.contents, 'diff -u %s - ' % xmlfilename)
if diff_against_existing:
- warning ("%s: duplicate filename but different contents of orginal file,\n\
-printing diff against existing file." % xmlfilename)
+ warning (_ ("%s: duplicate filename but different contents of orginal file,\n\
+printing diff against existing file.") % xmlfilename)
ly.stderr_write (diff_against_existing)
else:
out = file (xmlfilename, 'w')
if os.path.exists (filename):
diff_against_existing = self.filter_pipe (self.full_ly (), 'diff -u %s -' % filename)
if diff_against_existing:
- warning ("%s: duplicate filename but different contents of converted lilypond file,\n\
-printing diff against existing file." % filename)
+ warning (_ ("%s: duplicate filename but different contents of converted lilypond file,\n\
+printing diff against existing file.") % filename)
ly.stderr_write (diff_against_existing)
else:
out = file (filename, 'w')
out.write (self.full_ly ())
out.close ()
+ file (path + '.txt', 'w').write ('image of music')
+
class LilyPondVersionString (Snippet):