savonet/liquidsoap — pull request #198 by Signez (2014-11-11 23:14:36+00:00)
Title: Accept string functions for output.file filename parameter

Sometimes, it may be cool to have different filenames depending on other things than metadata.

With this patch, we can simply use a function as name, that will be evaluated on output start. We can still use metadata or time interpolation in the string returned.

This patch use `to_string_getter` which is already used in [operators/video_text.ml](https://github.com/savonet/liquidsoap/blob/3118f0299b894f4f24f92e14e868bd92d898adc9/src/operators/video_text.ml#L158).

**Rationale:** At [SynopsLive](http://synopslive.net/), we want to create new records file on demand. These records should have an understandable name, composed by a show slug given by an external process and timestamp of record beginning. To do this with current liquidsoap, we had to inject metadata, but it have weird side effects: as metadata is not known when output is starded, we need to do this:
1. Use `reopen_with_metadata=true`,
2. Start the output,
3. Inject metadata using `insert_metadata`,
4. Ignore the fact that in the meantime, Liquidsoap created a near-empty file with a wrong name.

**Disclamer:** I never wrote any Ocaml before, so feel free to nitpick. However, this compile and run successfully at home.