owncast/core/status.go
2020-11-12 15:14:59 -08:00

32 lines
836 B
Go

package core
import (
"github.com/owncast/owncast/config"
"github.com/owncast/owncast/models"
)
// GetStatus gets the status of the system.
func GetStatus() models.Status {
if _stats == nil {
return models.Status{}
}
return models.Status{
Online: IsStreamConnected(),
ViewerCount: len(_stats.Clients),
OverallMaxViewerCount: _stats.OverallMaxViewerCount,
SessionMaxViewerCount: _stats.SessionMaxViewerCount,
LastDisconnectTime: _stats.LastDisconnectTime,
LastConnectTime: _stats.LastConnectTime,
VersionNumber: config.Config.VersionNumber,
}
}
// setBroadcaster will store the current inbound broadcasting details.
func setBroadcaster(broadcaster models.Broadcaster) {
_broadcaster = &broadcaster
}
func GetBroadcaster() *models.Broadcaster {
return _broadcaster
}