mirror of
https://github.com/cedricve/go-onvif.git
synced 2025-10-07 17:40:50 +08:00
Implement some API for media service
This commit is contained in:
7
utils.go
7
utils.go
@@ -2,6 +2,7 @@ package onvif
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,12 @@ func interfaceToBool(src interface{}) bool {
|
||||
return strings.ToLower(strBool) == "true"
|
||||
}
|
||||
|
||||
func interfaceToInt(src interface{}) int {
|
||||
strNumber := interfaceToString(src)
|
||||
number, _ := strconv.Atoi(strNumber)
|
||||
return number
|
||||
}
|
||||
|
||||
func prettyJSON(src interface{}) string {
|
||||
result, _ := json.MarshalIndent(&src, "", " ")
|
||||
return string(result)
|
||||
|
Reference in New Issue
Block a user