Create Component Library (#43)
* Move src under playlet-lib * Update configuration * Update script * Update script * Working version * Vs code config WIP * Package lock sync * Lint fix * Fix images * Reuse config files * Kind of a working setup * Lock node version * Rename scripts to tools * Fix build scripts, lib url system * Lint fix * rale * Fix args and web server * Load fallbacks and build script cleanups * Remove unused method * no message * no message * Remove generic message field * Lint fix * no message * Use loading indicator on main app * Add playlet lib version to settings --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
90df81df4b
commit
9d8a3d1cea
156 files changed
+3341
-213
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import "pkg:/source/services/InvidiousService.bs"
|
||||
|
||||
@asynctask
|
||||
function GetHomeScreenContent(input as object) as object
|
||||
rootChildren = []
|
||||
|
||||
service = new InvidiousService()
|
||||
|
||||
requestData = input.requestData
|
||||
|
||||
response = service.MakeRequest(requestData)
|
||||
if response <> invalid
|
||||
if type(response) = "roAssociativeArray"
|
||||
for each key in response
|
||||
rowContent = GetCategoryContent(key, response[key])
|
||||
if rowContent <> invalid
|
||||
rootChildren.Push(rowContent)
|
||||
end if
|
||||
end for
|
||||
else
|
||||
rowContent = GetCategoryContent(requestData.title, response)
|
||||
if rowContent <> invalid
|
||||
rootChildren.Push(rowContent)
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
return {
|
||||
index: input.index,
|
||||
rootChildren: rootChildren
|
||||
}
|
||||
end function
|
||||
|
||||
function GetCategoryContent(category as string, json as object) as object
|
||||
if json <> invalid and json.Count() > 0
|
||||
row = {}
|
||||
row.title = category
|
||||
row.children = []
|
||||
for each item in json ' parse items and push them to row
|
||||
itemData = GetItemData(item)
|
||||
if itemData <> invalid
|
||||
row.children.Push(itemData)
|
||||
end if
|
||||
end for
|
||||
return row
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function GetItemData(video as object) as object
|
||||
' TODO: handle playlists and channels
|
||||
if video.videoId = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return video
|
||||
end function
|
||||
|
||||
Reference in new issue
Block a user