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]]"
|
rowitemSize="[[320,180]]"
|
||||||
rowItemSpacing="[[20,0]]"
|
rowItemSpacing="[[20,0]]"
|
||||||
itemSize="[1160,270]"
|
itemSize="[1160,270]"
|
||||||
|
itemSpacing="[0,20]"
|
||||||
rowLabelOffset="[[50,20]]"
|
rowLabelOffset="[[50,20]]"
|
||||||
focusXOffset="[50]"
|
focusXOffset="[50]"
|
||||||
showRowLabel="[true]"
|
showRowLabel="[true]"
|
||||||
|
|||||||
@@ -9,11 +9,15 @@ end sub
|
|||||||
sub GetContent()
|
sub GetContent()
|
||||||
rootChildren = []
|
rootChildren = []
|
||||||
|
|
||||||
trendingJson = RokuYoutube.Services.Invidious.GetTrending()
|
trendingTypes = [invalid, "Music", "Gaming", "Movies"]
|
||||||
trending = GetCategoryContent("Trending", trendingJson)
|
for each trendingType in trendingTypes
|
||||||
if trending <> invalid
|
trendingJson = RokuYoutube.Services.Invidious.GetTrending(trendingType)
|
||||||
rootChildren.Push(trending)
|
title = trendingType <> invalid ? `Trending - ${trendingType}` : "Trending"
|
||||||
end if
|
trending = GetCategoryContent(title, trendingJson)
|
||||||
|
if trending <> invalid
|
||||||
|
rootChildren.Push(trending)
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
|
||||||
popularJson = RokuYoutube.Services.Invidious.GetPopular()
|
popularJson = RokuYoutube.Services.Invidious.GetPopular()
|
||||||
popular = GetCategoryContent("Popular", popularJson)
|
popular = GetCategoryContent("Popular", popularJson)
|
||||||
@@ -27,6 +31,15 @@ sub GetContent()
|
|||||||
rootChildren.Push(feed)
|
rootChildren.Push(feed)
|
||||||
end if
|
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
|
' set up a root ContentNode to represent rowList on the GridScreen
|
||||||
contentNode = CreateObject("roSGNode", "ContentNode")
|
contentNode = CreateObject("roSGNode", "ContentNode")
|
||||||
contentNode.Update({
|
contentNode.Update({
|
||||||
@@ -38,7 +51,7 @@ sub GetContent()
|
|||||||
end sub
|
end sub
|
||||||
|
|
||||||
function GetCategoryContent(category as string, json as object) as object
|
function GetCategoryContent(category as string, json as object) as object
|
||||||
if json <> invalid
|
if json <> invalid and json.Count() > 0
|
||||||
row = {}
|
row = {}
|
||||||
row.title = category
|
row.title = category
|
||||||
row.children = []
|
row.children = []
|
||||||
|
|||||||
@@ -24,9 +24,15 @@ namespace RokuYoutube.Services.Invidious
|
|||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetTrending()
|
function GetTrending(trendingType = invalid as string)
|
||||||
url = `${API_URL}${TRENDING_ENDPOINT}`
|
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
|
if response.statuscode = 200
|
||||||
return response.json
|
return response.json
|
||||||
|
|||||||
Reference in new issue
Block a user