Jump to content

Getting current bandwidth cap?


sigmaprojects

Recommended Posts

hey all, just had a quick question, hopefully the functionality is built in for it...

Is there a call I can make to the WebUI API to get the current upload & download bandwidth caps? Something like...

/gui/?GetConfig=Bandwidthcaps

Or something, i'm not even sure if the WebUI has that function in it, but hopefully a moderator or someone could fill me in? Thanks!

Link to comment
Share on other sites

The WebUI is indeed able to grab the speed limits, but I think you're gonna have to grab all the settings from µTorrent. As for how you get the settings, you're gonna have to check the Logger tab in µTorrent after you click the Preferences to see what's requested, or you're gonna have to dig through the source code.

Edit: /gui/?action=getsettings

It's pretty simple to parse this one. max_dl_rate and max_ul_rate are what you're looking for.

Link to comment
Share on other sites

Thanks! Worked out great, for anyone else intrested, here's my quick/dirty/ugly hack job in ColdFusion, but you get the general idea.

The bandwidth info is inside

["max_dl_rate",0,"850"]

["max_ul_rate",0,"80"]

850 being the current d/l rate and 80 being the u/l rate

<cfhttp url="http://192.168.1.200:88/gui/?action=getsettings" username="User" password="Pass" method="get" result="HttpCall"></cfhttp>

<!--- Start Find Max DL Rate --->
<cfset FirstStringToFindDL = '"max_dl_rate",0,"'>
<cfset LastStringToFindDL = '"]'>

<cfset StartString = FIND(FirstStringToFindDL,HttpCall.FileContent)>
<cfset EndString = FIND(LastStringToFindDL,HttpCall.FileContent,StartString)>
<cfset MidString = EndString-StartString>
<cfset MyMaxDLRate = #Mid(HttpCall.FileContent,StartString,MidString)#>
<cfset MyMaxDLRate = #Replace(MyMaxDLRate,FirstStringToFindDL,'','all')#>
<cfset MyMaxDLRate = #Replace(MyMaxDLRate,LastStringToFindDL,'','all')#>
<!--- End Find Max DL Rate --->


<!--- Start Find Max UL Rate --->
<cfset FirstStringToFindUL = '"max_ul_rate",0,"'>
<cfset LastStringToFindUL= '"]'>

<cfset StartString = FIND(FirstStringToFindUL,HttpCall.FileContent)>
<cfset EndString = FIND(LastStringToFindUL,HttpCall.FileContent,StartString)>
<cfset MidString = EndString-StartString>
<cfset MyMaxULRate = #Mid(HttpCall.FileContent,StartString,MidString)#>
<cfset MyMaxULRate = #Replace(MyMaxULRate,FirstStringToFindUL,'','all')#>
<cfset MyMaxULRate = #Replace(MyMaxULRate,LastStringToFindUL,'','all')#>
<!--- End Find Max UL Rate --->

<cfoutput>Max DL: #MyMaxDLRate# - Max UP: #MyMaxULRate#</cfoutput>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...