Jump to content

tanzpartner

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by tanzpartner

  1. Sorry. Forum dynamic got the better of me.
  2. Thanks! But that kind of defeats the green aspect of calculating locally without creating network traffic resulting in energy use. I know it's a small contribution, but I want to do more of these little tasks locally without network use. YMMV of course.
  3. Hi there, my green conscience was getting seriously hurt every time I used a website to calculate how long an upload would take. So I took the time and wrote a little Python script that I'm running from an Alfred workflow. My keyword trigger is "ct" followed by a number that represents the amount of data in gigabytes. I use round numbers because I only care about roughly knowing how long it takes. Not a precise time, which isn't even possible because transmission speed can vary. If anyone is interested, here is the python code, you can paste it into the "Run script" block in the workflow editor. Adjust the "Transfer_Speed" to whatever your upload speed is in KBbs, mine is roughly 4500 KBps (my ISP claims it's 5000, but you know what that means...). I would call the Alfred Input Window and type ct 10 and hit enter, then I will see the result in large type. #!/usr/bin/python import sys import math # This script calculates upload time # # Upload speed is 4500 KB / sec Transfer_Speed = 4500 # This is the input argument from Alfred Workflow Data_Amount = float(int(sys.argv[1])) # Calculate the time Transfer_Time = round((((Data_Amount * 1000000) / Transfer_Speed) / 60), 2) Transfer_Hours = math.trunc(Transfer_Time / 60) Transfer_Minutes = round((Transfer_Time - (Transfer_Hours * 60)), 2) # Create the output query = str(Transfer_Hours) + " Hours and " + str(Transfer_Minutes) + " Minutes" sys.stdout.write(query) Enjoy and have a good Sunday. Hans
×
×
  • Create New...