#266: harbor.input callbacks
----------------------------+-----------------------------------------------
  Reporter:  romeodeepmind  |       Owner:  toots      
      Type:  Feature        |      Status:  closed     
  Priority:  1              |   Milestone:  NEAR FUTURE
 Component:  Liquidsoap     |     Version:  0.9.0+svn  
Resolution:  fixed          |    Keywords:             
       Mac:  1              |       Linux:  1          
    Netbsd:  1              |       Other:  1          
   Freebsd:  1              |  
----------------------------+-----------------------------------------------

Comment(by toots):

 Hi !

 The headers value is a list of the type: {{{(string*string) list}}}, i.e.
 each element in the list is a pair (label,value), where label is always
 lowercase.

 Hence, you shoud look at the various list and string operator in order to
 manipulate them. See there:
   http://savonet.sourceforge.net/doc-0.9.0/reference.html#List

 An interesting function is {{{list.assoc}}}. This function takes a list of
 elements of the type {{{string*string}}} as well as a key, and returns the
 first value that corresponds to this key. For instance, if:
 {{{
   l = [("foo","bar")]
   s = list.assoc("foo",l)
 }}}
 Then {{{s}}} will be the value {{{"foo"}}}.

 {{{list.assoc(x,l)}}} can also be written {{{l[x]}}}.

 Ha, and yes, for passing the values to an external process, you need to
 use the {{{system}}} command. For instance:
 {{{
 system("/path/to/script " ^ quote(headers["ice-name"]) ^ " "
                           ^ quote(headers["ice-description"]))
 }}}

-- 
Ticket URL: <http://savonet.rastageeks.org/ticket/266#comment:7>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Savonet-trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-trac

Reply via email to