You have a parameter on `ouput.file` called `reopen_when` which you should able 
to use for that. Schematically, this would look like this:

```
reopen = ref false

def reopen_when() =
  if !reopen then
    reopen := false
    true
  else
    false
  end
end

s = output.file(reopen_when=reopen_when,..)
```

This should allow you to control when to reopen the file by setting `reopen` to 
`true` anytime in the code:
```
reopen := true
```

Now, setting the file title is annoying because the mechanism is a little 
outdate. You'll have to go through the metadata. Combining with your example 
above, it should be something like this:
```
def map_metadata(m) =
  if m["trigger"] == "reopen" then
    reopen := true
    title = m["title"]
    # We only need to pass new metadata with update=true (default)
    [("filename","#{gettimeofday()}-#{title}")]
  else
    []
  end
end

out.SOURCE = map_metadata(out.SOURCE)

out.SOURCE = output.file(reopen_when=reopen_when,"$(filename)",out.SOURCE)
```

Haven't tested this but hopefully that should show you the right direction.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/553#issuecomment-401705935
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to