commit 6440d6bde167e117e3408a039d1f5686f7231978
parent a725dce83f710c1ec343c576dab97d4c0491364d
Author: hamdyaea <hamdy.aea@protonmail.com>
Date: Tue, 7 Jan 2020 23:07:22 +0100
Add progressbard correct Already Downloaded
Diffstat:
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/moonphase.py b/moonphase.py
@@ -62,18 +62,28 @@ def main(startNumber=1, thinning=1, ffmpeg=False):
if not os.path.exists(directory):
os.makedirs(directory)
- for imageNumber in range(startNumber, 8761, thinning):
+ for imageNumber in range(startNumber, 8761, thinning):
+ imagePercent = imageNumber
imageNumber = addZeros(imageNumber)
# Skip if already downloaded
if os.path.exists(directory + imageNumber + ".jpg"):
- print("Already downloadad " + imageNumber)
+ print("Already downloaded " + imageNumber)
continue
while True:
try:
getImage(imageNumber, directory)
- print("Done " + imageNumber)
+ percent = imagePercent / 87.61
+ percent=round(percent,2)
+ barre = (
+ "["
+ + "#" * int((50 / 100) * percent)
+ + "-" * int((50 / 100) * (100 - percent))
+ + "]"
+ )
+ print('\033c')
+ print(str(percent)+str("% ")+barre)
except Exception as e:
print(e)
continue