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
|
end if
|
||||||
|
|
||||||
cameras = config.cameras
|
cameras = config.cameras
|
||||||
m.status.text = cameras.count().toStr() + " cameras loaded, fetching snapshots..."
|
m.status.text = cameras.count().toStr() + " cameras loaded, snapshot-first prototype"
|
||||||
loadedCount = 0
|
|
||||||
|
|
||||||
for i = 0 to m.cameraNodes.count() - 1
|
for i = 0 to m.cameraNodes.count() - 1
|
||||||
poster = m.cameraPosters[i]
|
poster = m.cameraPosters[i]
|
||||||
@@ -56,25 +55,13 @@ sub loadConfig()
|
|||||||
label = label + chr(10) + "Frigate ID: " + camera.frigateCamera
|
label = label + chr(10) + "Frigate ID: " + camera.frigateCamera
|
||||||
end if
|
end if
|
||||||
|
|
||||||
snapshotUrl = buildSnapshotUrl(config, camera)
|
poster.uri = buildSnapshotUrl(config, camera)
|
||||||
targetPath = "tmp:/" + camera.id + ".jpg"
|
node.text = label
|
||||||
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
|
else
|
||||||
poster.uri = ""
|
poster.uri = ""
|
||||||
node.text = "Empty slot"
|
node.text = "Empty slot"
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
|
|
||||||
m.status.text = loadedCount.toStr() + " of " + cameras.count().toStr() + " snapshots loaded"
|
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
function buildSnapshotUrl(config as Object, camera as Object) as String
|
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
|
return baseUrl + path
|
||||||
end function
|
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