Download/Transfer ETA

By Jonesy44 on May 27, 2009

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]

  • Average speed: average speed of your download/transfer currently, or estimated
  • Downloaded data: how much of the file you've already downloaded/transfered
  • File size: The size of the file transfering/downloading

if no suffix is added, the number is treated as bytes. check examples for more information.

  • 1/3 prop: 1 denotes days/hours/minutes/seconds etc | 3 denotes HH:NN:SS

Example
//echo -a $eta(1mb/s,10gb,100gb).1 return 1day 1hr 36mins
Image

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
  }
}

Comments

Sign in to comment.
Jonesy44   -  Oct 06, 2009

My bad, it's been a while & I've been on VB mostly recently :) thanks Jethro.

 Respond  
Jethro   -  Oct 06, 2009

Jonesy44, you made a tiny mistake in your regex: > on $*:text:/$[!@`]eta/Si:#:msg # $eta($2-) It should either be:

on $*:text:/\A[!@`]eta/Si:#:msg # $eta($2-)

or

on $*:text:/^[!@`]eta/Si:#:msg # $eta($2-)
 Respond  
Jonesy44   -  Oct 06, 2009

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

 Respond  
VinX   -  Oct 05, 2009

hmm , why the Alias version .. i m a noob but i prefer a

!ETA 4 GB 120 kBps

kinda thing

thx anyways :D

 Respond  
Jonesy44   -  Oct 05, 2009

VinX; it's already done.. $eta identifier is made "global" by just adding this script. use;

/msg #channel [BOT} $eta(params)

 Respond  
VinX   -  Oct 05, 2009

hmm , can someone pls mod this for a bot ?

 Respond  
Jonesy44   -  Jun 26, 2009

I heard it was quite good.. thanks for the rating anyways:)

 Respond  
Spanky   -  Jun 25, 2009

eh PATX so do i but i had to download it the "hype" brought me in the film sucked bawls, OLD STAR TREK FTW tho.

 Respond  
PATX   -  Jun 25, 2009

PATX hates Star Trek :/ Spanky but yes good script. 8/10

 Respond  
Jonesy44   -  May 29, 2009

There we go en! ;) haha :P thanks x

 Respond  
Spanky   -  May 29, 2009

heh i forgot to rate it. 9/10 from me bcuz this told me EXACTLY when my star trek film would download and it was right exactly :O

 Respond  
Jonesy44   -  May 29, 2009

5.0, are yuo kidding me?!

 Respond  
Jonesy44   -  May 28, 2009

lol fair enough! this should be a little more accurate then ;)

 Respond  
Spanky   -  May 28, 2009

yea thats why. and btw, i like this thought i should talk about this script :D

cus im a freak i used this to get a rough idea of when my downloads will be done and wrote it on my pda, and put a timer on it. to tell me when it should be done. by the estimate.

 Respond  
Jonesy44   -  May 28, 2009

Oh, is that why DCC never works? the idea is good init? i mean, it's reallllyy slow but could be quite cool for transfering small amnts of data :D

 Respond  
Spanky   -  May 28, 2009

ok well i was thinking of like. little rewrite. im making a script for my server right, and its gonna have its own dedicated place and like, im can't remember if it was dcc or not if it is dcc it wont work cus i cant dcc i never lower my firewall or allow the ports for it v.v

 Respond  
Jonesy44   -  May 27, 2009

Yeah, i suppose so, this is mainly used for script functions. i like to do background-coding :)

 Respond  
Aucun50   -  May 27, 2009

That's neat, maybe you could add a channel !eta option for others to use it as well.

 Respond  
Jonesy44   -  May 27, 2009

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?

 Respond  
Spanky   -  May 27, 2009

aww man. if you only got that working that would have been epicness slow but epic.

also do u still have the script cus i got an idea..

 Respond  
Jonesy44   -  May 27, 2009

Nah, lol. Just an alias :)

 Respond  
Spanky   -  May 27, 2009

dude are you still thinking about you're transfer script? or what ever it was >.>

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.