-#!@PYTHON@
+#!/usr/bin/env python
# mutopia-index.py
import fnmatch
import getopt
import os
-import os
import re
import stat
import sys
<h1>LilyPond samples</h1>
-<p>You're looking at a page with some LilyPond samples. These files
+<p>You are looking at a page with some LilyPond samples. These files
are also included in the distribution. The output is completely
generated from the source file, without any further touch up.
"""
headertext_nopics= r"""
-<p>Nothing to be seen here, move along.
+<p>No examples were found in this directory.
"""
#
ext = ext2 + ext
header = read_lilypond_header (ex)
- def read_dict (s, default, h = header):
- try:
- ret = h[s]
- except KeyError:
- ret = default
- return ret
- head = read_dict ('title', os.path.basename (base))
- composer = read_dict ('composer', '')
- desc = read_dict ('description', '')
+ head = header.get ('title', os.path.basename (base))
+ composer = header.get ('composer', '')
+ desc = header.get ('description', '')
list.write ('<hr>\n')
list.write ('<h1>%s</h1>\n' % head);
if composer:
pictures = ['jpeg', 'png', 'xpm']
lst.write ('\n')
else:
- print "can't find" , `file_name`
+ print "cannot find" , `file_name`
list_item (base + ext, 'The input', 'ASCII')
list.write ('</body></html>\n');
list.close ()
-(options, files) = getopt.getopt (sys.argv[1:],
+(options, files) = getopt.getopt (sys.argv[1:],
'ho:', ['help', 'output='])
outfile = 'examples.html'
subdirs = []
-for opt in options:
- o = opt[0]
- a = opt[1]
+for (o, a) in options:
if o == '--help' or o == '-h':
help ()
elif o == '--output' or o == '-o':
dirs = []
for f in files:
- dirs = dirs + find ('out-www', f)
+ dirs += find ('out-www', f)
if not dirs:
dirs = ['.']
allfiles = []
for d in dirs:
- allfiles = allfiles + find ('*.ly.txt', d)
+ allfiles += find ('*.ly', d)
-gen_list (allfiles, outfile)
+allfiles = [f for f in allfiles
+ if not f.endswith ('snippet-map.ly')
+ and not re.search ('lily-[0-9a-f]+', f)
+ and 'musicxml' not in f]
+gen_list (allfiles, outfile)