예제 #1
0
def main():
    print(banner)
    try:
        camera = PiCamera()
    except:
        print(
            "Error : Camera is not detected. Please check carefully the camera module is \
        installed correctly! Try running 'sudo raspi-config' and ensure that the camera has been enabled."
        )

    while True:
        try:
            param = input("<SCRIBE> ").lower().split()
            while len(param) < 3:
                param.append('')
            command = param[0]
            param1 = param[1]
            param2 = param[2]
            if command == "help":
                print(help_text)

            elif command == "record":
                pass

            elif command == "quit":
                print("Goodbye!")
                try:
                    camera._check_recording_stopped()
                except:
                    while True:
                        temp_input = input(
                            "You're still recording! Are you sure you want to quit? (y/N) "
                        ).lower()
                        if temp_input not in ['y', 'n']:
                            pass
                        elif temp_input == "":
                            break
                        elif temp_input == "y":
                            camera.stop_recording()
                            camera.close()
                            sys.exit()
                        else:
                            break
                        break
                finally:
                    sys.exit()
            else:
                print("Wrong command! Use 'help' to print help.")

        except KeyboardInterrupt:
            print("\nUser interrupted the process!")
            sys.exit()
예제 #2
0
        print('image_effect_params {0}'.format(camera.image_effect_params))
        continue

    # only numbers from here
    pattern = re.compile("[0-9]")
    if not pattern.match(str(stroke)) and stroke != 'n':
        print("not a number")
        continue
    # image effects
    if stroke != 'n' and int(stroke) < len(IMAGE_EFFECTS):
        changeEffect(camera, IMAGE_EFFECTS[int(stroke)])
        # camera.image_effect = IMAGE_EFFECTS[int(stroke)]
        # print( IMAGE_EFFECTS[int(stroke)] )

print("closing")
if camera._check_recording_stopped():
    sleep(1)
    camera.stop_recording()
    print('stopping any recordings')
sleep(1)
# for x in range(0, len(IMAGE_EFFECTS)):
# #   # camera.framerate_delta = camera.framerate + x * 10
# #   # print(camera.framerate + camera.framerate_delta)
# #   camera.image_effect = IMAGE_EFFECTS[x]
# #   print(IMAGE_EFFECTS[x])
# #   print( camera.image_effect_params )
# #   camera.led = not camera.led
#   sleep(6)

camera.stop_preview()