Skip to content

Commit e12bdc0

Browse files
author
lijing
committed
add livetran loop api
1 parent 21acf13 commit e12bdc0

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

examples/ket.py

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
outpull = 1
1616
srcurl = "rtmp://qa-ws.test-rtmplive.ks-cdn.com/live/20160819"
1717

18+
# 删除模板
19+
res = client.DelPreset(App=appname, UniqName=uniqname, Preset=presetname)
20+
print json.dumps(res)
21+
1822
# 创建模板
1923
param = {
2024
"UniqName": uniqname,
@@ -48,10 +52,6 @@
4852
res = client.GetPresetList(App=appname, UniqName=uniqname)
4953
print json.dumps(res)
5054

51-
# 删除模板
52-
res = client.DelPreset(App=appname, UniqName=uniqname, Preset=presetname)
53-
print json.dumps(res)
54-
5555
# 启动外网拉流
5656
param1 = {
5757
"UniqName": uniqname,
@@ -79,3 +79,45 @@
7979
# 获取用户已占用配额
8080
res = client.GetQuotaUsed(UniqName=uniqname)
8181
print json.dumps(res)
82+
83+
# 发起轮播任务
84+
param3 = {
85+
"UniqName": uniqname,
86+
"App": appname,
87+
"StreamID": streamid,
88+
"Preset": presetname,
89+
"PubDomain": "test.uplive.ksyun.com",
90+
"DurationHour":168,
91+
"SrcInfo": [
92+
{
93+
"Path": "http://wangshuai9.ks3-cn-beijing.ksyun.com/ksyun.flv",
94+
"Index": 0
95+
}
96+
]
97+
}
98+
res = client.StartLoop(param3)
99+
print json.dumps(res)
100+
101+
# 更新轮播时长
102+
param5 = {
103+
"UniqName": uniqname,
104+
"App": appname,
105+
"StreamID": streamid,
106+
"DurationHour":100,
107+
}
108+
res = client.UpdateLoop(param5)
109+
print json.dumps(res)
110+
111+
# 查询轮播列表
112+
res = client.GetLoopList(App=appname, UniqName=uniqname, StreamID=streamid)
113+
print json.dumps(res)
114+
115+
# 停止轮播任务
116+
param4 = {
117+
"UniqName": uniqname,
118+
"App": appname,
119+
"StreamID": streamid,
120+
}
121+
res = client.StopLoop(param4)
122+
print json.dumps(res)
123+

kscore/data/ket/2017-01-01/service-2.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ operations:
7070
input:
7171
shape: UniqNameInstance
7272

73+
StartLoop:
74+
name: StartLoop
75+
http:
76+
method: POST
77+
78+
StopLoop:
79+
name: StopLoop
80+
http:
81+
method: POST
82+
83+
UpdateLoop:
84+
name: UpdateLoop
85+
http:
86+
method: POST
87+
88+
GetLoopList:
89+
name: GetLoopList
90+
http:
91+
method: GET
92+
7393
shapes:
7494
App:
7595
type: string

kscore/ket.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,17 @@ def GetStreamTranList(self,App='live',UniqName='',StreamID='',OutPull=-1):
3737
def GetQuotaUsed(self,UniqName=''):
3838
return self.client.get_quota_used(UniqName=UniqName)
3939

40+
def StartLoop(self,param):
41+
return self.client.start_loop(**param)
42+
43+
def StopLoop(self,param):
44+
return self.client.stop_loop(**param)
45+
46+
def UpdateLoop(self,param):
47+
return self.client.update_loop(**param)
48+
49+
def GetLoopList(self,App='live',UniqName='',StreamID=''):
50+
return self.client.get_loop_list(App=App,UniqName=UniqName,StreamID=StreamID)
51+
4052
def getKetClient(service_name,region_name,use_ssl=False,ks_access_key_id=None, ks_secret_access_key=None):
4153
return KetClient(service_name,region_name,use_ssl,ks_access_key_id, ks_secret_access_key)

0 commit comments

Comments
 (0)