ring: skip refetching cameras to increase loading speed and refactor ring url

This commit is contained in:
seydx
2025-05-08 16:09:04 +02:00
parent 7107508286
commit 124556f4db
4 changed files with 20 additions and 27 deletions
+4 -4
View File
@@ -11,10 +11,10 @@ type SnapshotProducer struct {
core.Connection
client *RingRestClient
camera *CameraData
cameraID string
}
func NewSnapshotProducer(client *RingRestClient, camera *CameraData) *SnapshotProducer {
func NewSnapshotProducer(client *RingRestClient, cameraID string) *SnapshotProducer {
return &SnapshotProducer{
Connection: core.Connection{
ID: core.NewID(),
@@ -36,13 +36,13 @@ func NewSnapshotProducer(client *RingRestClient, camera *CameraData) *SnapshotPr
},
},
client: client,
camera: camera,
cameraID: cameraID,
}
}
func (p *SnapshotProducer) Start() error {
// Fetch snapshot
response, err := p.client.Request("GET", fmt.Sprintf("https://app-snaps.ring.com/snapshots/next/%d", int(p.camera.ID)), nil)
response, err := p.client.Request("GET", fmt.Sprintf("https://app-snaps.ring.com/snapshots/next/%s", p.cameraID), nil)
if err != nil {
return err
}