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_disconnect,port=1234,mount="listen",url="http://www.google.com",icy_metadata="true",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,mount="liste
> n",url="http://www.google.com",icy_metadata="true",protocol="icy",source)
>
>
> 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
------------------------------------------------------------------------------
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