> > > 1. get-outfile-name returns the base name, with no file extension. I > need to retrieve the output format set by the command line options ( > --format). > 2. This doesn't handle MIDI properly. MIDI scores, even when in the > same book, are output to different files, and the above system can't > predict that. I could leave this unsupported (which is reasonable), but in > any case I need some way to look "inside" the score to see if it has a > MIDI block. > > Checking the output-def type is very easy. Map ly:score-output-defs over ly:book-scores (recursing into bookparts via ly:book-book-parts) to retrieve the output-defs, then just check each of them for the value of output-def-kind via ly:output-def-lookup.
I'm not sure exactly about checking the output format, but I believe it should be straightforward to get it via Scheme, since all the code that outputs to various formats is written in Scheme. Have a look at backend-library.scm as a starting point. Saul