commit 5a10d25803be3e960a309861ea67d2e7c9903e7f
parent a87b5b34d4ec586fec909089c43d8ecdb7233bf9
Author: Nicholas Farrow <nicholas.w.farrow@gmail.com>
Date: Thu, 21 Feb 2019 19:35:55 +1100
Fixed directories and video creation.
Diffstat:
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/moonphase.py b/moonphase.py
@@ -15,21 +15,23 @@ def getImage(imageNumber, directory):
req.urlretrieve(URL, imageName)
return
-def makeVideo()
- files = [image for image in os.listdir() if ".jpg" in image]
+def makeVideo(directory):
+ files = [image for image in os.listdir(directory) if ".jpg" in image]
images = []
for frameFile in files:
- images.append(imageio.imread(frameFile))
- imageio.mimsave('C:/MOONPHASE/movie.gif', images)
+ images.append(imageio.imread(directory + frameFile))
+ imageio.mimsave(directory + 'movie.gif', images)
return
-def main(startNumber=1, directory="C:/MOONPHASE/"):
+def main(startNumber=1, thinning=1):
+ directory = 'images/'
+
if not os.path.exists(directory):
os.makedirs(directory)
- for imageNumber in range(startNumber, 8761):
+ for imageNumber in range(startNumber, 8761, thinning):
while True:
try:
imageNumber = addZeros(imageNumber)
@@ -39,8 +41,10 @@ def main(startNumber=1, directory="C:/MOONPHASE/"):
print(e)
continue
break
- print("DOne")
+
+ print("Making video...")
+ makeVideo(directory)
return
-main(1)
+main(1, 20)