egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File transfer speed calculator

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
andrii
Voice


Joined: 08 Dec 2008
Posts: 3

PostPosted: Mon Dec 08, 2008 8:12 am    Post subject: File transfer speed calculator Reply with quote

Hello guys.

I'm wondering that does there already exist, or can any of you tell me how to create a script that calculates data transfer speed and estimated time?

Lets say: I need to download a 100mb file, and i can dl it like 20kb/s.

The script should calculate the time for 100megs if the average dl speed is 20kilobytes/sec. And It should also work another way around. We want to know how much data we can move in 1 hours, if the transferring speed is 20kb/s.

I don't have that strong programming skills that I could create something like this on my own. However, If i can get access to some sort of source, I may be able to finish it myself.



Humbly,

Andrii
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Mon Dec 08, 2008 10:01 am    Post subject: Reply with quote

100 / 0.02 = ~5000 seconds

1 hour = 3600 sec
3600 * 0.02 = ~72MB

but this depeds from many other things, this is just simple calculating, its hard to get real speed Smile

u can always calculate like 1MB = 1024 KB, not 1000

but this still will be only theoretical
Back to top
View user's profile Send private message Visit poster's website
andrii
Voice


Joined: 08 Dec 2008
Posts: 3

PostPosted: Thu Dec 11, 2008 12:04 pm    Post subject: Reply with quote

tomekk wrote:
100 / 0.02 = ~5000 seconds

1 hour = 3600 sec
3600 * 0.02 = ~72MB

but this depeds from many other things, this is just simple calculating, its hard to get real speed Smile

u can always calculate like 1MB = 1024 KB, not 1000

but this still will be only theoretical


Thank you tomekk for doing the math for me Very Happy

And yes, the script should provide a theoretical indication, not precise one.
However, this is not the thing I was looking for.

I believe(and I hope) that I'll manage the mathematics part on my own.
What I was hoping is that someone could offer or help me to create the script(and by script, i mean the code part).
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Thu Dec 11, 2008 4:47 pm    Post subject: Reply with quote

Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

bind pub - !m2t megs_to_time_proc
bind pub - !t2m time_to_kbs_proc

proc megs_to_time_proc { nick uhost hand chan arg } {
   set our_args [split $arg]
   set megs [lindex $our_args 0]
   set kilobytes_speed [lindex $our_args 1]

   if {([regexp {^([0-9]+)$} $megs]) && ([regexp {^([0-9]+)$} $kilobytes_speed])} {
      set megs_to_kilobytes [expr $megs * 1024]
      set need_time [expr $megs_to_kilobytes / $kilobytes_speed]

      set the_time [expr {round($need_time) / 60}]

      set r_hours [expr $the_time / 60]
      set r_minutes [expr $the_time - ($r_hours * 60)]

      if {(($r_hours >= 0) && ($r_minutes > 0)) || (($r_hours > 0) && ($r_minutes == 0))} {
         putquick "PRIVMSG $chan :time ~~ $r_hours hour/s, $r_minutes minute/s"
      } else {
         putquick "PRIVMSG $chan :time ~~ less than one minute"
      }
   }
}

proc time_to_kbs_proc { nick uhost hand chan arg } {
   set our_args [split $arg]
   set minutes [lindex $our_args 0]
   set kilobytes_speed [lindex $our_args 1]

   if {([regexp {^([0-9]+)$} $minutes]) && ([regexp {^([0-9]+)$} $kilobytes_speed])} {
      set minutes_to_secs [expr $minutes * 60]
      set need_kilobytes [expr {double($minutes_to_secs * $kilobytes_speed)}]

      set the_megs [expr {double($need_kilobytes / 1000)}]

      putquick "PRIVMSG $chan :u can transfer ~~ $the_megs MB"
   }
}

putlog "transfers.tcl ver 0.1 by tomekk loaded"


manual:
!m2t <megs> <kilobytes>, !m2t 100 20 = ~ 1 hour, 25 minutes
!t2m <minutes> <kilobytes>, !t2m 100 20 = ~120.0 MB

try :>
Back to top
View user's profile Send private message Visit poster's website
andrii
Voice


Joined: 08 Dec 2008
Posts: 3

PostPosted: Mon Dec 15, 2008 5:58 pm    Post subject: File transfer speed calculator Reply with quote

Thank you tomekk!

This is perfect!

//A
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber