示例#1
0
 /// <summary>
 /// 提交视频审核任务
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public SubmitCensorJobResult SubmitVideoCensorJob(SubmitVideoCensorJobRequest request)
 {
     request.Region = this.GetConfig().Region;
     return(Execute(request, new SubmitCensorJobResult()));
 }
示例#2
0
        public void TestVideoCensorJobCommit()
        {
            try
            {
                SubmitVideoCensorJobRequest request = new SubmitVideoCensorJobRequest(bucket);
                request.SetCensorObject(videoKey);
                request.SetDetectType("P**n,Terrorism");
                request.SetSnapshotMode("Average");
                request.SetSnapshotCount("100");
                SubmitCensorJobResult result = QCloudServer.Instance().cosXml.SubmitVideoCensorJob(request);
                Assert.NotNull(result.censorJobsResponse.JobsDetail.JobId);
                Assert.NotNull(result.censorJobsResponse.JobsDetail.State);
                Assert.NotNull(result.censorJobsResponse.JobsDetail.CreationTime);
                string id = result.censorJobsResponse.JobsDetail.JobId;
                Thread.Sleep(120000);

                // get video censor job
                GetVideoCensorJobRequest getRequest = new GetVideoCensorJobRequest(bucket, id);
                GetVideoCensorJobResult  getResult  = QCloudServer.Instance().cosXml.GetVideoCensorJob(getRequest);
                Assert.AreEqual(200, getResult.httpCode);

                Assert.NotNull(getResult.resultStruct.JobsDetail);
                //Assert.NotNull(getResult.resultStruct.JobsDetail.Code);
                //Assert.NotNull(getResult.resultStruct.JobsDetail.Message);
                Assert.NotNull(getResult.resultStruct.JobsDetail.JobId);
                Assert.NotNull(getResult.resultStruct.JobsDetail.State);
                Assert.NotNull(getResult.resultStruct.JobsDetail.CreationTime);
                Assert.NotNull(getResult.resultStruct.JobsDetail.Object);
                Assert.NotNull(getResult.resultStruct.JobsDetail.SnapshotCount);
                Assert.NotNull(getResult.resultStruct.JobsDetail.Result);

                Assert.NotNull(getResult.resultStruct.JobsDetail.PornInfo);
                Assert.NotNull(getResult.resultStruct.JobsDetail.PornInfo.HitFlag);
                Assert.NotNull(getResult.resultStruct.JobsDetail.PornInfo.Count);

                Assert.NotNull(getResult.resultStruct.JobsDetail.TerrorismInfo);
                Assert.NotNull(getResult.resultStruct.JobsDetail.TerrorismInfo.HitFlag);
                Assert.NotNull(getResult.resultStruct.JobsDetail.TerrorismInfo.Count);

                /*
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.PoliticsInfo);
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.PoliticsInfo.HitFlag);
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.PoliticsInfo.Count);
                 *
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.AdsInfo);
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.AdsInfo.HitFlag);
                 * Assert.NotNull(getResult.resultStruct.JobsDetail.AdsInfo.Count);
                 */
                Assert.NotZero(getResult.resultStruct.JobsDetail.Snapshot.Count);
                for (int i = 0; i < getResult.resultStruct.JobsDetail.Snapshot.Count; i++)
                {
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i]);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].Url);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].Text);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].SnapshotTime);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PornInfo);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PornInfo.HitFlag);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PornInfo.Score);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PornInfo.Label);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PornInfo.SubLabel);

                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].TerrorismInfo);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].TerrorismInfo.HitFlag);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].TerrorismInfo.Score);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].TerrorismInfo.Label);
                    Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].TerrorismInfo.SubLabel);

                    /*
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PoliticsInfo);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PoliticsInfo.HitFlag);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PoliticsInfo.Score);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PoliticsInfo.Label);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].PoliticsInfo.SubLabel);
                     *
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].AdsInfo);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].AdsInfo.HitFlag);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].AdsInfo.Score);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].AdsInfo.Label);
                     * Assert.NotNull(getResult.resultStruct.JobsDetail.Snapshot[i].AdsInfo.SubLabel);
                     */
                }
                Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection);

                /*
                 * Assert.NotZero(getResult.resultStruct.JobsDetail.AudioSection.Count);
                 * for(int i = 0; i < getResult.resultStruct.JobsDetail.AudioSection.Count; i++)
                 * {
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i]);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].Url);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].OffsetTime);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].Duration);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].Text);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PoliticsInfo);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PoliticsInfo.HitFlag);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PoliticsInfo.Score);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PoliticsInfo.Keywords);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PornInfo);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PornInfo.HitFlag);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PornInfo.Score);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].PornInfo.Keywords);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].TerrorismInfo);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].TerrorismInfo.HitFlag);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].TerrorismInfo.Score);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].TerrorismInfo.Keywords);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].AdsInfo);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].AdsInfo.HitFlag);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].AdsInfo.Score);
                 *  Assert.NotNull(getResult.resultStruct.JobsDetail.AudioSection[i].AdsInfo.Keywords);
                 * }
                 */
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                Console.WriteLine("CosClientException: " + clientEx.Message);
                Assert.Fail();
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
                Assert.Fail();
            }
        }