def execute(self, context): hook = CloudVideoIntelligenceHook(gcp_conn_id=self.gcp_conn_id) operation = hook.annotate_video( input_uri=self.input_uri, input_content=self.input_content, video_context=self.video_context, location=self.location, retry=self.retry, features=[enums.Feature.LABEL_DETECTION], timeout=self.timeout) self.log.info("Processing video for label annotations") result = MessageToDict(operation.result()) self.log.info("Finished processing.") return result
def execute(self, context): hook = CloudVideoIntelligenceHook( gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain, ) operation = hook.annotate_video( input_uri=self.input_uri, input_content=self.input_content, video_context=self.video_context, location=self.location, retry=self.retry, features=[enums.Feature.EXPLICIT_CONTENT_DETECTION], timeout=self.timeout) self.log.info("Processing video for explicit content annotations") result = MessageToDict(operation.result()) self.log.info("Finished processing.") return result
def setUp(self): with mock.patch( "airflow.providers.google.cloud.hooks.video_intelligence.CloudVideoIntelligenceHook.__init__", new=mock_base_gcp_hook_default_project_id, ): self.hook = CloudVideoIntelligenceHook(gcp_conn_id="test")