1
0
Fork 0
mirror of https://github.com/kastdeur/lilydrum.git synced 2024-12-23 01:33:32 +01:00

Moved Book scripts around,

few edits to music
This commit is contained in:
Eric Teunis de Boone 2015-12-11 11:25:33 +01:00
parent 9ce97ffc8b
commit 2cbc0c9bd6
29 changed files with 170 additions and 202 deletions

4
.gitignore vendored
View file

@ -1,11 +1,11 @@
.gitignore
*.ps *.ps
*.pdf *.pdf
*.png *.png
*.log *.log
*tmp* *tmp*
*.py *.py
*.toc
*.aux
_output/ _output/
pdf/ pdf/
fullscores/
fullscores/* fullscores/*

View file

@ -43,6 +43,7 @@
\tenorAB \tenorAB
s8 s8
s8
\tenorBA \tenorBA
\tenorBB \tenorBB
\tenorBC \tenorBC

View file

@ -1,7 +1,7 @@
% 4/4 The Pikeman's March % 4/4 The Pikeman's March
% Tenor % Tenor
\version "2.18.2" \version "2.18.2"
composerTenor = "E.T. de Boone, 2015" composerTenor = "E.T. de Boone, v0.3, 2015"
%%music %%music
tenorAA = \drummode { tenorAA = \drummode {
@ -26,8 +26,16 @@ tenorAB = \drummode {
} }
% Part 2 % Part 2
tenorBA = \drummode { tenorBA = \drummode {
d8-_ g
d8 g
d8 g
d8 g
|
s1*3
} }
tenorBB = \drummode { tenorBB = \drummode {
s1*4
} }
tenorBC = \drummode { tenorBC = \drummode {
s1*4
} }

View file

@ -1,7 +1,7 @@
\version "2.18.2" \version "2.18.2"
\include "config.ily" \include "config.ily"
\include "notes.side.v1.5.ily" \include "notes.side.v1.6.ily"
\score { \score {
\new PipeBandDrumStaff { \new PipeBandDrumStaff {

View file

@ -16,6 +16,7 @@
\tenorAA \tenorAA
\tenorAB \tenorAB
s8
\tenorBA \tenorBA
\tenorBB \tenorBB
\tenorBC \tenorBC

View file

@ -2,27 +2,35 @@
% Side % Side
\version "2.18.2" \version "2.18.2"
composerSide = "" composerSide = ""
snareA = \drummode { snareAA = \drummode {
d16. g32 | d16. g32 |
d8:32( d8.)-> g16 d4:32( d8) | d8:32( d8.)-> g16 d4:32( d8) |
\dragd d16. d32-> g16. g32 \flamd d8 d4.:32( | \dragd d16. d32-> g16. g32 \flamd d8 d4.:32( |
d4) d16. g32 d8:32( d8) g8 |
\flamd d16. g32 d16. \flamg g32 d16. g32 \flamd d4 d16. g32 |
d4) d16. g32 d8:32( d8) g8 |
\flamd d16. g32 d16. \flamg g32 d16. g32 \flamd d4
}
snareAB = \drummode {
d16. g32 |
d8:32( d8.)-> g16 d4:32( d8) | d8:32( d8.)-> g16 d4:32( d8) |
\dragd d16. d32-> g16. g32 \flamd d8 d4:32( d16.) g32 | \dragd d16. d32-> g16. g32 \flamd d8 d4:32( d16.) g32 |
d8:32( g16.) d32-> g16. g32 d8:32( g16.) d32-> g16. g32 | d8:32( g16.) d32-> g16. g32 d8:32( g16.) d32-> g16. g32 |
d4.:32( d4) d4.:32( d4)
} }
snareBA = \drummode { snareBA = \drummode {
d8:32( | d8:32( |
g4) \flamd d16. g32 d8:32( g8) \flamd d8 | g4) \flamd d16. g32 d8:32( d8) \flamd d8 |
d32-> g32 d32 g32 d32 g32 d32 g32-> d32 g32 d32 g32 d4-> d8:32( | d32-> g32 d32 g32 d32 g32 d32 g32-> d32 g32 d32 g32 d4-> d8:32(
g4) \flamd d16. g32 d8:32( g8.) g16 |
d4.:32( d4) d8:32( |
g4) \flamd d16. g32 d8:32( g8) \flamd d8 | g4) \flamd d16. g32 d8:32( d8.) g16 |
d4.:32( d4)
}
snareBB = \drummode {
d8:32( |
g4) \flamd d16. g32 d8:32( d8) \flamd d8 |
d32-> g32 d32 g32 d32 g32 d32 g32-> d32 g32 d32 g32 d4-> \flamd d16. g32 | d32-> g32 d32 g32 d32 g32 d32 g32-> d32 g32 d32 g32 d4-> \flamd d16. g32 |
d8:32( g16.) d32-> g16. g32 d8:32( g16.) d32-> g16. g32 | d8:32( g16.) d32-> g16. g32 d8:32( g16.) d32-> g16. g32 |
d4.:32( d4) d4.:32( d4)
} }

View file

@ -9,14 +9,16 @@
<< <<
{ {
\repeat volta 2 { \part \line \break } \break \repeat volta 2 { \part \line \break } \break
\part \line \bar "||" \break \repeat volta 2 { \part \halfline \break }
\part \line \bar "|." \alternative{ {\part \halfline \break}{\part \halfline \break} }
\bar "|."
} }
{ {
\snareA s8 \snareAA \snareAB s8
\snareBA s8 \snareBA s8
\snareA s8 \snareBB s8
\snareAB s8
} }
>> >>
} }

7
book/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
*.pdf
*.aux
*.log
*.toc
images/*
scores/*
tmp/*

View file

@ -42,9 +42,9 @@ done;
echo "All setup!" echo "All setup!"
read -p "Press [Enter] to compile *.tex" #read -p "Press [Enter] to compile *.tex"
for f in ./*.tex; #for f in ./*.tex;
do #do
$LATEXCMD $f # $LATEXCMD $f
done; #done;

View file

@ -12,6 +12,7 @@ class MakeBook:
RUN_DIR = os.path.abspath(os.curdir) RUN_DIR = os.path.abspath(os.curdir)
SCORES_DIR = './scores/' SCORES_DIR = './scores/'
LY_DIR = '../' LY_DIR = '../'
ORDER_FILE = 'order.txt'
INSTRUMENTS = ['full','drums', 'pipes', 'bass', 'tenor', 'side','snare'] INSTRUMENTS = ['full','drums', 'pipes', 'bass', 'tenor', 'side','snare']
def __init__(self): def __init__(self):
@ -43,14 +44,17 @@ class MakeBook:
self.fwrite(u'\\addcontentsline{toc}{section}{Standards}') self.fwrite(u'\\addcontentsline{toc}{section}{Standards}')
for d in standards: for d in standards:
self.vprint()
self.vprint(os.path.join(self.SCORES_DIR,d)) self.vprint(os.path.join(self.SCORES_DIR,d))
self.path_walker(os.path.join(self.SCORES_DIR,d), level=1, content_line_level=1) self.path_walker(os.path.join(self.SCORES_DIR,d), level=1, content_line_level=1)
self.fwrite(u'\\addcontentsline{toc}{section}{Marches}') self.fwrite(u'\\addcontentsline{toc}{section}{Marches}')
for d in marches: for d in marches:
self.vprint()
self.vprint(os.path.join(self.SCORES_DIR,d)) self.vprint(os.path.join(self.SCORES_DIR,d))
self.path_walker(os.path.join(self.SCORES_DIR,d), level=1, content_line_level=2) self.path_walker(os.path.join(self.SCORES_DIR,d), level=1, content_line_level=2)
for d in tune_dirs: for d in tune_dirs:
self.vprint()
self.vprint(os.path.join(self.SCORES_DIR,d)) self.vprint(os.path.join(self.SCORES_DIR,d))
self.path_walker(os.path.join(self.SCORES_DIR,d)) self.path_walker(os.path.join(self.SCORES_DIR,d))
except IOError: except IOError:
@ -59,8 +63,10 @@ class MakeBook:
self.fout.close() self.fout.close()
raise raise
def vprint(self,line): def vprint(self,line = None):
if self.args.verbose: if self.args.verbose:
if line is None:
line = ''
print(line) print(line)
def fwrite(self,line): def fwrite(self,line):
@ -139,9 +145,19 @@ class MakeBook:
if level < content_line_level: if level < content_line_level:
self.fwrite(u'\\mysection{'+('sub'*level)+'section}{'+a[a.rfind('/')+1:].replace('_',' ').replace('-','/').title()+'}') self.fwrite(u'\\mysection{'+('sub'*level)+'section}{'+a[a.rfind('/')+1:].replace('_',' ').replace('-','/').title()+'}')
newline = False newline = False
if os.path.isfile(os.path.join(a, 'order.txt')):
self.vprint('Found order')
with open(os.path.join(a, self.ORDER_FILE)) as f:
line = f.readline().rstrip('\n')
while line:
self.path_walker(os.path.join(a,line), level+1)
line = f.readline().rstrip('\n')
else:
for root, dirs, files in os.walk(a,False): for root, dirs, files in os.walk(a,False):
for f in files: for f in files:
if not f.endswith('.pdf'): if not f.endswith('.pdf'):
self.vprint('F! '+f)
continue continue
if self.args.instrument: if self.args.instrument:
instr_in_file = False instr_in_file = False
@ -151,8 +167,10 @@ class MakeBook:
instr_in_file = True instr_in_file = True
break break
if not instr_in_file: if not instr_in_file:
self.vprint('F! '+f)
continue continue
# Include file # Include file
self.vprint('F '+f)
if newline: if newline:
self.fwrite(u'\\newpage') self.fwrite(u'\\newpage')

View file

@ -1,100 +0,0 @@
\addcontentsline{toc}{section}{Marches}
\mysection{subsection}{Standards}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{2/4 Standards (side)},p2_4_standards}, pagecommand={}]{./scores/standards/standards-24_standards.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{3/4 Standards Setting 1 (side)},p3_4_standards_nsetting_1}, pagecommand={}]{./scores/standards/standards-34_standards1.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{3/4 Standards Setting 2 (side)},p3_4_standards_n_setting_2}, pagecommand={}]{./scores/standards/standards-34_standards2.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{3/4 Standards Setting 3 (side)},p3_4_standards_n_setting_3}, pagecommand={}]{./scores/standards/standards-34_standards3.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{4/4 Standards (side)},p4_4_standards}, pagecommand={}]{./scores/standards/standards-44_standards.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{6/8 Standards (side)},p6_8_standards}, pagecommand={}]{./scores/standards/standards-68_standards.side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{6/8 Standard (bass)},p6_8_standard}, pagecommand={}]{./scores/standards/standards-standards.bass.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{6/8 Standards (tenor)},p6_8_standards}, pagecommand={}]{./scores/standards/standards-standards.tenor.pdf}
\mysection{subsection}{2/4 Marches}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Black Bear (side)},pblack_bear}, pagecommand={}]{./scores/2-4_marches/black_bear/2-4_marches-black_bear-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Duncan McInnes (side)},pduncan_mcinnes}, pagecommand={}]{./scores/2-4_marches/duncan_mcinness/2-4_marches-duncan_mcinness-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{MacKenzie Highlanders (side)},pmackenzie_highlanders}, pagecommand={}]{./scores/2-4_marches/mackenzie_highlanders/2-4_marches-mackenzie_highlanders-side.alt.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{MacKenzie Highlanders (side)},pmackenzie_highlanders}, pagecommand={}]{./scores/2-4_marches/mackenzie_highlanders/2-4_marches-mackenzie_highlanders-side.pdf}
\mysection{subsection}{3/4 Marches}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Castle Dangerous (tenor)},pcastle_dangerous}, pagecommand={}]{./scores/3-4_marches/castle_dangerous/3-4_marches-castle_dangerous-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{On the Road to Passchendaele (side)},pon_the_road_to_passchendaele}, pagecommand={}]{./scores/3-4_marches/on_the_road_to_passchendaele/3-4_marches-on_the_road_to_passchendaele-side.pdf}
\mysection{subsection}{4/4 Marches}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{51st Highland Division (side)},p51st_highland_division}, pagecommand={}]{./scores/4-4_marches/51st_highland_division/4-4_marches-51st_highland_division-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Flett from Flotta (side)},pflett_from_flotta}, pagecommand={}]{./scores/4-4_marches/flett_from_flotta/4-4_marches-flett_from_flotta-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Minstrel Boy (side)},pminstrel_boy}, pagecommand={}]{./scores/4-4_marches/minstrel_boy/4-4_marches-minstrel_boy-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Rowan Tree (side)},prowan_tree}, pagecommand={}]{./scores/4-4_marches/rowan_tree/4-4_marches-rowan_tree-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Scotland the Brave (side)},pscotland_the_brave}, pagecommand={}]{./scores/4-4_marches/scotland_the_brave/4-4_marches-scotland_the_brave-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Leaving of Liverpool (drums)},pthe_leaving_of_liverpool}, pagecommand={}]{./scores/4-4_marches/the_leaving_of_liverpool/4-4_marches-the_leaving_of_liverpool-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Leaving of Liverpool (side)},pthe_leaving_of_liverpool}, pagecommand={}]{./scores/4-4_marches/the_leaving_of_liverpool/4-4_marches-the_leaving_of_liverpool-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Leaving of Liverpool (tenor)},pthe_leaving_of_liverpool}, pagecommand={}]{./scores/4-4_marches/the_leaving_of_liverpool/4-4_marches-the_leaving_of_liverpool-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Old Rustic Bridge (tenor)},pthe_old_rustic_bridge}, pagecommand={}]{./scores/4-4_marches/the_old_rustic_bridge/4-4_marches-the_old_rustic_bridge-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Pikeman's March (drums)},pthe_pikeman_s_march}, pagecommand={}]{./scores/4-4_marches/the_pikemans_march/4-4_marches-the_pikemans_march-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Pikeman's March (side)},pthe_pikeman_s_march}, pagecommand={}]{./scores/4-4_marches/the_pikemans_march/4-4_marches-the_pikemans_march-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{The Pikeman's March (tenor)},pthe_pikeman_s_march}, pagecommand={}]{./scores/4-4_marches/the_pikemans_march/4-4_marches-the_pikemans_march-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Wings (side)},pwings}, pagecommand={}]{./scores/4-4_marches/wings/4-4_marches-wings-side.pdf}
\mysection{subsection}{5/4 Marches}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Cullen Bay (bass)},pcullen_bay}, pagecommand={}]{./scores/5-4_marches/cullen_bay/5-4_marches-cullen_bay-bass.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Cullen Bay (drums)},pcullen_bay}, pagecommand={}]{./scores/5-4_marches/cullen_bay/5-4_marches-cullen_bay-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Cullen Bay (side)},pcullen_bay}, pagecommand={}]{./scores/5-4_marches/cullen_bay/5-4_marches-cullen_bay-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Cullen Bay (tenor)},pcullen_bay}, pagecommand={}]{./scores/5-4_marches/cullen_bay/5-4_marches-cullen_bay-tenor.pdf}
\mysection{subsection}{6/8 Marches}
\includepdf[pages=-, addtotoc={1,subsubsection,3,{Hills of Glenorchy (side)},phills_of_glenorchy}, pagecommand={}]{./scores/6-8_marches/hills_of_glenorchy/6-8_marches-hills_of_glenorchy-side.pdf}
\mysection{section}{Hornpipes}
\includepdf[pages=-, addtotoc={1,subsection,2,{Itchy Fingers (pipes) (side)},pitchy_fingers}, pagecommand={}]{./scores/hornpipes/itchy_fingers/hornpipes-itchy_fingers-side.pdf}
\mysection{section}{Jigs}
\includepdf[pages=-, addtotoc={1,subsection,2,{Seaforth Sticks (drums)},pseaforth_sticks}, pagecommand={}]{./scores/jigs/seaforth_sticks/jigs-seaforth_sticks-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Seaforth Sticks (side)},pseaforth_sticks}, pagecommand={}]{./scores/jigs/seaforth_sticks/jigs-seaforth_sticks-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Seaforth Sticks (tenor)},pseaforth_sticks}, pagecommand={}]{./scores/jigs/seaforth_sticks/jigs-seaforth_sticks-tenor.pdf}
\mysection{section}{Strathspeys}
\includepdf[pages=-, addtotoc={1,subsection,2,{A. A. Cameron's Strathspey (side)},pa._a._cameron_s_strathspey}, pagecommand={}]{./scores/strathspeys/aa_camerons/strathspeys-aa_camerons-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (bass)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-bass.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (drums)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (full)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-full.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (pipes)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-pipes.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (side)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Lady MacKenzie of Fairburn (tenor)},plady_mackenzie_of_fairburn}, pagecommand={}]{./scores/strathspeys/lady_mackenzie_of_fairburn/strathspeys-lady_mackenzie_of_fairburn-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Molly Connell (bass)},pmolly_connell}, pagecommand={}]{./scores/strathspeys/molly_connell/strathspeys-molly_connell-bass.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Molly Connell (drums)},pmolly_connell}, pagecommand={}]{./scores/strathspeys/molly_connell/strathspeys-molly_connell-drums.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Molly Connell (side)},pmolly_connell}, pagecommand={}]{./scores/strathspeys/molly_connell/strathspeys-molly_connell-side.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Molly Connell (tenor)},pmolly_connell}, pagecommand={}]{./scores/strathspeys/molly_connell/strathspeys-molly_connell-tenor.pdf}
\newpage
\includepdf[pages=-, addtotoc={1,subsection,2,{Molly Connell (side)},pmolly_connell}, pagecommand={}]{./scores/strathspeys/molly_connell/strathspeys-rolls.side.pdf}
\mysection{section}{Reels}
\mysection{section}{Other}
\includepdf[pages=-, addtotoc={1,subsection,2,{Band of Brothers (snare)},pband_of_brothers}, pagecommand={}]{./scores/other/other-band_of_brothers.snare.pdf}

View file

@ -51,6 +51,12 @@ class MakeDrum:
action='store_true', dest='view_spacing', default=False, action='store_true', dest='view_spacing', default=False,
help='Turn on "Paper.annotatespacing".') help='Turn on "Paper.annotatespacing".')
parser.add_argument('-g','--generated',
dest='gen_out', default=self.TMP_DIR,
help='Put generated lilyfiles in $gen_out')
parser.add_argument('--no-compile', default=True,
action='store_false', dest='compile',
help='Do not compile generated Lilypond files')
parser.add_argument('--no-log', parser.add_argument('--no-log',
action='store_false', dest='log', default=True, action='store_false', dest='log', default=True,
help='Do not generate log files.') help='Do not generate log files.')
@ -61,7 +67,7 @@ class MakeDrum:
dest='out_dir', default='pdf', dest='out_dir', default='pdf',
help='Output dir, for lilypond. If it doesn\'t exist, try to create it') help='Output dir, for lilypond. If it doesn\'t exist, try to create it')
parser.add_argument('music_file', parser.add_argument('music_file',
default='', nargs='+', default='', nargs='*',
help='file to process') help='file to process')
parser.add_argument('-@', '--list_file', parser.add_argument('-@', '--list_file',
dest='list_file', default='', dest='list_file', default='',
@ -86,6 +92,11 @@ class MakeDrum:
if self.args.list_file != '': if self.args.list_file != '':
self.args.music_file.append(open(self.args.list_file, 'r').readlines()) self.args.music_file.append(open(self.args.list_file, 'r').readlines())
close(self.args.list_file) close(self.args.list_file)
# Check for files
if not self.args.music_file:
parser.print_usage()
return
# Clean up of files # Clean up of files
self.remove_tmp_dir = self.args.clean self.remove_tmp_dir = self.args.clean
@ -103,20 +114,14 @@ class MakeDrum:
os.chdir(self.MASTER_DIR) os.chdir(self.MASTER_DIR)
for file_path in self.args.music_file: for file_path in self.args.music_file:
self.processit(self.TMP_DIR, os.path.join(self.RUN_DIR, file_path)) self.processit(self.TMP_DIR, os.path.join(self.RUN_DIR, file_path), self.args.gen_out, self.args.compile)
#if not #if not
#os.rmdir(self.TMP_DIR) #os.rmdir(self.TMP_DIR)
os.chdir(self.RUN_DIR) os.chdir(self.RUN_DIR)
def processit(self, tmp_dir, file): def processit(self, tmp_dir, file, gen_out, compile):
if self.args.log:
logfile = os.path.join(self.TMP_DIR, os.path.relpath(file).replace(".ly", '').replace('/', '-')+'.log')
log = ' > '+logfile+' 2>&1'
else:
log = ''
if self.args.format is None: if self.args.format is None:
if file.endswith(".book"): if file.endswith(".book"):
header_format = "header_book" header_format = "header_book"
@ -127,11 +132,34 @@ class MakeDrum:
tmp_file = self.maketemplate(tmp_dir, file, header_format) tmp_file = self.maketemplate(tmp_dir, file, header_format)
if gen_out is not None and gen_out != tmp_dir:
new_tmp_file = os.path.basename(tmp_file).replace(self.TMP_PREFIX, '');
print ('Moving ', tmp_file, ' to ', new_tmp_file, end=' ', flush=True)
gen_dir = os.path.join(self.RUN_DIR, gen_out);
# if not dir $gen_out, make it
if not os.path.exists(gen_dir):
try: os.makedirs(gen_dir)
except:
print('[Error]')
print(' ! Seems like the {} directory cannot be created'.format(gen_dir))
return
# mv file to dir, remove self.TMP_PREFIX
os.rename(tmp_file, os.path.join(gen_dir, new_tmp_file))
tmp_file = new_tmp_file
print('[OK]')
if compile:
if self.args.log:
logfile = os.path.join(self.TMP_DIR, os.path.relpath(file).replace(".ly", '').replace('/', '-')+'.log')
log = ' > '+logfile+' 2>&1'
else:
log = ''
print ('Compiling ', file, end=' ', flush=True) print ('Compiling ', file, end=' ', flush=True)
if not self.args.log: if not self.args.log:
print() print()
lilyout = os.path.join(self.RUN_DIR, self.args.out_dir, os.path.basename(tmp_file).replace(self.TMP_PREFIX, '').replace(".ly", ''))
lilyout = os.path.join(os.path.curdir, self.args.out_dir, os.path.basename(tmp_file).replace(self.TMP_PREFIX, '').replace(".ly", '')) print (lilyout)
lilycmd = self.LILYPOND+' --pdf --output='+lilyout+' '+tmp_file+log lilycmd = self.LILYPOND+' --pdf --output='+lilyout+' '+tmp_file+log
if os.system(lilycmd) != 0: if os.system(lilycmd) != 0:
@ -148,7 +176,6 @@ class MakeDrum:
os.remove(logfile) os.remove(logfile)
os.remove(tmp_file) os.remove(tmp_file)
def maketemplate(self, tmp_dir, file, header_format): def maketemplate(self, tmp_dir, file, header_format):
lily_includes = '' lily_includes = ''
include_drum_file = False include_drum_file = False
@ -157,11 +184,9 @@ class MakeDrum:
for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']: for ext in ['full', 'side', 'tenor', 'bass', 'drum', 'snare']:
if ext in file: if ext in file:
include_drum_file = True include_drum_file = True
for ext in ['full', 'pipes']: for ext in ['full', 'pipes']:
if ext in file: if ext in file:
include_pipe_file = True include_pipe_file = True
if include_drum_file: if include_drum_file:
lily_includes = lily_includes + u""" lily_includes = lily_includes + u"""
\\include \""""+self.args.lilydrum+"""\" \\include \""""+self.args.lilydrum+"""\"
@ -178,14 +203,14 @@ class MakeDrum:
out_file.write(u'\ufeff') out_file.write(u'\ufeff')
out_file.write(u""" out_file.write(u"""
% Generated from """+file+""" by """+__file__+""" % Generated from """+file+""" by """+__file__+""" version """+self.VERSION+"""
\\version "2.18.0" \\version "2.18.0"
#(ly:set-option 'point-and-click #f) #(ly:set-option 'point-and-click #f)
"""+ lily_includes +""" """+ lily_includes +"""
\\include \""""+header_format+""".ily" \\include \""""+os.path.join(os.path.abspath(self.MASTER_DIR), header_format.strip(".ily")+""".ily""")+"""\"
#(set-global-staff-size """+self.args.staffsize+""") #(set-global-staff-size """+self.args.staffsize+""")
#(set-default-paper-size \""""+self.args.papersize+"""\" '"""+self.args.orientation+""") #(set-default-paper-size \""""+self.args.papersize+"""\" '"""+self.args.orientation+""")
@ -204,7 +229,7 @@ class MakeDrum:
# Rewrite includes to absolute location of file # Rewrite includes to absolute location of file
incline = line.replace('\\include', '').strip('"\' ') incline = line.replace('\\include', '').strip('"\' ')
if not incline.startswith('\\'): #already absolute if not incline.startswith('\\'): #already absolute
incline = os.path.join(os.path.relpath(os.path.dirname(file)), incline) incline = os.path.join(os.path.abspath(os.path.dirname(file)), incline)
line = "\\include \""+incline+"\"" line = "\\include \""+incline+"\""
if printit: if printit:
out_file.write(line.replace('\r', '')+'\n') out_file.write(line.replace('\r', '')+'\n')
@ -212,6 +237,4 @@ class MakeDrum:
# Return tmp_file_path # Return tmp_file_path
return tmp_file return tmp_file
MakeDrum(); MakeDrum();

View file

@ -4,25 +4,25 @@
composerSide = "v1.1, 2015" composerSide = "v1.1, 2015"
snareA = \drummode { snareA = \drummode {
\flamddr d4 \flam g8.[\fr d16:64(] d8.[) \dragddr d16] d8.[ \fr g16] | \flamddr d4 \flam g8.[\fr d16:64(] d8.[) \dragddr d16] d8.[ \fr g16] |
d8.:64[(-> g16]) \triplet { d16[ g d g d8]} \triplet { g8[ d8 \flam g8] } \flam d8.[ g16] \dr | d8.:64[(-> g16]) \triplet { d16[ g d g d8]} \triplet { g8[ d8 \flamddr g8] } \flam d8.[ \fr g16] |
d16:64[( d8.]) \fr g8.[ \drag d16] \triplet { d16[ g d g d8] } g8.[ g16] \dr| d16:64[( d8.]) g8.[ \drag d16] \triplet { d16[ g d g d8] } g8.[ g16] |
\flamd \triplet { d8 g d } \flam g8.[ \flam g16] \triplet { d16 g d g d8 } g8 \fr \flamddr \triplet { d8 \fr g d } \flamddr g8.[ \flam g16] \triplet { d16 g d g d8 } g8 \fr
} }
snareBA = \drummode { snareBA = \drummode {
\partial 8 g8 \dr | \partial 8 g8 \dr |
d4:32( d8.[) \drag d16] \fr \triplet { d16[ g d g d8] } g8.[ g16] \dr | d4:32( d8.[) \drag d16] \fr \triplet { d16[ g d g d8] } g8.[ g16] \dr |
\drag d16[ d8.] \flam d8.[ \flam g16] \fr \triplet { d16[ g d g d8] } \triplet { g8[ d g] \dr } | \drag d16[ d8.] \flam d8.[ \flam g16] \fr \triplet { d16[ g d g d8] } \triplet { g8[ d g] } |
\flamd \triplet { d8[ \fr g16 g16 d8] } g8.[ g16]\dr \flamd \triplet { d8[->\fr g16 g16 d8] } g8.[ g16] \dr | \flamddr \triplet { d8[ \fr g16 g16 d8] } g8.[ g16] \flamddr \triplet { d8[\fr g16 g16 d8] } g8.[ g16] |
\flamd \triplet { d8[ g d] } \flam g8.[ \flam g16] \triplet { d16[ g d g d8] } g8 s8 \fr | \flamddr \triplet { d8[ \fr g d] } \flamddr g8.[ \flam g16] \triplet { d16[ g d g d8] } g8 s8 \fr |
} }
snareBB = \drummode { snareBB = \drummode {
\partial 8 g8 | \partial 8 g8 |
d4:32( d8.[) \drag d16] \triplet { d16[ g d g d8] } g8.[ g16] | d4:32( d8.[) \drag d16] \triplet { d16[ g d g d8] } g8.[ g16] |
\drag d16[ d8.] \flam d8.[ \flam g16] \triplet { d16[ g d g d8] } \triplet { g8[\> d g] } | \drag d16[ d8.] \flam d8.[ \flam g16] \triplet { d16[ g d g d8] } \triplet { g8[\> d g]\! } |
\flam d4 \flam g8.[\! d16:64]( d8.[) \drag d16] d8.[ g16] | \flam d4 \flam g8.[ d16:64]( d8.[) \drag d16] d8.[ g16] |
\flamd \triplet { d8[ g d] } \flam g8.[ \flam g16] \triplet { d16[ g d g d8] } g8 s8 | \flamd \triplet { d8[ g d] } \flam g8.[ \flam g16] \triplet { d16[ g d g d8] } g8 s8 |
} }