gmyth-stream/server/0.2/lib/utils.py
branchtrunk
changeset 651 76a3f315ef42
parent 585 a1783dab9ba6
child 653 3433df0d6ae3
     1.1 --- a/gmyth-stream/server/0.2/lib/utils.py	Mon Apr 23 16:06:54 2007 +0100
     1.2 +++ b/gmyth-stream/server/0.2/lib/utils.py	Tue May 15 14:41:04 2007 +0100
     1.3 @@ -159,3 +159,16 @@
     1.4          return "HTML format error. Wrong keys: %s" % e
     1.5  
     1.6  # getHTML
     1.7 +
     1.8 +def progress_bar(log, value, max, barsize):
     1.9 +   chars = int(value * barsize / float(max))
    1.10 +   percent = int((value / float(max)) * 100)
    1.11 +   sys.stdout.write("#" * chars)
    1.12 +   sys.stdout.write(" " * (barsize - chars + 2))
    1.13 +   if value >= max:
    1.14 +      sys.stdout.write("done. \n\n")
    1.15 +   else:
    1.16 +      sys.stdout.write("[%3i%%]\r" % (percent))
    1.17 +      sys.stdout.flush()
    1.18 +
    1.19 +# progress_bar by osantana