Search in sources :

Example 6 with AuditingInfo

use of com.qcloud.cos.model.ciModel.auditing.AuditingInfo in project cos-java-sdk-v5 by tencentyun.

the class VideoAuditingJobDemo method describeAuditingJob.

/**
 * DescribeAuditingJob 接口用于创建视频审核任务。
 *
 * @param client
 */
public static void describeAuditingJob(COSClient client) throws InterruptedException {
    // 1.创建任务请求对象
    VideoAuditingRequest request = new VideoAuditingRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("demo-123456789");
    request.setJobId("av2628fdd21c4d11ecb3fa5254009*****");
    // 3.调用接口,获取任务响应对象
    while (true) {
        // 3.调用接口,获取任务响应对象
        VideoAuditingResponse response = client.describeAuditingJob(request);
        String state = response.getJobsDetail().getState();
        if ("Success".equalsIgnoreCase(state) || "Failed".equalsIgnoreCase(state)) {
            System.out.println(response.getRequestId());
            System.out.println(state);
            System.out.println(response.getJobsDetail());
            // 4.根据业务逻辑进行处理结果,此处工具类处理操作仅供参考。
            List<AuditingInfo> auditingInfoList = AuditingResultUtil.getAuditingInfoList(response.getJobsDetail());
            System.out.println(auditingInfoList);
            break;
        }
        Thread.sleep(100);
    }
}
Also used : AuditingInfo(com.qcloud.cos.model.ciModel.auditing.AuditingInfo) VideoAuditingRequest(com.qcloud.cos.model.ciModel.auditing.VideoAuditingRequest) VideoAuditingResponse(com.qcloud.cos.model.ciModel.auditing.VideoAuditingResponse)

Example 7 with AuditingInfo

use of com.qcloud.cos.model.ciModel.auditing.AuditingInfo in project cos-java-sdk-v5 by tencentyun.

the class ImageAuditingDemo method batchImageAuditing.

/**
 * batchImageAuditing 接口批量创建图片审核任务。 (推荐)
 *
 * @param client
 */
public static void batchImageAuditing(COSClient client) {
    // 1.创建任务请求对象
    BatchImageAuditingRequest request = new BatchImageAuditingRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    // 2.1设置请求bucket
    request.setBucketName("demo-123456789");
    // 2.2添加请求内容
    List<BatchImageAuditingInputObject> inputList = request.getInputList();
    BatchImageAuditingInputObject input = new BatchImageAuditingInputObject();
    input.setObject("1.jpg");
    input.setDataId("DataId");
    inputList.add(input);
    input = new BatchImageAuditingInputObject();
    input.setUrl("https://demo-123456789.cos.ap-chongqing.myqcloud.com/1.png");
    input.setDataId("DataId");
    inputList.add(input);
    // 2.2设置审核类型
    request.getConf().setDetectType("all");
    // 3.调用接口,获取任务响应对象
    BatchImageAuditingResponse response = client.batchImageAuditing(request);
    List<BatchImageJobDetail> jobList = response.getJobList();
    for (BatchImageJobDetail batchImageJobDetail : jobList) {
        List<AuditingInfo> imageInfoList = AuditingResultUtil.getBatchImageInfoList(batchImageJobDetail);
        System.out.println(imageInfoList);
    }
}
Also used : BatchImageAuditingInputObject(com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingInputObject) BatchImageAuditingRequest(com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingRequest) BatchImageAuditingResponse(com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingResponse) BatchImageJobDetail(com.qcloud.cos.model.ciModel.auditing.BatchImageJobDetail) AuditingInfo(com.qcloud.cos.model.ciModel.auditing.AuditingInfo)

Aggregations

AuditingInfo (com.qcloud.cos.model.ciModel.auditing.AuditingInfo)7 BatchImageAuditingRequest (com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingRequest)2 BatchImageAuditingResponse (com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingResponse)2 AbuseInfo (com.qcloud.cos.model.ciModel.auditing.AbuseInfo)1 AdsInfo (com.qcloud.cos.model.ciModel.auditing.AdsInfo)1 AudioAuditingRequest (com.qcloud.cos.model.ciModel.auditing.AudioAuditingRequest)1 AudioAuditingResponse (com.qcloud.cos.model.ciModel.auditing.AudioAuditingResponse)1 BatchImageAuditingInputObject (com.qcloud.cos.model.ciModel.auditing.BatchImageAuditingInputObject)1 BatchImageJobDetail (com.qcloud.cos.model.ciModel.auditing.BatchImageJobDetail)1 IllegalInfo (com.qcloud.cos.model.ciModel.auditing.IllegalInfo)1 ImageAuditingRequest (com.qcloud.cos.model.ciModel.auditing.ImageAuditingRequest)1 ImageAuditingResponse (com.qcloud.cos.model.ciModel.auditing.ImageAuditingResponse)1 PoliticsInfo (com.qcloud.cos.model.ciModel.auditing.PoliticsInfo)1 PornInfo (com.qcloud.cos.model.ciModel.auditing.PornInfo)1 SectionInfo (com.qcloud.cos.model.ciModel.auditing.SectionInfo)1 SnapshotInfo (com.qcloud.cos.model.ciModel.auditing.SnapshotInfo)1 TerroristInfo (com.qcloud.cos.model.ciModel.auditing.TerroristInfo)1 TextAuditingRequest (com.qcloud.cos.model.ciModel.auditing.TextAuditingRequest)1 TextAuditingResponse (com.qcloud.cos.model.ciModel.auditing.TextAuditingResponse)1 VideoAuditingRequest (com.qcloud.cos.model.ciModel.auditing.VideoAuditingRequest)1