FILENAME = 'filename'
FILTER = 'filter'
FRAGMENT = 'fragment'
-LANG = 'lang' ## TODO: This is handled nowhere!
LAYOUT = 'layout'
LILYQUOTE = 'lilyquote'
LINE_WIDTH = 'line-width'
NOFRAGMENT = 'nofragment'
NOGETTEXT = 'nogettext'
NOINDENT = 'noindent'
-NOQUOTE = 'noquote'
INDENT = 'indent'
NORAGGED_RIGHT = 'noragged-right'
NOTES = 'body'
# NOTIME and NOGETTEXT have no opposite so they aren't part of this
# dictionary.
-# NOQUOTE is used internally only.
no_options = {
NOFRAGMENT: FRAGMENT,
NOINDENT: INDENT,
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')
def convert_from_musicxml (self):
name = self.filename
- option_list = []
+ xml2ly_option_list = []
for (key, value) in self.option_dict.items ():
cmd_key = self.musicxml_options_dict.get (key, None)
if cmd_key == None:
continue
if value == None:
- option_list.append (cmd_key)
+ xml2ly_option_list.append (cmd_key)
else:
- option_list.append (cmd_key + '=' + value)
- if ('.mxl' in name) and ('--compressed' not in option_list):
- option_list.append ('--compressed')
+ xml2ly_option_list.append (cmd_key + '=' + value)
+ if ('.mxl' in name) and ('--compressed' not in xml2ly_option_list):
+ xml2ly_option_list.append ('--compressed')
self.compressed = True
- opts = " ".join (option_list)
+ opts = " ".join (xml2ly_option_list)
progress (_ ("Converting MusicXML file `%s'...\n") % self.filename)
ly_code = self.filter_pipe (self.contents, 'musicxml2ly %s --out=- - ' % opts)
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):