Hi !

Le samedi 13 juin 2009 00:09:07, fruity a écrit :
> More in practic I whould like to have some tips on how could I avoid
> repeating code over and over:
>
> output.icecast.$codec(stereo=true, restart=true, restart_delay=5,
> mount=mount0, name=name0, host=host0, port=port0, user=user0,
> password=passwd0, genre="NONE", url="NONE", description="NONE",
> public=true, quality=0.2, radio)
>
> and to change the default sets that are common to all streams in one shot.
> (I immagine something like
> output.icecast.$codec(alltheconstant,quality,source)
> I thought (suggested by a friend) I could also try to make an external
> with ffmpeg, so that I have only audio stuff variable but stuff like
> metadata and accountings constant.

There are several things you can do for that.

First, you can use a partial application. For instance if you write:
  
out.mp3  = output.icecast.mp3(stereo=true, restart=true, restart_delay=5,
  host=host0, port=port0, user=user0, password=passwd0, public=true, 
quality=0.2)

The value out.mp3 is then a partial application, and you can use it to spawn 
several sources by passing it the missing arguments, for instance mount, name, 
description and source:

out.mp3(mount="first",name="xx",description="yy",s)
out.mp3(mount="second",name="xx",description="yy"s')

If the repeated parameters are the same for each output.icecast.$codec, you 
can even write:

def my_out(f) = 
  f(stereo=true, restart=true, restart_delay=5,
  host=host0, port=port0, user=user0, password=passwd0, public=true)
end

And then:
out.mp3 = my_out(output.icecast.mp3)
out.vorbis = my_out(output.icecast.vorbis)
out.aacp = my_out(output.icecast.aacplusenc)


Hope that helps.


Romain

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to