コード例 #1
0
def CleanUp():
    x, y = helper.LocateImage("./common/tempPlacesNotSelected.png")
    if x != None and y != None:
        helper.ClickAndWait(x, y, helper.SMALL_PAUSE)
        pyautogui.click(button='right')
        pyautogui.press(["down", "down", "down"])
        pyautogui.press(["enter"])
        helper.PauseForEffect(helper.SMALL_PAUSE)
        pyautogui.press(["enter"])
コード例 #2
0
def GoToStartPoint(startVal, endVal, x, y):
    count = 0
    # Need Extra as we are taking a snapshot after click
    # For FORWARD we should move 1 step ahead, hence range increases by 2
    # For BACKWARD we should  go 1 step behind, hence rnage should not increase
    for i in range(1, startVal + (1 + GetMode(startVal, endVal))):
        helper.ClickAndWait(x + backwardDelta[0], y + backwardDelta[1])
        count += 1
    print("Total Clicks : {}".format(str(count)))

    helper.PauseForEffect(helper.MEDIUM_PAUSE)
    print("Current Mode is {}".format(str(GetMode(startVal, endVal))))
コード例 #3
0
def CreateTour(inputFileName, totalTime):
    # Video Details
    pathVal, fileName = os.path.split(inputFileName)
    fileName, extension = os.path.splitext(fileName)
    videoName = os.path.join(
        pathVal, fileName +
        helper.videoExtensionMap[helper.VideoCodec[DEFAULT_VIDEO_CODEC]])

    # Complete Recording
    x, y = helper.LocateImage("./common/saveTour.png")
    if x != None and y != None:
        helper.ClickAndWait(x, y, helper.SMALL_PAUSE)
        pyautogui.write("Tour")
        helper.PauseForEffect(helper.SMALL_PAUSE)
        pyautogui.press(["enter"])
        helper.PauseForEffect(helper.SMALL_PAUSE)
        helper.ClickAndWait(x + closeX, y + closeY, helper.SMALL_PAUSE)
        pyautogui.hotkey("alt", "t")
        pyautogui.press(["down", "down", "down"])
        pyautogui.press(["enter"])
        helper.PauseForEffect(helper.SMALL_PAUSE)
        pyautogui.press(["tab", "tab"])
        pyautogui.write(videoName)
        helper.LocateAndClick("./common/createMovie.png", helper.SMALL_PAUSE)
コード例 #4
0
def CreateImages(startVal, endVal, stepX, stepY, listToCapture, imageName,
                 imageNamePadding, imageType, imageSnapRegion):
    # Click and Create image
    for i in range(startVal, endVal + (-1) * GetMode(startVal, endVal),
                   (-1) * GetMode(startVal, endVal)):
        helper.ClickAndWait(stepX, stepY, helper.SMALL_PAUSE)
        # Click
        print("Now on Click {}".format(str(i)))
        # Skip the ones that are not necessary
        if i not in listToCapture:
            continue
        if i < 0:
            continue
        print("Snapshot Click is {}".format(str(i)))
        # Create image
        pyautogui.screenshot(imageName + str(i).zfill(imageNamePadding) +
                             imageType,
                             region=imageSnapRegion)
コード例 #5
0
def RecordTour(fileName, totalTime):
    x, y = helper.LocateImage("./common/tempPlacesNotSelected.png")
    if x != None and y != None:
        helper.ClickAndWait(x, y, helper.SMALL_PAUSE)
    helper.LocateAndClick("./common/recordTour.png", helper.SMALL_PAUSE)
    CreateTour(fileName, totalTime)
コード例 #6
0
def record(inputJSON):
    helper.PauseForEffect(helper.SMALL_PAUSE)

    if "place" in inputJSON:
        GoToPlace(inputJSON["place"])
    if "cooridnate" in inputJSON:
        GoToPlace(inputJSON["cooridnate"])
    if "scroll" in inputJSON:
        helper.LocateAndClick('./common/earth.png',
                              helper.MEDIUM_PAUSE,
                              adjY=centerOfPoint)
        for i in range(0, inputJSON["scroll"]):
            pyautogui.scroll(SCROLL_AMOUNT)

    # Locate Time Lapse
    x, y = helper.LocateImage('./common/timelapse.png')
    if x != None and y != None:
        # Start Time Lapse
        helper.ClickAndWait(x, y, helper.SMALL_PAUSE)
        startVal = inputJSON["start_count"]
        endVal = inputJSON["end_count"]
        assert startVal != endVal, "Start and End Cannot be the same"
        # When Imagery starts its on the actual date
        # At the current date there is not image
        # When you click BACK for the first time, it moves to the
        # Latest Available Imagery / Image Ticker 0
        helper.ClickAndWait(x + backwardDelta[0], y + backwardDelta[1])
        GoToStartPoint(startVal, endVal, x, y)

        # Preprocessing before taking snapshot
        stepX = x
        stepY = y
        if GetMode(startVal, endVal) == -1:
            stepX = x + backwardDelta[0]
            stepY = y + backwardDelta[1]
        if GetMode(startVal, endVal) == 1:
            stepX = x + forwardDelta[0]
            stepY = y + forwardDelta[1]
        listToCapture = GetListToCapture(inputJSON, startVal, endVal)
        print(listToCapture)
        totalPad = int(math.ceil(math.log10(max(startVal, endVal))))
        imageName, imageType = GetImageNameAndType(inputJSON["image"])

        CreateImages(startVal, endVal, stepX, stepY, listToCapture, imageName,
                     totalPad, imageType, imageRegion)

        # Make the video if needed
        if "video" in inputJSON:
            videoJSON = inputJSON["video"]
            CreateVideoFromJSON(videoJSON, imageType)

        # Delete the images
        if "delete" in inputJSON["image"] and inputJSON["image"][
                "delete"] == "Yes":
            if inputJSON["type"] == "TIMELAPSE" and "video" in inputJSON:
                for fileName in os.listdir('./'):
                    if fileName.endswith(imageType):
                        os.remove(fileName)

        # Close Time Lapse
        helper.ClickAndWait(x, y)