Code refactoring for onvif device discovery #1991

This commit is contained in:
Alex X
2026-01-18 07:54:48 +03:00
parent bbb9466845
commit 66225973ae
2 changed files with 24 additions and 33 deletions
+5 -7
View File
@@ -7,7 +7,6 @@ import (
"net/url"
"os"
"strconv"
"strings"
"time"
"github.com/AlexxIT/go2rtc/internal/api"
@@ -186,12 +185,11 @@ func apiOnvif(w http.ResponseWriter, r *http.Request) {
u.Path = ""
}
var info string
info = strings.TrimSpace(device.Name + " " + device.Hardware)
if info == "" {
info = "ONVIF Device"
}
items = append(items, &api.Source{Name: u.Host, URL: u.String(), Info: info})
items = append(items, &api.Source{
Name: u.Host,
URL: u.String(),
Info: device.Name + " " + device.Hardware,
})
}
} else {
client, err := onvif.NewClient(src)