Hello Yes in fact i don't want to manager this on liquidsoap script but with one webservice.
Just to do one wget to connect and disconnect action ? On_connect --> Wget localhost/newuser.php?port=1234 if return 0 ok if return 1 connection not possible Can you help me ? Thanks ! -----Message d'origine----- De : okay_awright [mailto:[email protected]] Envoyé : vendredi 9 septembre 2011 21:05 À : Guillaume (Numerizik); savonet-users Objet : Re: [Savonet-users] output.harbor - on_connect I've just checked the API documentation, apparently dictionaries can only use strings. here's the script that successfully passes the --check test. But I don't know if it actually performs what you need. ref_conn_limit_per_port = ref [("dummy_port","0")] def get_m(key) = _m = !ref_conn_limit_per_port int_of_string(_m[string_of(key)]) end def unset_m(key) = ref_conn_limit_per_port := list.remove_assoc(string_of(key), !ref_conn_limit_per_port) end def set_m(key, value) = unset_m(key) ref_conn_limit_per_port := list.append( [(string_of(key), string_of(value))], !ref_conn_limit_per_port) end def on_connect(port) = log("connect to stream..."); #counter++ new_limit = get_m(port) new_limit = new_limit + 1 set_m(port, new_limit) end def on_disconnect(port) = log("disconnect from stream..."); #counter-- new_limit = get_m(port) new_limit = new_limit - 1 set_m(port, new_limit) end output.harbor(%mp3(bitrate=128),on_connect=on_connect,on_disconnect=on_disco nnect,port=1234,mount="listen",url="http://www.google.com",icy_metadata="tru e",protocol="icy",source) -- best regards, okay_awright <okay_awright AT ddcr DOT biz> [PGP key on request] On 09/09/2011 20:44, Guillaume (Numerizik) wrote: > Hello > Other message now :) same line > > At line 85, char 7: > this value has type > [(int*_)] (infered at line 81, char 31-37) > but it should be a subtype of > [(string*_)] > > -----Message d'origine----- > De : okay_awright [mailto:[email protected]] Envoyé : vendredi 9 > septembre 2011 17:38 À : Guillaume (Numerizik) Cc : > [email protected] > Objet : Re: [Savonet-users] output.harbor - on_connect > > port is an integer, not a string, sorry. I think it's what the > interpreter has detected. > -ref_conn_limit_per_port = ref [("dummy_port",0)] > +ref_conn_limit_per_port = ref [(0,0)] > > On 09/09/2011 17:35, Guillaume (Numerizik) wrote: >> Hello >> >> I have this message >> >> # At line 85, char 7: >> this value has type >> [(_*int)] (infered at line 81, char 31-48) >> but it should be a subtype of >> [(_*string)] >> >> Line 81 is >> ref_conn_limit_per_port = ref [("dummy_port",0)] >> >> Line 85 is >> def get_m(key) = >> _m = !ref_conn_limit_per_port >> 85 _m[key] >> End >> >> thanks >> -----Message d'origine----- >> De : okay_awright [mailto:[email protected]] Envoyé : vendredi 9 >> septembre 2011 16:53 À : Guillaume (Numerizik) Cc : >> [email protected] >> Objet : Re: [Savonet-users] output.harbor - on_connect >> >> Hi, >> and what about something simpler if you don't want to export those >> values outside liquidsoap, please note that it's been written on the >> fly and it's thus untested, but I hope you get the pitch (i.e. >> reference to a >> map/dictionary): >> >> ref_conn_limit_per_port = ref [("dummy_port",0)] >> >> def get_m(key) = >> _m = !ref_conn_limit_per_port >> _m[key] >> end >> def unset_m(key) = >> ref_conn_limit_per_port := list.remove_assoc(key, >> !ref_conn_limit_per_port) >> end >> def set_m(key, value) = >> unset_m(key) >> ref_conn_limit_per_port := list.append( [(key, value)], >> !ref_conn_limit_per_port) >> end >> >> def on_connect(port) = >> log("connect to stream..."); >> #counter++ >> new_limit = get_m(port) >> new_limit = new_limit + 1 >> set_m(port, new_limit) >> end >> def on_disconnect(port) = >> log("disconnect from stream..."); >> #counter-- >> new_limit = get_m(port) >> new_limit = new_limit - 1 >> set_m(port, new_limit) >> end >> >> > output.harbor(%mp3(bitrate=128),on_connect=on_connect,on_disconnect=on > _disco >> > nnect,port=1234,mount="listen",url="http://www.google.com",icy_metadat > a="tru >> e",protocol="icy",source) >> >> -- >> best regards, >> >> okay_awright >> <okay_awright AT ddcr DOT biz> >> [PGP key on request] >> >> On 09/09/2011 16:26, Guillaume (Numerizik) wrote: >>> Hello >>> >>> I want to connect on one page to know how many connect i have to my >>> stream (with output.harbor) >>> >>> Here my script. Can you help me ? >>> >>> def on_connect(~port) = >>> log("connect to stream..."); >>> http.get("http://localhost80/status.php?id=~port"); >>> end >>> >>> output.harbor(%mp3(bitrate=128),on_connect=on_connect,port=1234,moun >>> t= >>> "liste >>> n",url="http://www.google.com",icy_metadata="true",protocol="icy",so >>> ur >>> ce) >>> >>> >>> http://localhost80/status.php?id=~port record on one database and >>> increase value. I'll use on_disconnect to limit connection... >>> >>> what do you think? >>> >>> thanks >>> >>> >>> -------------------------------------------------------------------- >>> -- >>> -------- Why Cloud-Based Security and Archiving Make Sense Osterman >>> Research conducted this study that outlines how and why cloud >>> computing security and archiving is rapidly being adopted across the >>> IT space for its ease of implementation, lower cost, and increased >>> reliability. Learn more. >>> http://www.accelacomm.com/jaw/sfnl/114/51425301/ >>> _______________________________________________ >>> Savonet-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/savonet-users >> >> >> > ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
