Usage
$eta(avg_speed[b/s kb/s mb/s gb/s],downloaded_data[b kb mb gb],file_size[b kb mb gb]).[1/3]
if no suffix is added, the number is treated as bytes. check examples for more information.
Example
//echo -a $eta(1mb/s,10gb,100gb).1 return 1day 1hr 36mins
alias eta {
; Usage: $eta(avg_speed[b/s kb/s mb/s gb/s],downloaded_data[b kb mb gb],file_size[b kb mb gb]).[1/3]
if ($remove($etarm($1-),$chr(32)) isnum && $3) {
var %x = 1
while %x <= 3 { var %eta [ $+ [ %x ] ] $etab2m($etarm($gettok($1-,%x,32)),$iif($regex($remove($gettok($1-,%x,32),/s),/(k|kb|mb|gb)$/),$regml(1))).b | inc %x }
return $duration($calc((%eta3 - %eta2) / %eta1),$iif($regex($prop,/^(1|3)$/),$regml(1),1))
}
else return 2* $!eta(): Error
}
alias -l etarm return $remove($1-,kb,mb,gb,b,/s)
alias -l etab2m {
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) }
elseif ($calc(%size / 1024) <= 1024) { :kb | var %val = $round($calc(%size / 1024),2) }
elseif ($calc(%size / 1024 / 1024) <= 1024) { :mb | var %val = $round($calc(%size / 1024 / 1024),2) }
else { :gb | var %val = $round($calc(%size / 1024 / 1024 / 1024),2) }
return %val
}
}
Because, with an alias it is more versatile, if you wanted to use is in a bot or as another script function you can. not all scripts are meant to be bot scripts. some are client side, which this one is..
If you want to use this with a bot just use something like..
on $*:text:/$[!@`]eta/Si:#:msg # $eta($2-)
syntax: [!@`]eta 1mb/s,10gb,100gb
Ooooh that transfer script! i thought you meant the uTorrent one. and no i don't have it anymore. But i soon realise all the transfers have to be done using binary rather than plain text for files with extra characters.
I could easily re-write it though, if you wanna tell me your idea. or we can discuss it or something?