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