9 dirs.extend(['pitches', 'rhythms', 'expressive',
10 'repeats', 'simultaneous', 'staff', 'editorial', 'text'])
12 dirs.extend(['vocal', 'chords', 'piano',
13 'percussion', 'guitar', 'strings', 'bagpipes', 'ancient'])
18 #dirs.extend(['real-music'])
19 #dirs = ['ancient','chords','connecting','contemporary','expressive','education','guitar','parts','pitch','repeats','scheme','spacing','staff','text','vocal','other','nonmusic','engravers','instrument']
25 print "Please specify input_file."
28 def copy_with_warning(src, dest):
29 msg = '%% Do not edit this file; it is auto-generated from LSR!\n'
30 open (dest, 'w').write( msg + open (src).read() )
33 def copy_dir_with_test(srcdir, destdir):
36 if not(os.path.exists(srcdir)):
38 file_names = os.listdir (srcdir)
39 for file in file_names:
40 if (file.endswith ('.ly')):
41 src = os.path.join (srcdir, file)
42 destname = file.replace (';', '-')
43 dest = os.path.join (destdir, destname)
44 copy_with_warning(src, dest)
45 os.system('convert-ly -e ' + dest)
46 if os.path.exists( dest + '~' ):
47 os.remove( dest + '~' )
48 # the -V seems to make unsafe snippets fail nicer/sooner.
49 s = os.system('nice lilypond -V -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest)
50 #s = os.system('nice lilypond -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest)
56 srcdir = os.path.join (in_dir, dir)
57 destdir = os.path.join ('input', 'lsr', dir)
58 if not(os.path.isdir(destdir)):
59 print "Please run this script from the head of the source tree,"
60 print " and/or check that you have the right categories."
63 ## clean out existing files
64 file_names = os.listdir (destdir)
65 for file in file_names:
66 if (file.endswith ('.ly')):
67 os.remove( os.path.join(destdir,file) )
68 ## copy in new files from LSR download
69 copy_dir_with_test( srcdir, destdir )
70 ## copy in new files in source tree
71 copy_dir_with_test( os.path.join ('input', 'new', dir), destdir )
74 file=open("lsr-unsafe.txt", 'w')
81 print "Unsafe files printed in lsr-unsafe.txt: CHECK MANUALLY!"
82 print " xargs git-diff < lsr-unsafe.txt"