From c2c3cccd8f93aa4b3f67984705f5c5095fa5b4e6 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sun, 19 Apr 2026 00:22:00 +0000 Subject: [PATCH] Fetch Frigate snapshots through Roku HTTP client --- builds/visionLabs-roku-smoketest.zip | Bin 2491 -> 2790 bytes components/MainScene.brs | 40 +++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/builds/visionLabs-roku-smoketest.zip b/builds/visionLabs-roku-smoketest.zip index b5003e232a3e9d32974f30ecfa55d66507b8e848..9c0f14780c51f87deb7a9729d90b2bafa67e750e 100644 GIT binary patch delta 1148 zcmV-?1cUp#6Xq4Lb^(8`0+U?k+gGF$1ONcY4FCWb0001EZ*6dIZe?zCb1zL{X>LJPGJdFCxyKx&}S>lvUk47iFOn4-5*15*b6#l9bDjEt+lK; z1^%5~D@7kO0(&N+B{>n4z<0_R8pZ z40c@HME~*AMWpcXF)9ul(6%EjZmZd8B3X7mWZL0S9nw%7{58opJfHBAe^= zlk840i&AUC&prSOhpw{(H97d4eKa$*>54DZ=o_82W{oJ|K`F)j*hvv}) z2}LsEo~HNy-YG^df*}54ECp68+VRy>L&r35)#9UuasMX@e7ZJfhx6SYa$k!jxh!nL z%w7yy)i%aL2h|C-CsD7{%^$`FZ=_K-JIAHI9|IDQ2Rq@fKiy|37r2w?fV4 zSL=cwtq&9xy0N!{jbbPS$0x^|Ca(A1Tm5x4fXh1u8>WCayfWHxcil=J4pQKC7cEB` zZ@bU7c&%z#St*$MzsLWGHZ5l&36mdZF{1*PRV<=G#}K69fPN$PJV72v!2M1(Qk%L<0T? OlaL7|29OB=0001K!y}pi delta 847 zcmV-V1F-z&6}uC#b^#7@ypmi~sOQ4y0ssKr36sqQ8-HSQbDdR9PuoBcz57?Je6mGw zNZS*FN)ZLAJy2A{32|84>tw;~TD#*G{(Wb^{1qpm<$x2i&@3#;t1r^ameT6kT0I%(}<`+9Hxo5gB;O*kRaL*vO{}M%|2>L%PT1= zzQF;S>F73(BK$YD7^tFuko+%3%e5{zzu~p1_hoawEG%s4s?^!DmcnOo7IeF#O0yqm zNH9$5a`TG7d&3e3O3B4n5-YjZS{9rF|IOA)(SP@tz?O+YNlpYAus6WK@q?gw%?L=+ zm>gupqH|LWTIHgcDtXmWaM`m`GJXBVH4NlPC_=s6zZ~N zn4C=G`5<%5goGJ(zP{b8lfK-_&cX~mTW(kKbiNFa83E2#*_kY{F^qpb~87 z_e9}rRkAuWjrDPi^T=yB!-HunC&(*n_<#5OLD1y;H?L`zVHEZ#GdI4hRc7RQ%j@#q z%LDhpABBYvosK-sP=ov|yUxmL&GsjW(>U}iLNE|AkR8{M0xfnvT8*ET#9|n z3CjLw{>%ypHS}*%^AWd%i_PI(?=KN<#sKp1W8^kGR6ZPocj%XV?jki5wytsAxqsXd zQ&{Rd#7@(DfA2IzMqyn4q0qo;NgKZ0r$3|9WsP4oWY3L1dLw=8?+sGIP+LfRFBW8# z+Jv$FNvK%`i6Jp~Ki74O>q68_gfI4vnN4b@o!Culeidi)dc$1eFxwN07^WE%xr4PR zD|D~z=r2%90|XQR000O8a=emUag$mK53|z+JOmDMypmi~sOQ4y0ssKr36mWPRsxCy ZlhFkllaC520@DVQy9y-+We5NO003A!n(Y7p diff --git a/components/MainScene.brs b/components/MainScene.brs index d2a4ec6..9d037df 100644 --- a/components/MainScene.brs +++ b/components/MainScene.brs @@ -37,7 +37,8 @@ sub loadConfig() end if cameras = config.cameras - m.status.text = cameras.count().toStr() + " cameras loaded, snapshot-first prototype" + m.status.text = cameras.count().toStr() + " cameras loaded, fetching snapshots..." + loadedCount = 0 for i = 0 to m.cameraNodes.count() - 1 poster = m.cameraPosters[i] @@ -55,13 +56,25 @@ sub loadConfig() label = label + chr(10) + "Frigate ID: " + camera.frigateCamera end if - poster.uri = buildSnapshotUrl(config, camera) - node.text = label + snapshotUrl = buildSnapshotUrl(config, camera) + targetPath = "tmp:/" + camera.id + ".jpg" + result = fetchSnapshot(snapshotUrl, targetPath) + + if result.success then + poster.uri = targetPath + loadedCount = loadedCount + 1 + node.text = label + else + poster.uri = "" + node.text = label + chr(10) + "Snapshot failed (" + result.code.toStr() + ")" + end if else poster.uri = "" node.text = "Empty slot" end if end for + + m.status.text = loadedCount.toStr() + " of " + cameras.count().toStr() + " snapshots loaded" end sub function buildSnapshotUrl(config as Object, camera as Object) as String @@ -88,3 +101,24 @@ function buildSnapshotUrl(config as Object, camera as Object) as String return baseUrl + path end function + +function fetchSnapshot(url as String, filePath as String) as Object + result = { + success: false + code: 0 + } + + if url = "" then + return result + end if + + transfer = CreateObject("roUrlTransfer") + transfer.SetCertificatesFile("common:/certs/ca-bundle.crt") + transfer.InitClientCertificates() + transfer.SetUrl(url) + + result.success = transfer.GetToFile(filePath) + result.code = transfer.GetResponseCode() + + return result +end function