27 lines
732 B
Go
27 lines
732 B
Go
package cmrdr
|
|
|
|
import "fmt"
|
|
|
|
func replace(streams []Stream, new Stream) []Stream {
|
|
updatedSlice := streams[:0]
|
|
|
|
for _, old := range streams {
|
|
if old.Address == new.Address && old.Port == new.Port {
|
|
updatedSlice = append(updatedSlice, new)
|
|
} else {
|
|
updatedSlice = append(updatedSlice, old)
|
|
}
|
|
}
|
|
return updatedSlice
|
|
}
|
|
|
|
// GetCameraRTSPURL generates a stream's RTSP URL
|
|
func GetCameraRTSPURL(stream Stream) string {
|
|
return "rtsp://" + stream.Username + ":" + stream.Password + "@" + stream.Address + ":" + fmt.Sprint(stream.Port) + "/" + stream.Route
|
|
}
|
|
|
|
// GetCameraAdminPanelURL returns the URL to the camera's admin panel
|
|
func GetCameraAdminPanelURL(stream Stream) string {
|
|
return "http://" + stream.Address + "/"
|
|
}
|