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