From af40658e88e6aa40adecee831cd0907a3ace0de6 Mon Sep 17 00:00:00 2001 From: Brian Watt Date: Thu, 20 Dec 2018 18:55:00 -0600 Subject: [PATCH 1/3] 14 Show Animated GIF and Video MP4 commands to aid debugging --- timelapse.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/timelapse.py b/timelapse.py index 0b4fe3b..8158e15 100755 --- a/timelapse.py +++ b/timelapse.py @@ -67,6 +67,7 @@ def capture_image(): set_camera_options(camera) # Capture a picture. + print '\nCapture picture: ' + str(image_number) + '\n' camera.capture(dir + '/image{0:05d}.jpg'.format(image_number)) camera.close() @@ -93,10 +94,12 @@ def capture_image(): # TODO: These may not get called after the end of the threading process... # Create an animated gif (Requires ImageMagick). if config['create_gif']: - print '\nCreating animated gif.\n' - os.system('convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif') # noqa + command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' + print '\nCreating animated gif: ' + command + '\n' + os.system(command) # noqa # Create a video (Requires avconv - which is basically ffmpeg). if config['create_video']: - print '\nCreating video.\n' - os.system('avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4') # noqa + command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' + print '\nCreating video: ' + command + '\n' + os.system(command) # noqa From fc7f3584c11bbaa6c08d16c33700e5b73f3868ed Mon Sep 17 00:00:00 2001 From: Brian Watt Date: Thu, 20 Dec 2018 19:19:47 -0600 Subject: [PATCH 2/3] Added noqa to long command lines --- timelapse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/timelapse.py b/timelapse.py index 8158e15..9db07c3 100755 --- a/timelapse.py +++ b/timelapse.py @@ -94,12 +94,12 @@ def capture_image(): # TODO: These may not get called after the end of the threading process... # Create an animated gif (Requires ImageMagick). if config['create_gif']: - command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' + command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' # noqa print '\nCreating animated gif: ' + command + '\n' - os.system(command) # noqa + os.system(command) # Create a video (Requires avconv - which is basically ffmpeg). if config['create_video']: - command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' + command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' # noqa print '\nCreating video: ' + command + '\n' - os.system(command) # noqa + os.system(command) From 3330a02ba59b003ac8e22023c933aa21c1f4fa14 Mon Sep 17 00:00:00 2001 From: Brian Watt Date: Thu, 20 Dec 2018 19:23:23 -0600 Subject: [PATCH 3/3] Fix E261 at least two spaces before inline comment --- timelapse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/timelapse.py b/timelapse.py index 9db07c3..9dbb7b7 100755 --- a/timelapse.py +++ b/timelapse.py @@ -94,12 +94,12 @@ def capture_image(): # TODO: These may not get called after the end of the threading process... # Create an animated gif (Requires ImageMagick). if config['create_gif']: - command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' # noqa + command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' # noqa print '\nCreating animated gif: ' + command + '\n' os.system(command) # Create a video (Requires avconv - which is basically ffmpeg). if config['create_video']: - command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' # noqa + command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' # noqa print '\nCreating video: ' + command + '\n' os.system(command)