Example #1
0
    def Run(self, args):
        """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Raises:
      googlecloudsdk.api_lib.util.exceptions.HttpException, if there is an
          error returned by the API.

    Returns:
      videointelligence_v1beta1_messages.GoogleLongRunningOperation: the
        operation message.
    """
        operation_ref = resources.REGISTRY.Parse(
            args.id, collection='videointelligence.operations')
        client = video_client.VideoClient()
        return client.GetOperation(operation_ref)
Example #2
0
    output_uri: str, the URI for the results to be stored. Must be a Google
      Cloud Storage URI.
    segments: str | None, the segments of video to be analyzed in the form
      'start1:end1,start2:end2,...', if any.
    region: str | None, the Cloud Region to do analysis in, if any.
    async: bool, whether to return the operation right away (async) or wait for
      it to complete.
    detection_mode: str, the detection mode if the LABEL_DETECTION feature
      is being requested.

  Raises:
    SegmentError, if given segments aren't properly formatted.
    content_source.UnrecognizedContentError: if the input URI is incorrectly
      formatted.

  Returns:
    google.longrunning.Operation: the result of the video analysis
  """
    client = video_client.VideoClient()
    operation = client.RequestAnnotation(feature,
                                         input_uri,
                                         output_uri=output_uri,
                                         region=region,
                                         segments=segments,
                                         detection_mode=detection_mode)
    if async:
        return operation
    operation_ref = resources.REGISTRY.Parse(
        operation.name, collection='videointelligence.operations')
    return client.WaitOperation(operation_ref)