]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/abc2ly.py
Imported Upstream version 2.16.0
[lilypond.git] / scripts / abc2ly.py
index 8adc6e4ac5890885d41f2f193b2c06b060fe075e..d04068fa31cdaa25a51aef3d902ac3a36a1951ec 100644 (file)
@@ -695,7 +695,7 @@ def try_parse_header_line (ln, state):
         if g == 'K': # KEY
             a = check_clef(a)
             if a:
-                m = re.match ('^([^ \t]*) *([^ ]*)( *)(.*)$', a) # seperate clef info
+                m = re.match ('^([^ \t]*) *([^ ]*)( *)(.*)$', a) # separate clef info
                 if m:
                     # there may or may not be a space
                     # between the key letter and the mode
@@ -929,7 +929,7 @@ def try_parse_articulation (str, state):
 
 
 
-    # s7m2 input doesnt care about spaces
+    # s7m2 input doesn't care about spaces
     if re.match('[ \t]*\(', str):
         str = str.lstrip ()
 
@@ -1313,8 +1313,9 @@ def parse_file (fn):
     select_voice('default', '')
     global lineno
     lineno = 0
-    sys.stderr.write ("Line ... ")
-    sys.stderr.flush ()
+    if not global_options.quiet:
+        sys.stderr.write ("Line ... ")
+        sys.stderr.flush ()
     __main__.state = state_list[current_voice_idx]
 
     for ln in ls:
@@ -1332,6 +1333,7 @@ def parse_file (fn):
 
         orig_ln = ln
 
+        ln = junk_space (ln, state)
         ln = try_parse_header_line (ln, state)
 
         # Try nibbling characters off until the line doesn't change.
@@ -1359,7 +1361,8 @@ def parse_file (fn):
 
 
 def identify():
-    sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version))
+    if not global_options.quiet:
+        sys.stderr.write ("%s from LilyPond %s\n" % (program_name, version))
 
 authors = """
 Written by Han-Wen Nienhuys <hanwen@xs4all.nl>, Laura Conrad
@@ -1380,16 +1383,21 @@ def get_option_parser ():
     p.add_option("--version",
                  action="version",
                  help=_ ("show version number and exit"))
-
     p.add_option("-h", "--help",
                  action="help",
                  help=_ ("show this help and exit"))
-    p.add_option ('-o', '--output', metavar='FILE',
-                  help=_ ("write output to FILE"),
-                  action='store')
-    p.add_option ('-s', '--strict', help=_ ("be strict about success"),
-                  action='store_true')
-    p.add_option ('-b', '--beams', help=_ ("preserve ABC's notion of beams"), action="store_true")
+    p.add_option ("-o", "--output", metavar='FILE',
+                  action="store",
+                  help=_ ("write output to FILE"))
+    p.add_option ("-s", "--strict",
+                  action="store_true",
+                  help=_ ("be strict about success"))
+    p.add_option ('-b', '--beams',
+                  action="store_true",
+                  help=_ ("preserve ABC's notion of beams"))
+    p.add_option ('-q', '--quiet',
+                  action="store_true",
+                  help=_ ("suppress progress messages"))
     p.add_option_group ('',
                         description=(
             _ ('Report bugs via %s')
@@ -1409,12 +1417,14 @@ for f in files:
     if f == '-':
         f = ''
 
-    sys.stderr.write ('Parsing `%s\'...\n' % f)
+    if not global_options.quiet:
+        sys.stderr.write ('Parsing `%s\'...\n' % f)
     parse_file (f)
 
     if not global_options.output:
         global_options.output = os.path.basename (os.path.splitext (f)[0]) + ".ly"
-    sys.stderr.write ('lilypond output to: `%s\'...' % global_options.output)
+    if not global_options.quiet:
+        sys.stderr.write ('lilypond output to: `%s\'...' % global_options.output)
     outf = open (global_options.output, 'w')
 
 # don't substitute @VERSION@. We want this to reflect
@@ -1427,4 +1437,5 @@ for f in files:
     dump_voices (outf)
     dump_score (outf)
     dump_lyrics (outf)
-    sys.stderr.write ('\n')
+    if not global_options.quiet:
+        sys.stderr.write ('\n')