tencentcloud-sdk-vm 1.0.200

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,175 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Vm
21
+ module V20201229
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2020-12-29'
26
+ api_endpoint = 'vm.tencentcloudapi.com'
27
+ sdk_version = 'VM_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 可使用该接口取消审核任务,成功取消后,该接口返回已取消任务的TaskId。<br>
33
+
34
+ # 默认接口请求频率限制:**20次/秒**。
35
+
36
+ # @param request: Request instance for CancelTask.
37
+ # @type request: :class:`Tencentcloud::vm::V20201229::CancelTaskRequest`
38
+ # @rtype: :class:`Tencentcloud::vm::V20201229::CancelTaskResponse`
39
+ def CancelTask(request)
40
+ body = send_request('CancelTask', request.serialize)
41
+ response = JSON.parse(body)
42
+ if response['Response'].key?('Error') == false
43
+ model = CancelTaskResponse.new
44
+ model.deserialize(response['Response'])
45
+ model
46
+ else
47
+ code = response['Response']['Error']['Code']
48
+ message = response['Response']['Error']['Message']
49
+ reqid = response['Response']['RequestId']
50
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
51
+ end
52
+ rescue TencentCloud::Common::TencentCloudSDKException => e
53
+ raise e
54
+ rescue StandardError => e
55
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
56
+ end
57
+
58
+ # 本接口(Video Moderation System,VM)用于提交视频文件或视频流进行智能审核任务。使用前请您使用腾讯云主账号登录控制台[开通视频内容安全服务](https://console.cloud.tencent.com/cms/video/package)并调整好对应的业务配置。<br>
59
+ # ### 功能使用说明:
60
+
61
+ # - 前往“[内容安全控制台-视频内容安全](https://console.cloud.tencent.com/cms/video/package)”开启使用视频内容安全服务,首次开通服务的用户可免费领用试用套餐包,包含600分钟的处理量(换算1s每帧截图,赠送**36000张图**、**600分钟的音频**处理量),有效期为1个月。
62
+
63
+ # - 该接口为收费接口,计费方式敬请参见[腾讯云视频内容安全定价](https://cloud.tencent.com/product/vm/pricing)。
64
+
65
+ # - 默认接口请求频率限制:**20次/秒**,对于异步审核任务(点播视频),超出频率限制的请求会自动排入待审核队列,对于同步审核任务(直播视频),超出频率限制将会报错。
66
+ # - 默认并发审核路数限制:10路,异步审核任务(点播视频)数量超过并发审核路数时,将会进入排队;同步审核任务(直播视频)超过并发审核路数,接口会返回错误。
67
+
68
+
69
+ # ### 接口功能说明:
70
+
71
+ # - 支持对视频文件或视频流进行自动检测,从 OCR文本识别、物体检测(实体、广告台标、二维码等)、图像识别及音频审核四个维度,通过深度学习技术识别视频中的违规内容;
72
+ # - 支持设置回调地址 Callback 获取检测结果,或通过接口(查看任务详情)主动轮询获取检测结果详情;对于正常审核中的视频任务,如含有违规内容,则截帧图片最长会在**3s**内回调,音频片段会在用户配置的**切片时长 + 2s**内回调;对于在队列中的待审核任务,回调时间为正常审核回调时间+等待时间;
73
+ # - 支持通过接口(查看审核任务列表)查询任务队列,用户可根据多种业务信息(业务类型、审核结果、任务状态等)筛选审核任务列表;
74
+ # - 支持识别多种违规场景,包括:低俗、谩骂、色情、广告等场景;
75
+ # - 支持根据不同的业务场景配置自定义的审核策略;
76
+ # - 支持用户自定义配置黑白词库及图片库,打击自定义违规内容(目前仅支持黑名单配置);
77
+ # - 支持用户自定义配置审核任务优先级,当有多个任务排队时,可根据用户配置自动调整任务优先级;
78
+ # - 支持批量提交检测任务,**最多可同时创建10个任务**;
79
+
80
+ # ### 视频文件调用说明:
81
+
82
+ # - 视频文件大小支持:**文件 < 3GB**
83
+ # - 视频文件分辨率支持:**最佳分辨率为1920x1080 (1080p)**,如果视频文件小于300MB,则分辨率可以大于1080p,更大视频可以调用[云转码服务](https://cloud.tencent.com/product/mps/details)转码后再送审;
84
+ # - 视频文件支持格式:flv、mkv 、mp4 、rmvb 、avi 、wmv、3gp、ts、mov、rm、mpeg、wmf等。
85
+ # - 视频文件支持的访问方式:链接地址(支持HTTP/HTTPS)、腾讯云COS存储;
86
+ # - 若传入视频文件的访问链接,则需要注意视频**头文件的读取时间限制为3秒**,为保障被检测视频的稳定性和可靠性,建议您使用腾讯云COS存储或者CDN缓存等;
87
+ # - 支持用户配置是否需要开启音频审核,若不开启则将仅对视频文件图像内容进行审核。
88
+
89
+ # ### 视频流调用说明:
90
+
91
+ # - 视频流时长支持:**5小时以内**
92
+ # - 视频流分辨率支持:支持**1920x1080 (1080p)**,更高分辨率视频可以调用[直播云转码服务](https://cloud.tencent.com/document/product/267/39889)转码后再送审;
93
+ # - 视频流支持格式:rmtp,flv 等主流视频流编码格式。
94
+ # - 视频文件支持的传输协议:HTTP/HTTPS/RTMP;
95
+ # - 支持用户配置是否需要开启音频审核,若不开启则将仅对视频流图像内容进行审核。
96
+
97
+ # @param request: Request instance for CreateVideoModerationTask.
98
+ # @type request: :class:`Tencentcloud::vm::V20201229::CreateVideoModerationTaskRequest`
99
+ # @rtype: :class:`Tencentcloud::vm::V20201229::CreateVideoModerationTaskResponse`
100
+ def CreateVideoModerationTask(request)
101
+ body = send_request('CreateVideoModerationTask', request.serialize)
102
+ response = JSON.parse(body)
103
+ if response['Response'].key?('Error') == false
104
+ model = CreateVideoModerationTaskResponse.new
105
+ model.deserialize(response['Response'])
106
+ model
107
+ else
108
+ code = response['Response']['Error']['Code']
109
+ message = response['Response']['Error']['Message']
110
+ reqid = response['Response']['RequestId']
111
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
112
+ end
113
+ rescue TencentCloud::Common::TencentCloudSDKException => e
114
+ raise e
115
+ rescue StandardError => e
116
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
117
+ end
118
+
119
+ # 通过查看任务详情 DescribeTaskDetail 接口,可主动轮询获取检测结果详情。<br>
120
+
121
+ # 默认接口请求频率限制:**200次/秒**。
122
+
123
+ # @param request: Request instance for DescribeTaskDetail.
124
+ # @type request: :class:`Tencentcloud::vm::V20201229::DescribeTaskDetailRequest`
125
+ # @rtype: :class:`Tencentcloud::vm::V20201229::DescribeTaskDetailResponse`
126
+ def DescribeTaskDetail(request)
127
+ body = send_request('DescribeTaskDetail', request.serialize)
128
+ response = JSON.parse(body)
129
+ if response['Response'].key?('Error') == false
130
+ model = DescribeTaskDetailResponse.new
131
+ model.deserialize(response['Response'])
132
+ model
133
+ else
134
+ code = response['Response']['Error']['Code']
135
+ message = response['Response']['Error']['Message']
136
+ reqid = response['Response']['RequestId']
137
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
138
+ end
139
+ rescue TencentCloud::Common::TencentCloudSDKException => e
140
+ raise e
141
+ rescue StandardError => e
142
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
143
+ end
144
+
145
+ # 通过查看审核任务列表接口,可查询任务队列;您可根据多种业务信息(业务类型、审核结果、任务状态等)筛选审核任务列表。<br>
146
+
147
+ # 默认接口请求频率限制:**20次/秒**。
148
+
149
+ # @param request: Request instance for DescribeTasks.
150
+ # @type request: :class:`Tencentcloud::vm::V20201229::DescribeTasksRequest`
151
+ # @rtype: :class:`Tencentcloud::vm::V20201229::DescribeTasksResponse`
152
+ def DescribeTasks(request)
153
+ body = send_request('DescribeTasks', request.serialize)
154
+ response = JSON.parse(body)
155
+ if response['Response'].key?('Error') == false
156
+ model = DescribeTasksResponse.new
157
+ model.deserialize(response['Response'])
158
+ model
159
+ else
160
+ code = response['Response']['Error']['Code']
161
+ message = response['Response']['Error']['Message']
162
+ reqid = response['Response']['RequestId']
163
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
164
+ end
165
+ rescue TencentCloud::Common::TencentCloudSDKException => e
166
+ raise e
167
+ rescue StandardError => e
168
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
169
+ end
170
+
171
+
172
+ end
173
+ end
174
+ end
175
+ end