Naming output files – dig out

2010-05-30 Thread Xavier Scheuer
Special recipients: Marek Klein, Valentin.

Hi dear Frogs!

I recently answered a question about output suffix
http://lists.gnu.org/archive/html/bug-lilypond/2010-05/msg00302.html
and I found out the discussion Naming output files:
http://lists.gnu.org/archive/html/lilypond-user/2009-02/msg00801.html

and particularly this message with some code from Marek Klein
http://lists.gnu.org/archive/html/lilypond-user/2009-02/msg00862.html

I'm sorry to dig out this one-year-old discussion but I'm not sure
the code from Marek has been effectively merged (or at least it is not
documented).

Then I have 2 messages from Valentin saying

  2009/3/2 Valentin Villenave v.villen...@gmail.com:
   Carl, Reinhold, should I open a tracker issue or will this fix get
merged soon?

  Oops -- just seen the new thread on -devel. My bad, forget it.


but I couldn't find this thread.

However I found a thread about this on the Frogs mailing list:
Naming output files - status update please?
http://lilypond-frogs.2124236.n2.nabble.com/Naming-output-files-status-update-please-td3027314.html;cid=1275246351289-245#a3027314
http://lilypond-frogs.2124236.n2.nabble.com/Re-Naming-output-files-tp2390220p2390220.html

But this doesn't seem to be finished.


So, in brief, could somebody involved check this code has been
effectively submitted/merged?

I'm sorry not being able to help more but I wasn't a subscriber to all
these mailing lists at this time, and since the messages of this thread
seem to have been cross-posted differently on all the mailing lists
I'm completely lost!

Thanks a lot,
Xavier

PS: Cc to bug- to add this to the tracker if nobody has the time to do
this now...

--
Xavier Scheuer x.sche...@gmail.com

___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: [frogs] Naming output files – dig out

2010-05-30 Thread Graham Percival
On Sun, May 30, 2010 at 10:59:57PM +0200, Xavier Scheuer wrote:
 I recently answered a question about output suffix

Did you try looking on the tracker?

closed, submitted, etc.
http://code.google.com/p/lilypond/issues/detail?id=836

open item:
http://code.google.com/p/lilypond/issues/detail?id=1041

- Graham

___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: [frogs] Naming output files – dig ou t

2010-05-30 Thread Xavier Scheuer
2010/5/30 Graham Percival gra...@percival-music.ca:

 Did you try looking on the tracker?

 closed, submitted, etc.
 http://code.google.com/p/lilypond/issues/detail?id=836

 open item:
 http://code.google.com/p/lilypond/issues/detail?id=1041

Sorry, missed that.

That would have been easier than digging out and searching all around
on ML archives...  :p  :D

Thanks,
Xavier

--
Xavier Scheuer x.sche...@gmail.com

___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: Naming output files

