Handle an abnormal (e.g. 401) response when getting collection

This commit is contained in:
Neil Burrows 2022-04-25 08:24:08 +01:00
parent e9509a68c5
commit 7e348956d1

View File

@ -46,12 +46,11 @@ sub loadItems()
resp = APIRequest(url, params)
data = getJson(resp)
if data.TotalRecordCount <> invalid
m.top.totalRecordCount = data.TotalRecordCount
end if
if data <> invalid
if data.TotalRecordCount <> invalid then m.top.totalRecordCount = data.TotalRecordCount
for each item in data.Items
tmp = invalid
if item.Type = "Movie"
tmp = CreateObject("roSGNode", "MovieData")
@ -65,21 +64,16 @@ sub loadItems()
tmp = CreateObject("roSGNode", "FolderData")
else if item.Type = "Video"
tmp = CreateObject("roSGNode", "VideoData")
else if item.Type = "Photo"
tmp = CreateObject("roSGNode", "PhotoData")
else if item.type = "PhotoAlbum"
tmp = CreateObject("roSGNode", "FolderData")
else
print "[LoadItems] Unknown Type: " item.Type
end if
if tmp <> invalid
tmp.json = item
results.push(tmp)
end if
end for
end if
m.top.content = results