Beispiel #1
0
def run():

    print("Super awesome interactive session!")

    devices = chdk.get_devices()

    print("%d devices found." % len(devices))

    if len(devices) < 1:
        print("No devices found.  Ctrl-C to exit ...")
        raw = raw_input()
        # model()
        sys.exit(1)

    # One-time camera-config
    configured = False
    while not configured:
        print(
            "Let's set your camera rotation. \n Are the cameras mounted horiziontally, or vertically? \n"
            "Press h for horiziontally and v for vertically"
        )
        raw = raw_input()
        if raw == "h":
            rotation = "horizontal"
            configured = True
        elif raw == "v":
            print("Do the tripod mounts face to the left, or the right? \n Press l for left and r for right.")
            raw = raw_input()
            if raw == "l":
                rotation = "clockwise"
                configured = True
            elif raw == "r":
                rotation = "counter-clockwise"
                configured = True
            else:
                print("Hmm, that doesn't seem to be one of the options")
        else:
            print("Hmm, that doesn't seem to be one of the options")

    print("Initializing ...")
    chdk.chdk(devices, "luar set_record(true)")
    # Wait for the lenses to extend
    time.sleep(3.0)

    set_id = 173
    while True:
        # print("Press <enter> to capture more images, type m<enter> to model.")
        print("Press enter to make a gif")
        raw = raw_input()
        if raw == "":
            print("Delaying ...")
            time.sleep(10.0)
            one_shot(devices, set_id)
            gifmaker.make_gifs(devices, rotation, set_id)
            uploads.upload_file(devices, set_id)
        else:
            print("That won't work")
        set_id = set_id + 1
def service_menu(service):
    logger = logging.getLogger("runtime_log")
    logger.debug("service")
    
    current_dir = "root"
    try:
        while True:
            command = raw_input('>> ')
            command = command.split()
            
            # List current directory contents
            if(command[0] == "ls"):
                show_directory_contents(current_dir)
    
            # List available commands
            elif(command[0] == "help"):
                print "help"
            
            # Build directory structure
            elif(command[0] == "build"):
                build_directory_tree(service)
            
            # Download file from drive
            elif(command[0] == "download"):
                print "download"
                
            # Upload file to drive
            elif(command[0] == "upload"):
                upload_file(service, command, current_dir)
                
            # Quit application
            elif(command[0] == "quit"):
                break;
            
            else:
                # Invalid command
                print "'%s' is not a valid command. For a list of commands, type 'help'" % command[0]
                
    except KeyboardInterrupt:
        print "quit"