7 dirs = ['pitches', 'rhythms']
8 #dirs = ['ancient','chords','connecting','contemporary','expressive','education','guitar','parts','pitch','repeats','scheme','spacing','staff','text','vocal','other','nonmusic','engravers','instrument']
14 print "Please specify input_file."
17 def copy_with_warning(src, dest):
18 msg = '%% Do not edit this file; it is auto-generated from LSR!\n'
19 open (dest, 'w').write( msg + open (src).read() )
22 def copy_dir_with_test(srcdir, destdir):
25 if not(os.path.exists(srcdir)):
27 file_names = os.listdir (srcdir)
28 for file in file_names:
29 if (file.endswith ('.ly')):
30 src = os.path.join (srcdir, file)
31 destname = file.replace (';', '-')
32 dest = os.path.join (destdir, destname)
33 copy_with_warning(src, dest)
34 os.system('convert-ly -e ' + dest)
35 if os.path.exists( dest + '~' ):
36 os.remove( dest + '~' )
37 # the -V seems to make unsafe snippets fail nicer/sooner.
38 s = os.system('nice lilypond -V -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest)
39 #s = os.system('nice lilypond -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest)
45 srcdir = os.path.join (in_dir, dir)
46 destdir = os.path.join ('input', 'lsr', dir)
47 if not(os.path.isdir(destdir)):
48 print "Please run this script from the head of the source tree,"
49 print " and/or check that you have the right categories."
52 ## clean out existing files
53 file_names = os.listdir (destdir)
54 for file in file_names:
55 if (file.endswith ('.ly')):
56 os.remove( os.path.join(destdir,file) )
57 ## copy in new files from LSR download
58 copy_dir_with_test( srcdir, destdir )
59 ## copy in new files in source tree
60 copy_dir_with_test( os.path.join ('input', 'new', dir), destdir )
63 file=open("lsr-unsafe.txt", 'w')
70 print "Unsafe files printed in lsr-unsafe.txt: CHECK MANUALLY!"
71 print " xargs git-diff < lsr-unsafe.txt"