Hi,
Good guess, the approach you're trying won't work because the #{..} is
interpreted when creating the string. The output.file doesn't see it
anymore and cannot interpolate.
(Additionally, you should have written "...#{!current_dj}..." rather
than #{current_dj} to see the contents of the reference instread of
the reference instead, which is printed as ref(<contents>).)
To do what you want, I believe the best available way is to use
reopen_on_metadata, and the $(..) notation for interpolating metadata
in the filename. These two features are (partially) documented in the
help of output.file(). Here's also a snippet from
<http://savonet.sourceforge.net/doc-svn/scripts/users_radiopi.liq>.
title = '$(if $(title),"$(title)","Emission inconnue")$(if $(artist),
" par $(artist)") - %m-%d-%Y, %H:%M:%S'
output.file(%vorbis, reopen_on_metadata=true,
fallible=true,
"/data/archives/brutes/" ^ title ^ ".ogg",
live)
Cheers,
David
On Wed, Nov 20, 2013 at 2:49 PM, Tony Miller <[email protected]> wrote:
> Hi,
>
> I'm trying to interpolate a ref "" in the filename for output.filename:
>
> output.file(%mp3,
> "/mnt/wat/datafruits-#{current_dj}-%d-%m-%Y-%H:%M:%S.mp3",
> live_dj,fallible=true)
>
> which gets set in my auth function for input.harbor:
>
> def dj_auth(user,password) =
> u = get_user(user,password)
> p = get_password(user,password)
> #get the output of the php script
> ret = get_process_lines("bundle exec ./dj_auth.rb #{u} #{p}")
> #ret has now the value of the live client (dj1,dj2, or djx), or
> "ERROR"/"unknown"
> ret = list.hd(ret)
> #return true to let the client transmit data, or false to tell
> harbor to decline
> if ret == "true" then
> title_prefix := "LIVE NOW ♫✩ -- #{u} ✩♪"
> current_dj := "#{u}"
> true
> else
> false
> end
> end
>
> live_dj =
> input.harbor("datafruits",port=9000,auth=dj_auth,on_disconnect=on_disconnect)
>
> But when I see the filename its simply this:
> datafruits-ref("")-08-09-2013-20:08:45.mp3
>
> I'm guessing the string is only interpolated at the beginning of the
> script being run, or its interpolated before the dj_auth function is
> run. Any ideas?
>
> Also I noticed this in the docs for output.file:
> (unlabeled) (string): Filename where to output the stream. Some
> strftime conversion specifiers are available: %SMHdmY. You can also
> use $(..) interpolation notation for metadata.
>
> What does it mean by $(..), was that supposed to be #{..} ?
>
> Thanks again,
>
>
> --
> -Tony Miller
> github.com/mcfiredrill
> @freedrull
> freedrool.us
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up now.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
--
David
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users