@@ -52,6 +52,65 @@ def ci_get_media_queue():
5252 return response
5353
5454
55+ def ci_get_pic_bucket ():
56+ # 查询图片处理异步服务开通状态
57+ response = client .ci_get_pic_bucket (
58+ Regions = region ,
59+ BucketName = 'demo' ,
60+ BucketNames = bucket_name ,
61+ PageSize = "1" ,
62+ PageNumber = "1"
63+ )
64+ print (response )
65+ return response
66+
67+
68+ def ci_get_ai_bucket ():
69+ # 查询ai处理异步服务开通状态
70+ response = client .ci_get_ai_bucket (
71+ Regions = region ,
72+ BucketName = 'demo' ,
73+ BucketNames = bucket_name ,
74+ PageSize = "1" ,
75+ PageNumber = "1"
76+ )
77+ print (response )
78+ return response
79+
80+
81+ def ci_get_ai_queue ():
82+ # 查询ai处理队列信息
83+ response = client .ci_get_ai_queue (
84+ Bucket = bucket_name ,
85+ )
86+ print (response )
87+ return response
88+
89+
90+ def ci_put_ai_queue ():
91+ # 更新ai队列信息
92+ body = {
93+ 'Name' : 'ai-queue' ,
94+ 'QueueID' : 'pa2c2afbe68xxxxxxxxxxxxxxxxxxxxxx' ,
95+ 'State' : 'Active' ,
96+ 'NotifyConfig' : {
97+ 'Type' : 'Url' ,
98+ 'Url' : 'http://www.demo.callback.com' ,
99+ 'Event' : 'TaskFinish' ,
100+ 'State' : 'On' ,
101+ 'ResultFormat' : 'JSON' ,
102+ }
103+ }
104+ response = client .ci_update_ai_queue (
105+ Bucket = bucket_name ,
106+ QueueId = 'pa2c2afbe68c44xxxxxxxxxxxxxxxxxxxx' ,
107+ Request = body ,
108+ ContentType = 'application/xml'
109+ )
110+ print (response )
111+ return response
112+
113+
55114def ci_get_media_pic_queue ():
56115 # 查询图片处理队列信息
57116 response = client .ci_get_media_pic_queue (
@@ -72,7 +131,16 @@ def ci_put_media_queue():
72131 'Url' : 'http://www.demo.callback.com' ,
73132 'Event' : 'TaskFinish' ,
74133 'State' : 'On' ,
75- 'ResultFormat' : 'JSON'
134+ 'ResultFormat' : 'JSON' ,
135+ # TDMQ回调信息配置
136+ # 消息队列所属园区
137+ # 必选。目前支持园区 sh(上海)、bj(北京)、gz(广州)、cd(成都)、hk(中国香港)
138+ # 'MqRegion': 'bj',
139+ # # 消息队列使用模式
140+ # # 必选。主题订阅:Topic 队列服务: Queue
141+ # 'MqMode': 'Queue',
142+ # # TDMQ 主题名称 必选。
143+ # 'MqName': 'queueName'
76144 }
77145 }
78146 response = client .ci_update_media_queue (
@@ -305,6 +373,7 @@ def ci_create_media_transcode_jobs():
305373 'Region' : region ,
306374 'Object' : 'transcode_output.mp4'
307375 },
376+ # 'FreeTranscode': 'true',
308377 # 'TemplateId': 't02db40900dc1c43ad9bdbd8acec6075c5'
309378 }
310379 }
@@ -1596,6 +1665,25 @@ def ci_create_image_inspect_workflow_batch_jobs():
15961665 return response
15971666
15981667
1668+ def ci_list_inventory_trigger_jobs ():
1669+ # 查询批量处理任务列表
1670+ response = client .ci_list_inventory_trigger_jobs (
1671+ Bucket = bucket_name , # 桶名称
1672+ )
1673+ print (response )
1674+ return response
1675+
1676+
1677+ def ci_get_inventory_trigger_jobs ():
1678+ # 查询指定批量处理任务
1679+ response = client .ci_get_inventory_trigger_jobs (
1680+ Bucket = bucket_name , # 桶名称
1681+ JobID = 'bb16331089f7c11ecb10252540019ee59' ,
1682+ )
1683+ print (response )
1684+ return response
1685+
1686+
15991687def ci_delete_inventory_trigger_jobs ():
16001688 # 删除指定的批量处理任务
16011689 response = client .ci_delete_inventory_trigger_jobs (
@@ -1652,6 +1740,187 @@ def ci_create_sound_hound_jobs():
16521740 return response
16531741
16541742
1743+ def ci_create_noise_reduction_jobs ():
1744+ # 创建音频降噪任务
1745+ body = {
1746+ 'Input' : {
1747+ 'Object' : 'demo.mp3'
1748+ },
1749+ 'Tag' : 'NoiseReduction' ,
1750+ 'Operation' : {
1751+ 'Output' : {
1752+ 'Bucket' : bucket_name ,
1753+ 'Region' : region ,
1754+ 'Object' : 'noise_reduction_result.mp3' ,
1755+ },
1756+ # 'TemplateId': 't02db40900dc1c43ad9bdbd8acec6075c5'
1757+ }
1758+ }
1759+ response = client .ci_create_media_jobs (
1760+ Bucket = bucket_name ,
1761+ Jobs = body ,
1762+ Lst = {},
1763+ ContentType = 'application/xml'
1764+ )
1765+ print (response )
1766+ return response
1767+
1768+
1769+ def ci_create_stream_extract_jobs ():
1770+ # 创建流分离任务
1771+ body = {
1772+ 'Input' : {
1773+ 'Object' : 'demo.mp4'
1774+ },
1775+ 'Tag' : 'StreamExtract' ,
1776+ 'Operation' : {
1777+ 'Output' : {
1778+ 'Bucket' : bucket_name ,
1779+ 'Region' : region ,
1780+ 'StreamExtract' : [
1781+ {
1782+ 'Index' : '0' ,
1783+ 'Object' : 'stream-1.mp4'
1784+ },
1785+ {
1786+ 'Index' : '1' ,
1787+ 'Object' : 'stream-2.mp4'
1788+ }
1789+ ]
1790+ },
1791+ }
1792+ }
1793+ response = client .ci_create_media_jobs (
1794+ Bucket = bucket_name ,
1795+ Jobs = body ,
1796+ Lst = {},
1797+ ContentType = 'application/xml'
1798+ )
1799+ print (response )
1800+ return response
1801+
1802+
1803+ def ci_create_tts_jobs ():
1804+ # 创建语音合成任务
1805+ body = {
1806+ 'Tag' : 'Tts' ,
1807+ 'Input' : {
1808+ 'Object' : 'demo.mp4'
1809+ },
1810+ 'Operation' : {
1811+ 'TtsTpl' : {
1812+ # 处理模式,Asyc(异步合成)、Sync(同步合成)
1813+ # 当选择 Asyc 时,codec 只支持 pcm
1814+ # 默认值 Asyc
1815+ 'Mode' : '' ,
1816+ # 音频格式,wav、mp3、pcm
1817+ # 默认值 wav(同步)/pcm(异步)
1818+ 'Codec' : '' ,
1819+ # 音色
1820+ # 默认值 ruxue
1821+ 'VoiceType' : '' ,
1822+ # 音量
1823+ # 取值范围:[-10,10]
1824+ # 默认值0
1825+ 'Volume' : '' ,
1826+ # 语速
1827+ # 取值范围:[50,200]
1828+ # 默认值100
1829+ 'Speed' : '' ,
1830+ },
1831+ 'TemplateId' : '' ,
1832+ 'TtsConfig' : {
1833+ 'InputType' : 'Text' ,
1834+ 'Input' : '床前明月光,疑是地上霜' ,
1835+ },
1836+ 'Output' : {
1837+ 'Bucket' : bucket_name ,
1838+ 'Region' : region ,
1839+ 'Object' : 'result.mp3'
1840+ },
1841+ }
1842+ }
1843+ response = client .ci_create_media_jobs (
1844+ Bucket = bucket_name ,
1845+ Jobs = body ,
1846+ Lst = {},
1847+ ContentType = 'application/xml'
1848+ )
1849+ print (response )
1850+ return response
1851+
1852+
1853+ def ci_create_translation_jobs ():
1854+ # 创建翻译任务
1855+ body = {
1856+ 'Tag' : 'Translation' ,
1857+ 'Input' : {
1858+ 'Object' : 'demo.txt' ,
1859+ 'Lang' : 'en' ,
1860+ 'Type' : 'txt' ,
1861+ # 'BasicType': ''
1862+ },
1863+ 'Operation' : {
1864+ 'Translation' : {
1865+ 'Lang' : 'zh' ,
1866+ 'Type' : 'txt' ,
1867+ },
1868+ 'Output' : {
1869+ 'Bucket' : bucket_name ,
1870+ 'Region' : region ,
1871+ 'Object' : 'result.txt'
1872+ },
1873+ }
1874+ }
1875+ response = client .ci_create_media_jobs (
1876+ Bucket = bucket_name ,
1877+ Jobs = body ,
1878+ Lst = {},
1879+ ContentType = 'application/xml'
1880+ )
1881+ print (response )
1882+ return response
1883+
1884+
1885+ def ci_create_words_generalize_jobs ():
1886+ # 创建分词任务
1887+ body = {
1888+ 'Tag' : 'WordsGeneralize' ,
1889+ 'Input' : {
1890+ 'Object' : 'demo.txt' ,
1891+ },
1892+ 'Operation' : {
1893+ 'WordsGeneralize' : {
1894+ 'NerMethod' : 'DL' ,
1895+ 'SegMethod' : 'MIX' ,
1896+ },
1897+ }
1898+ }
1899+ response = client .ci_create_media_jobs (
1900+ Bucket = bucket_name ,
1901+ Jobs = body ,
1902+ Lst = {},
1903+ ContentType = 'application/xml'
1904+ )
1905+ print (response )
1906+ return response
1907+
1908+
1909+ def ci_get_presigned_download_url ():
1910+ param = {
1911+ "object" : "test.gif" ,
1912+ "format" : "mp4"
1913+ }
1914+ url = client .get_presigned_download_url (
1915+ Bucket = bucket_name ,
1916+ Key = '/convert' ,
1917+ Expired = 3600 ,
1918+ Params = param ,
1919+ UseCiEndPoint = True ,
1920+ )
1921+ print (url )
1922+
1923+
16551924if __name__ == "__main__" :
16561925 # ci_get_media_queue()
16571926 # ci_get_media_jobs()
@@ -1698,4 +1967,16 @@ def ci_create_sound_hound_jobs():
16981967 # ci_update_workflow_state()
16991968 # ci_delete_workflow()
17001969 # ci_create_image_inspect_jobs()
1701- ci_create_sound_hound_jobs ()
1970+ # ci_create_sound_hound_jobs()
1971+ # ci_list_inventory_trigger_jobs()
1972+ # ci_get_pic_bucket()
1973+ # ci_get_inventory_trigger_jobs()
1974+ # ci_get_ai_bucket()
1975+ # ci_get_ai_queue()
1976+ # ci_put_ai_queue()
1977+ # ci_create_noise_reduction_jobs()
1978+ # ci_create_stream_extract_jobs()
1979+ # ci_create_tts_jobs()
1980+ # ci_create_translation_jobs()
1981+ # ci_create_words_generalize_jobs()
1982+ ci_get_presigned_download_url ()
0 commit comments