Populate home screen a bit

This commit is contained in:
Brahim Hadriche committed 2022-11-05 14:46:01 -04:00
1 parent 201388bd27
commit 28b294dd3b
3 files changed
+28 -8

No files matched your search

+1
View File
@@ -16,6 +16,7 @@
rowitemSize="[[320,180]]"
rowItemSpacing="[[20,0]]"
itemSize="[1160,270]"
itemSpacing="[0,20]"
rowLabelOffset="[[50,20]]"
focusXOffset="[50]"
showRowLabel="[true]"
+19 -6
View File
@@ -9,11 +9,15 @@ end sub
sub GetContent()
rootChildren = []
trendingJson = RokuYoutube.Services.Invidious.GetTrending()
trending = GetCategoryContent("Trending", trendingJson)
if trending <> invalid
rootChildren.Push(trending)
end if
trendingTypes = [invalid, "Music", "Gaming", "Movies"]
for each trendingType in trendingTypes
trendingJson = RokuYoutube.Services.Invidious.GetTrending(trendingType)
title = trendingType <> invalid ? `Trending - ${trendingType}` : "Trending"
trending = GetCategoryContent(title, trendingJson)
if trending <> invalid
rootChildren.Push(trending)
end if
end for
popularJson = RokuYoutube.Services.Invidious.GetPopular()
popular = GetCategoryContent("Popular", popularJson)
@@ -27,6 +31,15 @@ sub GetContent()
rootChildren.Push(feed)
end if
keywords = ["Funny Animals", "News"]
for each keyword in keywords
json = RokuYoutube.Services.Invidious.Search(keyword, 0, RokuYoutube.Models.Invidious.SearchFilter.SortBy.UploadDate)
data = GetCategoryContent(keyword, json)
if data <> invalid
rootChildren.Push(data)
end if
end for
' set up a root ContentNode to represent rowList on the GridScreen
contentNode = CreateObject("roSGNode", "ContentNode")
contentNode.Update({
@@ -38,7 +51,7 @@ sub GetContent()
end sub
function GetCategoryContent(category as string, json as object) as object
if json <> invalid
if json <> invalid and json.Count() > 0
row = {}
row.title = category
row.children = []