private async Task WriteValuesToDocumentObject(IndexJob indexJob, VideoIndexResult videoIndexResult) { try { using (IObjectManager manager = this.Helper.GetServicesManager().CreateProxy <IObjectManager>(Relativity.API.ExecutionIdentity.System)) { var toUpdate = new RelativityObjectRef { ArtifactID = indexJob.DocumentArtifactID }; var fieldValuePair = new FieldValue("Kramerica Video Transcript", videoIndexResult.Transcript); var updateRequest = new UpdateRequest { Object = toUpdate, FieldValues = new List <FieldRefValuePair> { fieldValuePair } }; await manager.UpdateAsync(indexJob.WorkspaceArtifactID, updateRequest); } } catch (Exception ex) { LogError(ex); } }
private async Task WriteValuesToIndexJob(IndexJob indexJob, VideoIndexResult videoIndexResult) { try { using (IObjectManager manager = this.Helper.GetServicesManager().CreateProxy <IObjectManager>(Relativity.API.ExecutionIdentity.System)) { var toUpdate = new RelativityObjectRef { ArtifactID = indexJob.JobArtifactID }; var fields = new FieldValue[] { new FieldValue("VideoID", videoIndexResult.VideoID), new FieldValue("Video File Name", videoIndexResult.VideoName), new FieldValue("DocumentControlNumber", videoIndexResult.ControlNumber) }; var updateRequest = new UpdateRequest { Object = toUpdate, FieldValues = fields }; await manager.UpdateAsync(indexJob.WorkspaceArtifactID, updateRequest); } } catch (Exception ex) { LogError(ex); } }
private async Task <bool> ExecuteAsync() { bool executedSuccessfully = true; try { if (GetConfigurationValues()) { _indexerApiUrl = "https://api.videoindexer.ai"; //Retrieve _indexerApiKey from secret store _indexerApiKey = ""; //Add your own credentials here //Get job details IndexJob indexJob = new IndexJob(); indexJob = GetSingleJob(); if (indexJob.Success) { await UpdateStatus(indexJob, "In Progress"); //Get job document details DocProperty doc = new DocProperty(); doc = await GetDocProperty(indexJob.WorkspaceArtifactID, indexJob.DocumentArtifactID); if (doc.Success) { //Launch video for indexing VideoIndex videoIndex = new VideoIndex(doc.Path, doc.Filename, doc.Begdoc, _indexerApiUrl, _indexerApiKey, _logger, Helper); VideoIndexResult videoIndexResult = await videoIndex.Sample(); //Update job with index details. We will use these details later in the custom page. await WriteValuesToIndexJob(indexJob, videoIndexResult); await WriteValuesToDocumentObject(indexJob, videoIndexResult); //Write transcript to document field } CleanupQueue(indexJob); await UpdateStatus(indexJob, "Complete"); } } const int maxMessageLevel = 10; RaiseMessage("Completed.", maxMessageLevel); } catch (Exception ex) { LogError(ex); executedSuccessfully = false; } return(executedSuccessfully); }