recordings = Recordings(connection)

# Select the demo city of Rotterdam
recording = next(Recording.query(
    recordings, directory_like="Rotterdam360\\\\Ladybug5plus"))
recordings.get_setup(recording)
print(recording, " -> ", recording.directory)
print(recording.setup)

# Step 1. create and configure spherical camera
sp_camera = SphericalCamera()
sp_camera.set_network_client(client)

# Step 2. Get a recorded frame and place the camera onto that 'frame'
frames = Frames(connection)
results = Frame.query(frames, recordingid=recording.id,
                      index=210, order_by="index",)

# step 3. do some sight seeing..
# This sections hardcodes looking at points of interest, which
# normally would come from image processing or AI tooling.


class Poi():
    """Describes and labels a point of interest within the image """
    pixel: Pixel
    name: str
    yaw: float
    pitch: float

    def __init__(self, pixel, name, yaw, pitch) -> None:
        self.name = name
    "Azimuth",
    "Latitude",
    "Longitude",
    "Pitch",
    "Roll",
    "Stamp"
]


# Open output csv file
with open(os.path.join(output_path, 'output.csv'), 'w', newline='') as csvfile:
    writer = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL)
    writer.writerow(csv_header)

    # Get frames
    results = Frame.query(frames, recordingid=recording_id, order_by="index",)
    if args.limit:
        results = itertools.islice(results, args.limit)
    for frame in results:
        if frame is None:
            print("No frames!")
            exit()

        print(frame)

        # Get the image
        # Set parameters
        request_builder = ImageRequestBuilder(frame.recordingid, frame.uuid)
        for direction_id, direction in directions.items():
            request = client.fetch(request_builder.build_spherical(
                size, direction, horizontal_fov))