Thanks a lot! I think I understand now. Hmm so it doesn't look like I get much info from the headers:
2013/02/20 22:49:00 [lang:3] harbor connect 2013/02/20 22:49:00 [lang:3] header: Authorization: Basic c291cmNlOmhhY2ttZQ== 2013/02/20 22:49:00 [lang:3] header: User-Agent: libshout/2.0.0 2013/02/20 22:49:00 [lang:3] header: Content-Type: application/ogg 2013/02/20 22:49:00 [lang:3] header: ice-name: no name 2013/02/20 22:49:00 [lang:3] header: ice-public: 0 Is there no way to pass any arbitrary data to the on_connect function? (Aside from modifying my source client...) I'd like to set certain metadata when I recieve a connection from the harbor. (Like setting the title to the name of the dj that connects...) If I could at the very least get the mount name? If not, I'm sure I can change my architecture to solve this problem in a different way. I could register a different on_connect function for each harbor source I guess. Maybe I'm trying to accomplish this in a silly way. Thank you for being so helpful! Liquidsoap seems very powerful, but I am having difficulties getting the hang of it. Hopefully your reply will help me debug more type issues when I run into them, after some studying. Thanks, -Tony On Sun, Feb 17, 2013 at 2:54 AM, Samuel Mimram <smim...@gmail.com> wrote: > Hi, > > Here your harbor_connect is a function which takes headers as > argument, and since you log headers, headers must be a string. > Therefore harbor_connect is of type > > (string)->unit > > which means that it is a function, taking a string as argument and > returning nothing. Now, if you look at the documentation of > input.harbor (liquidsoap -h input.harbor) you can see that the > expected type for the on_connect argument is > > ([(string*string)])->unit > > which means that it should not take a string as argument, but a list > of pairs of strings (pairs header name / header value). This is what > the error > > At line 16, char 78: > this value has type > (string,...)->_ (infered at line 7 char 1 - line 10 char 3) > but it should be a subtype of > ([_],...)->_ > > means. The morale is that you cannot directly use log to print the > headers. So, if you insist on printing them you have to do something a > bit more involved such as > > def harbor_connect(headers) > list.iter (fun(h) -> log("header: #{fst(h)}: #{snd(h)}"), headers) > log("harbor connect") > end > > which prints a list of pairs of strings. > > I think that this changed between 0.9 and 1.0 which is why the example > is not valid anymore (and actually I don't think it's present anymore > in 1.0 documentation). > > Hope this helps! > > Cheers, > > Samuel. > > On Sun, Feb 17, 2013 at 8:44 AM, Tony Miller <mcfiredr...@gmail.com> wrote: >> Having trouble getting on_connect to work with this small example. The >> error I get is: >> >> At line 16, char 78: >> this value has type >> (string,...)->_ (infered at line 7 char 1 - line 10 char 3) >> but it should be a subtype of >> ([_],...)->_ >> >> I can't really tell what my script is doing differently than say, this >> one: http://savonet.sourceforge.net/doc-0.9.2/radiopi.html >> I guess my harbor_connect function is the wrong type, but why? >> Here is my script: >> >> set("log.file",false) >> set("log.stdout",true) >> set("log.level",3) >> >> set("harbor.bind_addr","0.0.0.0") >> >> def harbor_connect(headers) >> log(headers) >> log("harbor connect") >> end >> >> backup_playlist = playlist(reload=600,"~/grimeyblimey.m3u",conservative=true) >> output.dummy(fallible=true,backup_playlist) >> on_fail = single("/home/tony/samples/vox/datafruitsdotfm_processed.wav") >> >> dj = input.harbor("dj",port=9000,password="hackme", >> on_connect=harbor_connect) >> >> source = fallback(track_sensitive=false,[dj,backup_playlist,on_fail]) >> >> output.icecast(%vorbis, host = "localhost", port = 8000, password = >> "hackme", mount = "liq.ogg", input) >> >> Here's the script on gist, so you can see the line numbers if you need >> to: https://gist.github.com/mcfiredrill/4970578 >> >> -- >> -Tony Miller >> github.com/mcfiredrill >> @freedrull >> freedrool.us >> >> ------------------------------------------------------------------------------ >> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, >> is your hub for all things parallel software development, from weekly thought >> leadership blogs to news, videos, case studies, tutorials, tech docs, >> whitepapers, evaluation guides, and opinion stories. Check out the most >> recent posts - join the conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Savonet-users mailing list >> Savonet-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/savonet-users > > ------------------------------------------------------------------------------ > The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, > is your hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials, tech docs, > whitepapers, evaluation guides, and opinion stories. Check out the most > recent posts - join the conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Savonet-users mailing list > Savonet-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/savonet-users -- -Tony Miller github.com/mcfiredrill @freedrull freedrool.us ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Savonet-users mailing list Savonet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/savonet-users