## Download rate calculator when file size and times are
## known, calculating an average (because the rates vary with time).

## the file_size line is in Megabytes (MB). To input a file size in
## Kilobytes (KB), append a "/ 1024" line. This program assumes a
## 1024 * 1024 model of MB, not 1000 * 1000. -Mk.558


time_sec = 0
time_min = 0
time_hrs = 0
file_size = 0

def calculate_KBsec():
    if (time_sec == 0) and (time_min == 0) and (time_hrs == 0):
            print "Error: Time figures not defined!"
            return 0
    elif (file_size == 0):
            print "Error: variable 'file_size' cannot be zero"
            return 0
    else:
        total_time = (time_sec + (time_min * 60) + (time_hrs * 3600))
        kbsec =  (file_size / total_time)  * 1024
        return kbsec

def calculate_Mbps():
    mbps = calculate_KBsec()
    mbps /= 125
    return mbps

print "Total Seconds:", (time_sec + (time_min * 60) + (time_hrs * 3600))
print "File Size:", str(file_size) + "MB"
print ""

p1 = calculate_KBsec()
print "KB/sec =", p1

print ""

p2 = calculate_Mbps()
print "Mbps =", p2

print ""

p3 = calculate_KBsec() / 1024
print "MB/sec =", p3

print ""

p4 = calculate_Mbps() * 1000
print "Kbps =", p4