Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-04-21 10:40:30 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b5b5202ed21b821377d6303befe8193176f33ad9
b5b5202e
1 parent
b85e6679
update cdn api server.
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
16 行增加
和
1 行删除
trunk/research/api-server/server.py
trunk/research/api-server/server.py
查看文件 @
b5b5202
...
...
@@ -449,6 +449,7 @@ class CdnNode:
data
[
"heartbeat"
]
=
self
.
heartbeat
data
[
"heartbeat_h"
]
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
time
.
localtime
(
self
.
heartbeat
))
data
[
"clients"
]
=
self
.
clients
data
[
"summaries"
]
=
"http://
%
s:1985/api/v1/summaries"
%
(
self
.
ip
)
return
data
'''
...
...
@@ -481,7 +482,7 @@ class RESTNodes(object):
for
node
in
self
.
__nodes
:
if
node
.
id
==
target_node
.
id
:
continue
if
node
.
public_ip
==
target_node
.
public_ip
:
if
node
.
public_ip
==
target_node
.
public_ip
and
node
.
srs_status
==
"running"
:
peers
.
append
(
node
)
return
peers
...
...
@@ -537,6 +538,19 @@ class RESTNodes(object):
#return html
raise
cherrypy
.
HTTPRedirect
(
html
)
return
rtmp_url
elif
type
==
"gslb"
:
return
json
.
dumps
({
"code"
:
Error
.
success
,
"data"
:
{
"edge"
:
server
,
"client"
:
ip
,
"peers"
:
self
.
__json_dump_nodes
(
peers
),
"streams"
:
{
"hls-cztv-html"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/rtmp_cztv01-sd"
,
"hls-cztv-m3u8"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=m3u8&origin=demo.chnvideo.com&port=8080&stream=live/rtmp_cztv01-sd"
,
"rtmp-cztv-html"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=rtmp&format=html&origin=demo.chnvideo.com&vhost=__defaultVhost__&port=1935&stream=live/rtmp_cztv01-sd"
,
"hls-livestream-html"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream"
,
"hls-livestream-m3u8"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=m3u8&origin=demo.chnvideo.com&port=8080&stream=live/livestream"
,
"rtmp-livestream-html"
:
"http://demo.chnvideo.com:8085/api/v1/nodes?type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream"
}
}})
return
json
.
dumps
({
"code"
:
Error
.
success
,
"data"
:
data
})
...
...
@@ -778,6 +792,7 @@ class V1(object):
"summary"
:
"for srs cdn node"
,
"POST ip=node_ip&os=node_os"
:
"register a new node"
,
"GET"
:
"get the active edge nodes"
,
"GET type=gslb&origin=demo.chnvideo.com"
:
"get the gslb edge ip"
,
"GET type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream"
:
"get the play url, html for hls"
,
"GET type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream"
:
"get the play url, for rtmp"
},
...
...
请
注册
或
登录
后发表评论