PDA

View Full Version : [TuT] Setting up WebUI for uTorrent Clients



Aurion
17.08.08, 20:18
First of all hey there guys !! Hope you are doing Fine !! Its been a quite while since I posted my last Tutorial so here Iam again brining up a nice TuT which some of you might find it interesting to apply it down,so here we go :

Introduction :

Upon setting up a functioning WebUI your first goal should be to familiarize yourself with the interface... but it's usefulness can be expanded greatly from the base setup shortly thereafter.

The first thing you should do is probably setup a Dynamic DNS for it, what that means is if you have a residential connection with an IP that changes every now and then, you can have one address you, or for that matter anyone else can access your stats from (hopefully everyone else atleast uses an approved guest account).

The easiest way of doing this is through a free service hosted by the guys at DynDNS (www.dyndns.org).

Step By Step Guide :

1. Open up their site and create an account, then go ahead and create a free Dynamic DNS Host. You will be confronted with a page asking for a hostname prefix and suffix. The prefix can be anything you want, there is a drop down box for the last part of your address.

2. Check wildcard and leave TTL at 60s... leave everything else as is, now install the DynDNS updating software onto the machine with uTorrent. If not available install it on a often online machine that runs in the same network under the same public IP.

You should now be able to access the uTorrent WebUI from anywhere without worrying about IP changes. Just use it this way:

Nametwo.com - name two Resources and Information. (http://www.nameone.nametwo.com:port/gui/)

3. Now that you're set to access the interface anywhere and anytime we can make the WebUI more practical and efficient by using an extension for Firefox. Grab that Extension here (http://bin.thinkpond.org/site/utorrentext/download.html)

4. Install by dropping the saved file into your Firefox window.

5. You'll see a new addition on the bottom bar of Firefox, it should say "uTorrent Not Running".

6. Right click on this and fill in the proper details... sadly I've found that this extension just plain doesn't work with a Dynamic DNS host. The easy fix is to just use your IP in that area, and if it buggers out, check What Is My IP Address? - IP Address Lookup, Bandwidth Speed Test, IP Info, plus more (http://www.whatismyip.com/) for your current one. If the machine your on isn't on the same network as uTorrent, and you're not sure of the new IP you might have pulled at home or elsewhere, just ping your DynDNS host and you'll see the new IP (in Windows just hit Start > Run > type "cmd" > ping Name.com - Domain registration and digital brand management (http://www.host.name.com) > hit "Enter")

Note :

The extension once configured will allow you to toggle a sidebar of your uTorrent WebUI by left-clicking on it, and possibly the coolest part is it's display of some minor info right on your browser's window. Not to mention that people who want to get on torrents plain fast without any fuss can merely drag the link to the .torrent file and drop it on the readout of the WebUI and after a little delay see a new download starting as per the default save location set in their uTorrent client.

7. As a final task you can setup a nifty script that makes any old WebUI anywhere out there interface with mIRC.Open up mIRC and hit Alt+R, in the resulting window choose the remote tab.Create a new fresh slate by going into File and choosing the aptly titled "New".

--> Now comes the funniest part which is Injecting the Code sheet into your fresh working ground (Just Copy/Paste the below script):


; type /uthelp for info

alias ut_getinfo {

; -============================ CHANGE THE VALUES BELOW ============================- ;

; the username for the webui:
var %ut_username (Name)

; the password for the webui:
var %ut_password (Password)

; the hostname or ip of the machine running µtorrent, if µtorrent + webui is running on the same computer leave it at localhost:
set %ut_url (Location... Dynamic DNS address will work)

; µtorrent port (or the alternative webui port if activated):
var %ut_port (Port)

; OPTIONAL! maximum number of displayed torrentlines (not counting header and footer):
set %ut_flood_max 5

; -============================ CHANGE THE VALUES ABOVE ============================- ;

var %continue
if ( (ut_info).to ) {
if ( (ut_info).to > 25 ) {
ut_getinfo_end
%continue =
}
}
else {
%continue =
}
if ( %continue == && $1 && $2 ) {
set %ut_activechan $1
set %ut_action $2
if ( %ut_action == find && $3 ) {
set %ut_find_string $3-
msg %ut_activechan 12[µT] Showing the first %ut_flood_max torrents containing $3-
}
elseif ( %ut_action == downloading ) {
msg %ut_activechan 12[µT] Showing the first %ut_flood_max torrents downloading.
}
elseif ( %ut_action == seeding ) {
msg %ut_activechan 12[µT] Showing the first %ut_flood_max torrents seeding.
}
set %ut_credentials (%ut_username $+ : $+ %ut_password,m)
set %ut_download 0
set %ut_downloadingcount 0
set %ut_err_torrents 0
set %ut_flood_count 0
set %ut_ratio_sum 0
set %ut_remaining 0
set %ut_seedingcount 0
set %ut_sockerr 0
set %ut_torrentcount 0
set %ut_upload 0
timerut_getinfo_end 1 20 ut_getinfo_end
sockopen ut_info %ut_url %ut_port
}
}

on 1:SOCKOPEN:ut_info:{
if ( > 0 ) {
%ut_sockerr =
ut_getinfo_end
return
}
sockwrite -n GET /gui/?list=1 HTTP/1.1
sockwrite -n Host: %ut_url
sockwrite -n Connection: Keep-Alive
sockwrite -n Authorization: Basic %ut_credentials
sockwrite -n
unset %ut_credentials
unset %ut_url
}

on 1:SOCKREAD:ut_info:{
if ( > 0 ) {
%ut_sockerr =
ut_getinfo_end
return
}
sockread %temp
if ( (%temp,12) == ,"torrentc": ) {
ut_getinfo_end
}
else {
var %temp2 = ( %temp , 2, ( ( %temp ) - 3 ) )
%temp2 = (%temp2,",`)
if ( (%temp2,44) >= 19 ) {
var %hash = (%temp2,1,34)
var %torrentname = (%temp2,3,34)
var %label
if ( (%temp2,34) == 6 ) {
%label = (%temp2,5,34)
%temp2 = (%temp2,%label,)
}
%temp2 = (%temp2,%torrentname,,%hash,)
%torrentname = (%torrentname,`,&quot
if ( (%temp2,44) == 19 ) {
var %progress (%temp2,5,44)
var %status (%temp2,2,44)
inc %ut_remaining (%temp2,19,44)
inc %ut_torrentcount
inc %ut_download (%temp2,10,44)
inc %ut_upload (%temp2,9,44)
inc %ut_ratio_sum (%temp2,8,44)
if ( (%status,1) == 1 && (%status,6) == 0 ) {
if ( %progress == 1000 ) {
inc %ut_seedingcount
}
else {
inc %ut_downloadingcount
}
}
if ( %ut_action == find ) {
if ( %ut_find_string isin %torrentname ) {
if ( %ut_flood_count < %ut_flood_max ) {
if ( %progress == 1000 ) {
/msg %ut_activechan 12[µT]14 (%torrentname,40)  $+ ( %status , %progress ) UP: $+ ( (%temp2,7,44) ).suf SIZE: $+ ( (%temp2,4,44) ).suf R: $+ ( (%temp2,8,44) / 1000) UL: $+ ( (%temp2,9,44) ).suf $+ /s P: $+ (%temp2,13,44) $+ ( $+ (%temp2,14,44) $+ ) S: $+ (%temp2,15,44) $+ ( $+ (%temp2,16,44) $+ )
}
else {
/msg %ut_activechan 12[µT]14 (%torrentname,40)  $+ ( %status , %progress ) DOWN: $+ ( (%temp2,6,44) ).suf SIZE: $+ ( (%temp2,4,44) ).suf P: $+ ( %progress / 10) $+ (37) DL: $+ ( (%temp2,10,44) ).suf $+ /s P: $+ (%temp2,13,44) $+ ( $+ (%temp2,14,44) $+ ) S: $+ (%temp2,15,44) $+ ( $+ (%temp2,16,44) $+ ) ETA: $+ ( (%temp2,11,44) )
}
}
inc %ut_flood_count
}
}
elseif ( %ut_action == downloading && %progress < 1000 && (%status,1) == 1 && (%status,6) == 0) {
if ( %ut_flood_count < %ut_flood_max ) {
/msg %ut_activechan 12[µT]14 (%torrentname,40)  $+ ( %status , %progress ) DOWN: $+ ( (%temp2,6,44) ).suf SIZE: $+ ( (%temp2,4,44) ).suf P: $+ ( %progress / 10) $+ (37) DL: $+ ( (%temp2,10,44) ).suf $+ /s P: $+ (%temp2,13,44) $+ ( $+ (%temp2,14,44) $+ ) S: $+ (%temp2,15,44) $+ ( $+ (%temp2,16,44) $+ ) ETA: $+ ( (%temp2,11,44) )
}
inc %ut_flood_count
}
elseif ( %ut_action == seeding && %progress == 1000 && (%status,1) == 1 && (%status,6) == 0 ) {
if ( %ut_flood_count < %ut_flood_max ) {
/msg %ut_activechan 12[µT]14 (%torrentname,40)  $+ ( %status , %progress ) UP: $+ ( (%temp2,7,44) ).suf SIZE: $+ ( (%temp2,4,44) ).suf R: $+ ( (%temp2,8,44) / 1000) UL: $+ ( (%temp2,9,44) ).suf $+ /s P: $+ (%temp2,13,44) $+ ( $+ (%temp2,14,44) $+ ) S: $+ (%temp2,15,44) $+ ( $+ (%temp2,16,44) $+ )
}
inc %ut_flood_count
}
}
else {
inc %ut_err_torrents
}
}
}
}

alias ut_getinfo_end {
sockclose ut_info
if ( %ut_sockerr == 0 ) {
if ( %ut_action == find || %ut_action == downloading || %ut_action == seeding ) {
msg %ut_activechan 12[µT] Found %ut_flood_count torrents.
}
if ( %ut_action == stats ) {
if ( %ut_err_torrents > 0 ) {
msg %ut_activechan 12[µT] Torrents: ( %ut_torrentcount + %ut_err_torrents ) (Seed: $+ %ut_seedingcount $+ , Leech: $+ %ut_downloadingcount $+ , Inactive: $+ ( %ut_torrentcount - %ut_seedingcount - %ut_downloadingcount ) $+ , Unknown: $+ %ut_err_torrents $+ ). (%ut_download).suf $+ /s down, (%ut_upload).suf $+ /s up. Ratio: (((%ut_ratio_sum / 1000) / %ut_torrentcount),2) Remaining: ( %ut_remaining ).suf
}
else {
msg %ut_activechan 12[µT] Torrents: %ut_torrentcount (Seed: $+ %ut_seedingcount $+ , Leech: $+ %ut_downloadingcount $+ , Inactive: $+ ( %ut_torrentcount - %ut_seedingcount - %ut_downloadingcount ) $+ ). (%ut_download).suf $+ /s down, (%ut_upload).suf $+ /s up. Ratio: (((%ut_ratio_sum / 1000) / %ut_torrentcount),2) Remaining: ( %ut_remaining ).suf
}
}
}
else {
msg %ut_activechan 12[µT] Error: webui is not responding (socket error).
}
unset %ut_action
unset %ut_activechan
unset %ut_credentials
unset %ut_download
unset %ut_downloadingcount
unset %ut_err_torrents
unset %ut_find_string
unset %ut_flood_max
unset %ut_flood_count
unset %ut_ratio_sum
unset %ut_remaining
unset %ut_seedingcount
unset %ut_sockerr
unset %ut_torrentcount
unset %ut_url
unset %ut_upload
unset %temp
timerut_getinfo_end off
}

alias ut_convert_status {
if ( $1 isnum && $2 isnum ) {
if ( ( $1, 1) == 1 ) {
if ( ( $1, 6) == 1 ) {
return Paused
}
else {
if ( ( $1, 7) == 1 ) {
if ( $2 == 1000 ) {
return Seeding
}
else {
return Downloading
}
}
else {
if ( $2 == 1000 ) {
return Seeding [F]
}
else {
return Downloading [F]
}
}
}
}
elseif ( ( $1 , 2 ) == 1 ) {
return Checking
}
elseif ( ( $1 , 5 ) == 1 ) {
return Error
}
elseif ( ( $1 , 7 ) == 1 ) {
if ( $2 == 1000 ) {
return Queued Seeding
}
else {
return Queued
}
}
if ( $2 == 1000 ) {
return Finnished
}
else {
return Stopped
}
}
return Invalid
}

alias utstats {
ut_getinfo stats
}
alias utdl {
ut_getinfo downloading
}
alias utul {
ut_getinfo seeding
}
alias utfind {
ut_getinfo find $1-
}
alias uthelp {
echo Command -=- Workings (Make sure you have filled in the username, password, hostname and port of µtorrent in the script first)
echo /uthelp -=- Shows this info
echo /utstats -=- Shows overall µtorrent stats
echo /utdl -=- Shows torrents currently downloading
echo /utul -=- Shows torrents currently seeding
echo /utfind string -=- Shows torrents containing the string
echo /utchan enable/disable -=- Enables/Disables the channel commands (eg: !utstats)
echo People in a channel can request your info using a ! instead of a / in the command (eg: !utstats)

}
alias utchan {
if ( $1 == enable ) {
unset %ut_perm_nochan
}
else {
set %ut_perm_nochan 1
}
}

on *:TEXT:!ut*:#:{
if ( %ut_perm_nochan != 1 ) {
if ( $1 == !utstats ) {
ut_getinfo stats
}
elseif ( $1 == !utdl ) {
ut_getinfo downloading
}
elseif ( $1 == !utul ) {
ut_getinfo seeding
}
elseif ( $1 == !utfind ) {
ut_getinfo find $2-
}
}
}

Note : Exclude word between brackets since those are for explanation & if copied along with the code,the script won't work properly[/color][/size]

8. Do as the script says...

Then hit "Save As" title it whateveryouwant.mrc, load it, and save and exit.

Test it out in somewhere where no one will be offended, and once you have it fine tuned feel free to use it only when necessary and stop if asked to in a channel (it's a fun script to compare progress on new popular torrents, but not if you overdo it).Just type /uthelp to see all the commands.

That's all for now,hope you NJoy this little Scripting Tutorial,one more thing,would like to send some credits on Celzorz's way for preparing Info included in this Tutorial !! :top:

Rebound
17.08.08, 21:13
A very good tut. :top:
But i think it´s better if you copy the script in the "code" tag and not in the "quote" tag. :wink:

best regards

Rebound

anon
17.08.08, 21:26
@Reppy: the script has control characters (they show up as "blocks" in your post). If you edit your Tut to place it between CODE tags, it's better if you "re-paste" the script's code again rather than simply copying it from your post, because those characters may get lost and the script itself be rendered unusable :top:

Rebound
17.08.08, 21:31
That was it, what i mean. :wink:

anon
17.08.08, 21:58
That and the anti-page stretching protection, so even if Reppy copies the script from his original post and the control characters are left untouched, the blank spaces vBulletin places will have broken it anyway.
The unmodified mIRC script can be found here (http://forum.utorrent.com/viewtopic.php?pid=258885) :top:

Aurion
17.08.08, 23:02
Done guys,thanks for informing,it looks Buzzy now :biggrin: