2727client = CosS3Client (config )
2828
2929
30- bucket_name = 'demo-1253960454 '
30+ bucket_name = 'demo-1250000000 '
3131
3232
3333def ci_get_media_bucket ():
@@ -1051,7 +1051,7 @@ def ci_create_segment_video_body_jobs():
10511051 # Foreground(输出前景视频)、
10521052 # Combination(输出抠图后的前景与自定义背景合成后的视频)
10531053 'Mode' : 'Mask' ,
1054- # 非必选 抠图模式,当前支持 HumanSeg、GreenScreenSeg。 默认值 HumanSeg
1054+ # 非必选 抠图模式,当前支持 HumanSeg(人像抠图) 、GreenScreenSeg(绿幕抠图)、SolidColorSeg(纯色背景抠图) 。 默认值 HumanSeg
10551055 # 'SegmentType': 'GreenScreenSeg',
10561056 # 非必选 mode为Foreground时可指定此参数,背景颜色为蓝色,取值范围为0-255, 默认值为0
10571057 # 'BackgroundBlue': '255',
@@ -1062,7 +1062,13 @@ def ci_create_segment_video_body_jobs():
10621062 # 非必选 mode为Combination时,必需指定此参数,传入背景文件,背景文件需与object在同存储桶下
10631063 # 'BackgroundLogoUrl': 'http://testpic-1253960454.cos.ap-chongqing.myqcloud.com'
10641064 # 非必选 阈值 可以调整alpha通道的边缘,调整抠图的边缘位置 取值范围为0-255, 默认值为0
1065- # 'BinaryThreshold': '200'
1065+ # 'BinaryThreshold': '200',
1066+ # 非必选 纯色背景抠图的背景色(红), 当 SegmentType 为 SolidColorSeg 生效,取值范围为0-255,默认值为 0
1067+ # 'RemoveRed': '200',
1068+ # 非必选 纯色背景抠图的背景色(绿), 当 SegmentType 为 SolidColorSeg 生效,取值范围为0-255,默认值为 0
1069+ # 'RemoveGreen': '200',
1070+ # 非必选 纯色背景抠图的背景色(蓝), 当 SegmentType 为 SolidColorSeg 生效,取值范围为0-255,默认值为 0
1071+ # 'RemoveBlue': '200'
10661072 },
10671073 # 输出配置
10681074 'Output' : {
@@ -1494,6 +1500,112 @@ def ci_create_image_inspect_jobs():
14941500 return response
14951501
14961502
1503+ def ci_create_image_inspect_batch_jobs ():
1504+ # 创建异常图片检测批量处理任务
1505+ body = {
1506+ # 批量任务名称
1507+ # 存量触发任务名称,支持中文、英文、数字、—和_,长度限制128字符
1508+ # 必选
1509+ 'Name' : 'image-inspect-auto-move-batch-process' ,
1510+ # 批量处理任务类型:
1511+ # 支持 Job(独立异步任务) Workflow(工作流)
1512+ 'Type' : 'Job' ,
1513+ # 待操作的对象信息
1514+ # 必传参数
1515+ 'Input' : {
1516+ # 'UrlFile': 'https://ziroom-tech-1255976291.cos.ap-beijing.myqcloud.com/ci_ziroom-tech_scankey_url.txt',
1517+ # Object 前缀
1518+ 'Prefix' : '/' ,
1519+ },
1520+ # 操作规则
1521+ # 必传参数
1522+ 'Operation' : {
1523+ # 按对象的last modify时间过滤的触发范围,若传入此参数,则当前任务仅处理指定事件范围内的对象
1524+ # 非必传
1525+ # 创建的任务类型,此处固定值为ImageInspect
1526+ # 必传参数
1527+ 'Tag' : 'ImageInspect' ,
1528+ # 任务参数集合
1529+ # 必传参数
1530+ 'JobParam' : {
1531+ # 异常图片检测配置
1532+ # 非必选
1533+ 'ImageInspect' : {
1534+ # 是否开启检测到异常图片检测后自动对图片进行处理的动作,false/true,非必选,默认false
1535+ 'AutoProcess' : 'true' ,
1536+ # 在检测到为异常图片后的处理动作,有效值为:
1537+ # BackupObject:移动图片到固定目录下,目录名为abnormal_images_backup/,由后台自动创建
1538+ # SwitchObjectToPrivate:将图片权限设置为私有
1539+ # DeleteObject:删除图片
1540+ # 非必选参数,默认值为BackupObject
1541+ 'ProcessType' : 'BackupObject'
1542+ },
1543+ },
1544+
1545+ },
1546+
1547+ }
1548+ response = client .ci_create_inventory_trigger_jobs (
1549+ Bucket = bucket_name ,
1550+ JobBody = body ,
1551+ ContentType = 'application/xml'
1552+ )
1553+ print (response )
1554+ return response
1555+
1556+
1557+ def ci_create_image_inspect_workflow_batch_jobs ():
1558+ # 创建异常图片检测工作流批量处理任务
1559+
1560+ body = {
1561+ # 批量任务名称
1562+ # 存量触发任务名称,支持中文、英文、数字、—和_,长度限制128字符
1563+ # 必选
1564+ 'Name' : 'image-inspect-auto-move-batch-process' ,
1565+ # 批量处理任务类型:
1566+ # 支持 Job(独立异步任务) Workflow(工作流)
1567+ 'Type' : 'Workflow' ,
1568+ # 待操作的对象信息
1569+ # 必传参数
1570+ 'Input' : {
1571+ # 'UrlFile': 'https://ziroom-tech-1255976291.cos.ap-beijing.myqcloud.com/ci_ziroom-tech_scankey_url.txt',
1572+ # Object 前缀
1573+ 'Prefix' : '/' ,
1574+ },
1575+ # 操作规则
1576+ # 必传参数
1577+ 'Operation' : {
1578+ # 按对象的last modify时间过滤的触发范围,若传入此参数,则当前任务仅处理指定事件范围内的对象
1579+ # 非必传
1580+ 'TimeInterval' : {
1581+ 'Start' : '2023-05-01T00:00:00+0800' ,
1582+ 'End' : '2023-06-01T00:00:00+0800'
1583+ },
1584+ # 创建的任务类型,此处固定值为ImageInspect
1585+ # 必传参数
1586+ 'WorkflowIds' : 'w2504f47ad46exxxxxxxxxxxxxx' ,
1587+ },
1588+
1589+ }
1590+ response = client .ci_create_inventory_trigger_jobs (
1591+ Bucket = bucket_name ,
1592+ JobBody = body ,
1593+ ContentType = 'application/xml'
1594+ )
1595+ print (response )
1596+ return response
1597+
1598+
1599+ def ci_delete_inventory_trigger_jobs ():
1600+ # 删除指定的批量处理任务
1601+ response = client .ci_delete_inventory_trigger_jobs (
1602+ Bucket = bucket_name , # 桶名称
1603+ JobId = 'b97c37f492adf11xxxxxxxxxxxx' , # 需要删除的工作流ID
1604+ )
1605+ print (response )
1606+ return response
1607+
1608+
14971609if __name__ == "__main__" :
14981610 # ci_get_media_queue()
14991611 # ci_get_media_transcode_jobs()
0 commit comments