private async Task <bool> ProcessLabels(ILambdaContext context, string jobId) { GetContentModerationResponse response = null; do { GetContentModerationRequest request = new GetContentModerationRequest { JobId = jobId, MaxResults = MaxResults, NextToken = response?.NextToken, SortBy = ContentModerationSortBy.TIMESTAMP }; response = await this.rekClient.GetContentModerationAsync(request).ConfigureAwait(false); if (!(response?.VideoMetadata.DurationMillis >= maxLength)) { continue; } context.Logger.LogLine($"video exceeds max allowed length of {TimeSpan.FromMilliseconds(maxLength).TotalMinutes}. The observed length of video is {TimeSpan.FromMilliseconds(response.VideoMetadata.DurationMillis).TotalMinutes}"); return(false); } while (response?.NextToken != null); return(true); }
private async Task <bool> ProcessLabels(ILambdaContext context, string jobId) { GetContentModerationResponse response = null; do { GetContentModerationRequest request = new GetContentModerationRequest { JobId = jobId, MaxResults = MaxResults, NextToken = response?.NextToken, SortBy = ContentModerationSortBy.TIMESTAMP }; response = await this.rekClient.GetContentModerationAsync(request).ConfigureAwait(false); return(response.ModerationLabels.Any(x => this.labels.Contains(x.ModerationLabel.Name) || this.labels.Contains(x.ModerationLabel.ParentName) && x.ModerationLabel.Confidence > 40)); } while (response?.NextToken != null); }