Browse Source

fix getpusher list JSON format error

修改了获取推送列表时JSON format出错的bug
pull/132/head
macbookpro 6 years ago
parent
commit
3917853f89
  1. 6
      routers/stats.go

6
routers/stats.go

@ -51,15 +51,15 @@ func (h *APIHandler) Pushers(c *gin.Context) {
pushers := make([]interface{}, 0) pushers := make([]interface{}, 0)
for _, pusher := range rtsp.Instance.GetPushers() { for _, pusher := range rtsp.Instance.GetPushers() {
port := pusher.Server().TCPPort port := pusher.Server().TCPPort
rtsp := fmt.Sprintf("rtsp://%s:%d%s", hostname, port, pusher.Path) rtsp := fmt.Sprintf("rtsp://%s:%d%s", hostname, port, pusher.Path())
if port == 554 { if port == 554 {
rtsp = fmt.Sprintf("rtsp://%s%s", hostname, pusher.Path) rtsp = fmt.Sprintf("rtsp://%s%s", hostname, pusher.Path())
} }
if form.Q != "" && !strings.Contains(strings.ToLower(rtsp), strings.ToLower(form.Q)) { if form.Q != "" && !strings.Contains(strings.ToLower(rtsp), strings.ToLower(form.Q)) {
continue continue
} }
pushers = append(pushers, map[string]interface{}{ pushers = append(pushers, map[string]interface{}{
"id": pusher.ID, "id": pusher.ID(),
"path": rtsp, "path": rtsp,
"transType": pusher.TransType.String(), "transType": pusher.TransType.String(),
"inBytes": pusher.InBytes(), "inBytes": pusher.InBytes(),

Loading…
Cancel
Save