2009-03-01 Thread Marek Klein
2009/2/26 Reinhold Kainhofer reinh...@kainhofer.com


 It would actually be quite simple to implement: In scm/lily-library.scm in
 the
 print- book-with function, instead of storing the file count as a number in
 'output-count, store it in an alist (which is set as the 'output-count
 parser
 variable), with the suffix as key. This way, the counting is per suffix and
 we'll automatically not append the number for the first file with a given
 suffix...

 I think this would be quite a nice task or a frog, so I'm not coding it
 myself, just giving a few pointers... The way to work with the alist
 (that's
 Scheme's idea of a Hash) can be seen e.g. in my counter snippet on LSR:
 http://lsr.dsi.unimi.it/LSR/Item?id=543

 All you need to do is to use assoc-ref instead of count and
 ly:parser-define!
 (instead of the set! in the counter example) with assoc-set! to set one
 entry
 of the hash / alist. The key for the alist would be the suffix. The rest of
 the function doesn't even need to be changed...

 Here is my solution:

(define counter-alist '())

(define (print-book-with parser book process-procedure)
  (let*
  ((paper (ly:parser-lookup parser '$defaultpaper))
   (layout (ly:parser-lookup parser '$defaultlayout))
   (output-count (assoc-ref counter-alist 'output-suffix))
   (base (ly:parser-output-name parser))
   (output-suffix (ly:parser-lookup parser 'output-suffix)) )

(if (string? output-suffix)
(set! base (format ~a-~a base (string-regexp-substitute
   [^a-zA-Z0-9-] _ output-suffix

;; must be careful: output-count is under user control.
(if (not (integer? output-count))
(set! output-count 0))

(if ( output-count 0)
(set! base (format #f ~a-~a base output-count)))
(set! counter-alist (assoc-set! counter-alist output-suffix (1+
output-count)))
(process-procedure book paper layout base)
))

I didn't use ly:parser-define! instead of the set! (I couldn't make it to
work).
The output-count variable is no more under user control this way.

Please do comment.

-- 
Marek Klein
http://gregoriana.sk
___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: Naming output files

2009-02-26 Thread Mats Bengtsson



Francisco Vila wrote:



... Is there a command I can add to a \book{}
block to specify the output file name, or the suffix to add to the base
name. E.g. to get files names such as:

song-C.pdf
song-Eb.pdf
etc.




The answer is in the manual, see Application Usage 3.2.1
http://lilypond.org/doc/v2.12/Documentation/user/lilypond-program/Invoking-lilypond.html
  
The obvious follow-up question is, why you get the additional number 
even when the file name would
be unique without the number, i.e. when the output-suffix is set 
differently for each book block.
I realize that it probably requires a few more lines of code in the 
LilyPond implementation to handle
the book-keeping, but it would still be a valuable feature. Therefore, I 
send a copy of this feature request

to bug-lilypond.

   /Mats


___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: Naming output files

2009-02-26 Thread Reinhold Kainhofer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Donnerstag, 26. Februar 2009 10:58:19 Mats Bengtsson wrote:
 The obvious follow-up question is, why you get the additional number
 even when the file name would
 be unique without the number, i.e. when the output-suffix is set
 differently for each book block.
 I realize that it probably requires a few more lines of code in the
 LilyPond implementation to handle
 the book-keeping, but it would still be a valuable feature.

It would actually be quite simple to implement: In scm/lily-library.scm in the 
print- book-with function, instead of storing the file count as a number in 
'output-count, store it in an alist (which is set as the 'output-count parser 
variable), with the suffix as key. This way, the counting is per suffix and 
we'll automatically not append the number for the first file with a given 
suffix...

I think this would be quite a nice task or a frog, so I'm not coding it 
myself, just giving a few pointers... The way to work with the alist (that's 
Scheme's idea of a Hash) can be seen e.g. in my counter snippet on LSR:
http://lsr.dsi.unimi.it/LSR/Item?id=543

All you need to do is to use assoc-ref instead of count and ly:parser-define! 
(instead of the set! in the counter example) with assoc-set! to set one entry 
of the hash / alist. The key for the alist would be the suffix. The rest of 
the function doesn't even need to be changed...

Cheers,
Reinhold

PS: Why do we call (string-regexp-substitute [^a-zA-Z0-9-] _ output-
suffix) on the suffix? This makes it impossible to use e.g. Flöte as the 
suffix, which is German for Flute! Similar, any other accented or non-latin 
letter is not possible and will be replaced by a _. Similarly, spaces or + 
etc. are also not allowed... I understand that some letters may cause problems 
(in particular, :, /, \ and maybe also ? and *), but I don't think 
this is a reason to prevent everything other than latin letters and numbers.

- -- 
- --
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial  Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJpm+wTqjEwhXvPN0RAgD5AJ9Yevrt36GTtR544ti788eerN3+pACgjXuT
oNwcsvyQzNkBe8JVjnixem0=
=//Rx
-END PGP SIGNATURE-


___
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond