Introduction
This is a beta version of the uTorrent web client, it streams the information from the web user interface function, therfore you will need to enable it in the utorrent options panel.
One note i have to add, until the bug is fixed, if there are any commas in the name of the torrent, some errors may occur since the script depends on commas to seperate tokens.
Requirements
dcx.dll Can be found here: http://dcx.scriptsdb.org/archive.htm
dcx_tools.mrc loaded. Found in the package above
For the icon: http://www.hotlinkfiles.com/files/2133718_g2by2/utorrent.ico
Updates
Version 1.0
Version 1.1
Versions 1.2-1.6
Screenshot
Creds to napalm
; µTorrent Addon by Jonesy44 =======;
; irc.chatscape.net // #chatscape ==;
; Version 1.6 ======================;
; ==================================;
; DO NOT EDIT ANYTHING IN THIS FILE=;
; UNLESS YOU KNOW WHAT YOU'RE DOING=;
; ==================================;
; You will need µTorrent open and ==;
; running with the webUI enabled. ==;
; check µTorrent settings for these ;
; options, you will need to know ===;
; your webUI port, username, and ===;
; password. if you are unsure of ===;
; your user/pass use User:guest and ;
; no password ======================;
; ==================================;
menu * {
µTorrent $chr(9) /ut:ut
}
dialog ut {
title "µTorrent - mIRC Addon"
size -1 -1 800 320
icon "images/utorrent.ico"
}
on *:dialog:ut:init:*: {
unset %at
dcx Mark $dname ut_cb
xdialog -c $dname 1 listview 5 5 790 290 report fullrow showsel nolabelwrap tooltip tabstop fullrow autoarrange
xdialog -c $dname 2 button 613 297 90 20
xdid -t $dname 2 Refresh
xdialog -c $dname 3 button 705 297 90 20
xdid -t $dname 3 Close
xdialog -c $dname 4 text 5 300 500 20
xdid -t ut 4 Connecting on: $qt(%ut.addr $+ : $+ %ut.port) with the user name: $qt(%ut.user) (Click to edit)
xdid -t $dname 1 +c 0 100 Name $chr(9) +l 0 25 $chr(35) $chr(9) +l 0 70 Size $chr(9) +l 0 100 Status $chr(9) +l 0 100 Done $chr(9) +l 0 100 Seeds $chr(9) +l 0 100 Peers $chr(9) +l 0 100 Download Speed $chr(9) +l 0 100 Upload Speed $chr(9) +l 0 150 ETA
ut.ref
.timerut 0 1 ut.ref
}
on *:dialog:ut:close:*: {
.timerut off
unset %at
}
alias ut_cb {
; =================================================================================
; DCX callback alias
; =================================================================================
if ($2 == sclick) {
if ($3 == 2) { ut.ref | .timerut 0 1 ut.ref }
if ($3 == 3) { xdialog -x $1 }
if ($3 == 4) { ut.setup }
}
if ($2 == dclick) {
if ($3 == 1 && $xdid(ut,1,$4,1).text) {
if ($input(Would you like to view the µTorrent toolbar for $qt($xdid(ut,1,$4,1).text),iy,µTorrent Hash) == $true) {
ut.window $read(utorrentnthash.temp,s,$xdid(ut,1,$4,1).text))
}
}
}
}
alias ut {
dialog $iif(!$dialog(ut),-m,) ut ut
}
alias ut.setup {
set %ut.addr $input(Please enter your uTorrent WebUI address (127.0.0.1 for the local machine),qe,uTorrent - Address input,%ut.addr)
set %ut.port $input(And which port is this on? (default is your peer connection port),qe,uTorrent - Port input,%ut.port)
set %ut.user $input(Please enter your username for the uTorrent webUI,qe,uTorrent - User input,%ut.user)
set %ut.pass $input(Please enter your password for the uTorrent webUI,qep,uTorrent - Password input,%ut.pass)
if ($dialog(ut)) {
xdid -t ut 4 Connecting on: $qt(%ut.addr $+ : $+ %ut.port) with the user name: $qt(%ut.user) (Click to edit)
ut.ref
.timerut 0 1 ut.ref
}
}
alias ut.ref {
if (!%ut.user || !%ut.addr || !%ut.port) { ut.setup | xdid -r ut 1 | unset %at }
if (!$sock(ut)) {
sockopen ut %ut.addr %ut.port
}
}
alias ut.error {
noop $input(mIRC was unable to connect to your uTorrent webUI. Please make sure it is enabled and your connection information is correct [/ut.setup],io,µTorrent)
if ($dialog(ut)) { xdid -r ut 1 }
unset %at
.timerwindowut* off
.timerut* off
}
on *:SOCKOPEN:ut: {
if ($sockerr) { .timer 1 0 ut.error }
else {
sockwrite -nt $sockname GET /gui/?list=1 HTTP/1.1
sockwrite -nt $sockname Host: %ut.addr
sockwrite -nt $sockname Authorization: Basic $encode(%ut.user $+ : $+ %ut.pass,m)
sockwrite -nt $sockname $crlf
write -c utorrent.temp
write -c utorrentnthash.temp
if (!%at && $dialog(ut)) { did -r ut 1 }
}
}
on *:SOCKREAD:ut: {
var %x
sockread %x
if (*torrentc*:* iswm %x) {
unset %ut.n
set %at 1
sockclose $sockname
}
if (%ut.n && %x) {
write utorrent.temp $remove($gettok(%x,1,44),[,],") $gettok(%x,2 - $calc($numtok(%x,44) - 1),44) $+ , $+ $remove($gettok(%x,$numtok(%x,44),44),[,],")
write utorrentnthash.temp $remove($gettok(%x,3,44),") $remove($gettok(%x,1,44),[,],")
if ($dialog(ut)) {
if (!%at) {
xdid -a ut 1 0 0 + 0 0 0 0 0 0 $remove($gettok(%x,3,44),") $chr(9) + 0 0 0 0 $iif($gettok(%x,18,44) >= 1,$gettok(%x,18,44),*) $chr(9) + 0 0 0 0 $b2m($gettok(%x,4,44)) $chr(9) + 0 0 0 0 $ut.status($gettok(%x,2,44)) $chr(9) +p 0 0 0 0 DONE notheme $chr(9) + 0 0 0 0 $gettok(%x,15,44) ( $+ $gettok(%x,16,44) $+ ) $chr(9) + 0 0 0 0 $gettok(%x,13,44) ( $+ $gettok(%x,14,44) $+ ) $chr(9) + 0 0 0 0 $b2m($gettok(%x,10,44)) $+ /s $chr(9) + 0 0 0 0 $b2m($gettok(%x,9,44)) $+ /s $chr(9) + 0 0 0 0 $replace($duration($gettok(%x,11,44)),years,y,months,m,day,d,days,d,hrs,h,mins,m,secs,s)
}
else {
xdid -v ut 1 %ut.n 1 $remove($gettok(%x,3,44),")
xdid -v ut 1 %ut.n 2 $iif($gettok(%x,18,44) >= 1,$gettok(%x,18,44),*)
xdid -v ut 1 %ut.n 3 $b2m($gettok(%x,4,44))
xdid -v ut 1 %ut.n 4 $ut.status($gettok(%x,2,44))
xdid -v ut 1 %ut.n 6 $gettok(%x,15,44) ( $+ $gettok(%x,16,44) $+ )
xdid -v ut 1 %ut.n 7 $gettok(%x,13,44) ( $+ $gettok(%x,14,44) $+ )
xdid -v ut 1 %ut.n 8 $b2m($gettok(%x,10,44)) $+ /s
xdid -v ut 1 %ut.n 9 $b2m($gettok(%x,9,44)) $+ /s
xdid -v ut 1 %ut.n 10 $replace($duration($gettok(%x,11,44)),years,y,months,m,day,d,days,d,hrs,h,mins,m,secs,s)
}
xdid -v ut 1 %ut.n 5 -v $round($calc($gettok(%x,5,44) / 10),2)
inc %ut.n
}
}
if (*"torrents": [* iswm %x) {
set %ut.n 1
}
}
alias b2m {
; =================================================================================
; Usage: $b2m(N,[inp])[.out]
; Where the values "N", "inp" and ".out" represent;
; N = The size in bytes.
; inp = NOT MANDATORY; The input, if the value of N is NOT in bytes, enter the type here, "kb","mb","gb". Else the script will presume N is in bytes.
; .out = NOT MANDATORY; But if you want it specifically in a certain output switch ".out" to ".b",".kb",".mb","gb". Else the script will output the most appropriate type.
; Using input without ouput of course is pretty useless at will just resolve the same number as you entered.
; =================================================================================
if ($1 isnum) {
var %size = $1
if ($istok(kb mb gb,$2,32)) {
if ($2 == kb) { var %c = 1 }
if ($2 == mb) { var %c = 2 }
if ($2 == gb) { var %c = 3 }
var %x = 1
while (%x <= %c) { var %size = $calc(%size * 1024) | inc %x }
}
if ($istok(b kb mb gb,$prop,32)) { goto $prop }
if (%size <= 1024) { :b | var %val = $round(%size,2) B }
elseif ($calc(%size / 1024) <= 1024) { :kb | var %val = $round($calc(%size / 1024),2) KB }
elseif ($calc(%size / 1024 / 1024) <= 1024) { :mb | var %val = $round($calc(%size / 1024 / 1024),2) MB }
else { :gb | var %val = $round($calc(%size / 1024 / 1024 / 1024),2) GB }
return %val
}
else { return error; $iif($1,$qt($1) is not a number,no number was entered) }
}
alias ut.status {
; =================================================================================
; Usage: $ut.status(S)
; Where:
; S = the status number (bit)
; =================================================================================
if ($isbit($1,5)) { return Error }
if ($isbit($1,2)) { return Checking }
if ($isbit($1,1)) {
if ($isbit($1,6)) { return Paused }
else {
if ($isbit($1,7)) {
if ($2 == 1000) { return Seeding }
else { return Downloading }
}
else {
if ($2 == 1000) { return Seeding [F] }
else { return Downloading [F] }
}
}
}
if ($isbit($1,7)) {
if ($2 == 1000) { return Seeding }
else { return Queued }
}
if ($2 == 1000) { return Complete }
else { return Stopped }
}
alias ut.getinfo {
ut.ref
; =================================================================================
; Usage: $ut.getinfo([h],[x],<y>)
; Where the letters respond to:
; h = hash for utorrent file (40 characters)
; x = data type, refering to the line "var %s = .." eg: 1 = STATUS, 2 = NAME etc..
; y = if you would like the alias to return the name of the data type, enter any value here (Not mandatory) eg: STATUS: xx
; Note, this returns the raw values
; =================================================================================
var %s = STATUS,NAME,SIZE,PERCENT,DOWNLOADED,UPLOADED,RATIO,UPLOAD_SPEED,DOWNLOAD_SPEED,ETA,LABEL,PEERS,PEERS_SWARM,SEEDS,SEEDS_SWARM,AVAILABILITY,QUEUE,REMAINING
if ($len($1) != 40) { return incorrect hash code }
if ($2 isnum 1-18) { var %type = $2 }
if ($findtok(%s,$2,44)) { var %type = $findtok(%s,$2,44) }
else { return $qt($2) is an unknown term to search }
if (!$read(utorrent.temp)) { return the utorrent.temp file was not found, please refresh it [/ut.ref] }
if (!$read(utorrent.temp,s,$1)) { return the hashcode $qt($1) was not found in the utorrent directory }
else {
var %x = $read(utorrent.temp,s,$1)
return $iif($3,$gettok(%s,$2,44);,) $gettok(%x,%type,44)
}
}
alias ut.getname {
ut.ref
; =================================================================================
; Usage: $ut.getname([h])
; Where the letters respond to:
; h = the hash of the name given. must be accurate enough to be picked up as the first result
; =================================================================================
if ($read(utorrentnthash.temp,s,$1-)) { return $gettok($read(utorrentnthash.temp,s,$1-),$numtok($read(utorrentnthash.temp,s,$1-),32),32) }
}
alias ut.window {
if (!$1) { echo -a 2* /ut.window: missing paramater, /ut.window <hash> | echo -a 2- }
elseif ($len($1) != 40) { echo -a 2* /ut.window: incorrect paramater, $1 $+([,$iif(- isin $calc(40 - $len($1)),+,-),$remove($calc(40 - $len($1)),-),$chr(32),chars]) is not a correct hash | echo -a 2- }
else {
set %ut.window.string $remove($ut.getinfo(%hash,name),")
set %ut.window.len $ceil($calc($len(%ut.window.string) * 4.6))
set %ut.window.pos 125
set %ut.window.hash $1
if (!$window(@uTorrent)) {
window -pCk0adho +fbn @uTorrent 0 0 256 44
window -pCk0adho +fbn @uTorrent.buf -1 -1 256 44
}
ut.window.update.data
ut.window.update
.timerwindowut 0 0 ut.window.update
.timerwindowut2 0 1 ut.window.update.data
}
}
alias ut.window.off {
window -c @uTorrent
window -c @uTorrent.buf
toolbar -d ut
unset %ut.window.*
.timerwindowut* off
}
alias ut.window.update {
clear @uTorrent.buf
if ($calc(%ut.window.pos) < $calc($+(-,%ut.window.len) - 125)) { set %ut.window.pos 125 }
else { dec %ut.window.pos 0.7 }
drawtext -c @uTorrent.buf 1 Arial 11 %ut.window.pos 2 240 11 %ut.window.string
drawrect -f @uTorrent.buf 0 0 124 0 200 15
drawrect @uTorrent.buf 1 0 134 3 112 4
drawrect -f @uTorrent.buf 9 0 135 4 %ut.window.percent 2
drawtext -c @uTorrent.buf 14 Arial 8 134 6 110 8 D: $+ %ut.window.dls $+ /s U: $+ %ut.window.uls $+ /s
drawtext -c @uTorrent.buf 1 Arial 10 175 14 30 10 %ut.window.percent.a $+ %
drawrect @uTorrent.buf 1 0 0 0 256 32
drawcopy @uTorrent.buf 0 0 256 32 @uTorrent 0 0
if (!$toolbar(ut)) { toolbar -a ut uTorrent @uTorrent /ut.window.off }
toolbar -p ut @uTorrent /ut.window.off
}
alias ut.window.update.data {
ut.ref
var %hash = %ut.window.hash
set %ut.window.string $remove($ut.getinfo(%hash,name),")
set %ut.window.dls $b2m($ut.getinfo(%hash,download_speed))
set %ut.window.uls $b2m($ut.getinfo(%hash,upload_speed))
set %ut.window.percent $round($calc(($ut.getinfo(%hash,downloaded) / $ut.getinfo(%hash,size)) * 110),0)
set %ut.window.percent.a $calc($ut.getinfo(%hash,percent) / 10)
}
Whoa.
I tried it in my bot so that I could see if it was just my particular script preventing the script from playing correctly.
Welp... this is the result I got on my bot, which is a vanilla mIRC install.
XDID Unknown command
XDID Unknown command
XDID Unknown command
XDID Unknown command
XDID Unknown command
XDID Unknown command
XDID Unknown command
XDID Unknown command
Closing Link: Kaiya[adsl-XX-XXX-XXX-XX.dsl.XXXXXX.sbcglobal.net] (Excess Flood)
Any ideas?
Edit: The WebUI addon is working correctly in uTorrent, but that's about it. :/
OMG, this is like the best script here on Hawkee, and all its got is a lousy a$s 7.... seriously people what the hell is wrong with you... there are crappy scripts that are getting 8's and 9's and this awesome script is getting a 7.....
this is just an all time low for Hawkee.com
I give it a 10 because a 7 is too low for something like this, and a like.
I'm not saying it deserves a 10, it deserves a 9.5 but a 7 is just too damn low for something this good.
and no i'm not saying this because Jonesy is my friend, i'm saying this because i think this script deserves higher then a fricken 7..... no offence to mountain dew, but he did a youtube script, and thats getting what, 9.5 and that returns fricken TEXT.... in my opinion this is way better AND TIS GETTING A FUCKING 7... nothing is wrong with MD's its just this is alot Better, Neater...
so all the lazy slobs out there that use this, think this is really good, BUT GIVE IT A FRICKEN GOOD RATING.......
And yes i like this script.
Well, I went ahead and took a look myself, and I seemed to have fixed the majority of the problems. Only thing I couldnt figure out was how to set the position of the progress bar :/
Heres my modifications:
on *:SOCKREAD:ut: {
var %x
sockread %x
;write utordebug.txt %x
if (*torrentc*:* iswm %x) {
unset %ut.n
set %at 1
sockclose $sockname
}
if (%ut.n && %x) {
write utorrent.temp $remove($gettok(%x,1,44),[,],") $gettok(%x,2 - $calc($numtok(%x,44) - 1),44) $+ , $+ $remove($gettok(%x,$numtok(%x,44),44),[,],")
write utorrentnthash.temp $remove($gettok(%x,3,44),") $remove($gettok(%x,1,44),[,],")
if ($dialog(ut)) {
if (!%at) {
xdid -a ut 1 0 0 + 0 0 0 0 0 0 $remove($gettok(%x,3,44),") $chr(9) + 0 0 0 0 $iif($gettok(%x,18,44) >= 1,$gettok(%x,18,44),*) $chr(9) + 0 0 0 0 $bytes($gettok(%x,4,44)).suf $chr(9) + 0 0 0 0 $ut.status($gettok(%x,2,44)) $chr(9) +p 0 0 0 0 DONE notheme $chr(9) + 0 0 0 0 $gettok(%x,15,44) ( $+ $gettok(%x,16,44) $+ ) $chr(9) + 0 0 0 0 $gettok(%x,13,44) ( $+ $gettok(%x,14,44) $+ ) $chr(9) + 0 0 0 0 $bytes($gettok(%x,10,44)).suf $+ /s $chr(9) + 0 0 0 0 $bytes($gettok(%x,9,44)).suf $+ /s $chr(9) + 0 0 0 0 $replace($duration($gettok(%x,11,44)),years,y,months,m,day,d,days,d,hrs,h,mins,m,secs,s)
}
else {
xdid -v ut 1 %ut.n 1 $iif($gettok(%x,18,44) >= 1,$v1)
xdid -v ut 1 %ut.n 2 $bytes($gettok(%x,4,44)).suf
xdid -v ut 1 %ut.n 3 $ut.status($gettok(%x,2,44))
;xdid -v ut 4 $round($calc($gettok(%x,5,44) / 10),2)
;xdid -j ut 1 1 4 p
;xdid -i ut 1 4 % $+ d % $+ %
xdid -v ut 1 %ut.n 6 $gettok(%x,13,44) ( $+ $gettok(%x,16,44) $+ )
xdid -v ut 1 %ut.n 7 $bytes($gettok(%x,10,44)).suf $+ /s
xdid -v ut 1 %ut.n 8 $bytes($gettok(%x,9,44)).suf $+ /s
xdid -v ut 1 %ut.n 9 $replace($duration($gettok(%x,11,44)),years,y,months,m,day,d,days,d,hrs,h,mins,m,secs,s)
;xdid -v ut 1 10 $round($calc($gettok(%x,5,44) / 10),2)
}
xdid -v ut 1 %ut.n 5 $gettok(%x,15,44) ( $+ $gettok(%x,14,44) $+ )
inc %ut.n
}
}
if (*"torrents": [* iswm %x) {
set %ut.n 1
}
}
It also uses $bytes with the .suf $prop so it will convert the bytes into their proper formatting. This removes the need for the $b2m identifier.
As you can see, I tried to figure out the progress bar, but just couldnt get it to work, so its all commented out. I also couldnt figure out what you were using the 10th thing for? Nothing seemed to change when I edited it.
Heres a screen of my modifications: http://i131.photobucket.com/albums/p299/NIGathan/utorrentmircaddon.png
It would be nice if you could add the ratio to it. To get that info merely: $round($calc($gettok(%input,7,44) / $gettok(%input,6,44)),3)
In this case %input would be %x
jonesy: Alright the page loads now, I enter my user/pass and I see this info:
{"build":12639,"label": [
]
,"torrents": [
["0127EA0CA115E57B3633B281C807E549147DBFDE",136,"3rd Rock from the Sun",26230617764,1000,21984966308,11111612416,505,0,0,0,"",0,0,0,0,65536,-1,0],
["AE63A2DD8AD660BCF94E05762F8A041D27815036",136,"Alice Cooper - 37 Album",2805652711,1000,2935659751,2897072905,986,0,0,0,"",0,87,0,39,65536,-1,0],
["465BEAB7E3738FE0233BD75AD2553F837C7DAA10",136,"Call Of Duty World At War-RELOADED (Kingdom-Release)",7473134325,1000,7477082869,2003795968,267,0,0,0,"",0,238,0,276,65536,-1,0]]
,"torrentc": "332107537"}
But in the dialog window, for a split second right when it opens, I think its all correct, or at least more correct, but then the info is misplaced again.