Revert "Fetch Frigate snapshots through Roku HTTP client"
This reverts commit c2c3cccd8f.
This commit is contained in:
Binary file not shown.
@@ -37,8 +37,7 @@ sub loadConfig()
|
||||
end if
|
||||
|
||||
cameras = config.cameras
|
||||
m.status.text = cameras.count().toStr() + " cameras loaded, fetching snapshots..."
|
||||
loadedCount = 0
|
||||
m.status.text = cameras.count().toStr() + " cameras loaded, snapshot-first prototype"
|
||||
|
||||
for i = 0 to m.cameraNodes.count() - 1
|
||||
poster = m.cameraPosters[i]
|
||||
@@ -56,25 +55,13 @@ sub loadConfig()
|
||||
label = label + chr(10) + "Frigate ID: " + camera.frigateCamera
|
||||
end if
|
||||
|
||||
snapshotUrl = buildSnapshotUrl(config, camera)
|
||||
targetPath = "tmp:/" + camera.id + ".jpg"
|
||||
result = fetchSnapshot(snapshotUrl, targetPath)
|
||||
|
||||
if result.success then
|
||||
poster.uri = targetPath
|
||||
loadedCount = loadedCount + 1
|
||||
poster.uri = buildSnapshotUrl(config, camera)
|
||||
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
|
||||
@@ -101,24 +88,3 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user