Populate home screen a bit
This commit is contained in:
1 parent
201388bd27
commit
28b294dd3b
3 files changed
+28
-8
No files matched your search
@@ -16,6 +16,7 @@
|
||||
rowitemSize="[[320,180]]"
|
||||
rowItemSpacing="[[20,0]]"
|
||||
itemSize="[1160,270]"
|
||||
itemSpacing="[0,20]"
|
||||
rowLabelOffset="[[50,20]]"
|
||||
focusXOffset="[50]"
|
||||
showRowLabel="[true]"
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -24,9 +24,15 @@ namespace RokuYoutube.Services.Invidious
|
||||
end if
|
||||
end function
|
||||
|
||||
function GetTrending()
|
||||
function GetTrending(trendingType = invalid as string)
|
||||
url = `${API_URL}${TRENDING_ENDPOINT}`
|
||||
response = Requests().get(url)
|
||||
|
||||
args = { params: {} }
|
||||
if trendingType <> invalid
|
||||
args.params.type = trendingType
|
||||
end if
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
|
||||
Reference in new issue
Block a user