Files
playlet-piped/playlet-lib/src/components/VideoFeed/VideoRowCell/PlaylistRowCell.bs
T
Brahim Hadricheandgithub-action linter bed8223e76 [Part 2] Innertube (#513)
* Parse author in videoRenderer

* Parse more fields

* Parse live badge

* playlist video count

* Parse more things

* parse playlists and albums

* More parsing work

* announcement and changelog

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2024-12-22 16:04:36 -05:00

48 lines
1.2 KiB
Plaintext

import "pkg:/source/utils/Types.bs"
function Init()
m.videoCountRect = m.top.FindNode("videoCountRect")
m.videoCountLabel = m.top.FindNode("videoCountLabel")
end function
function OnContentSet() as void
content = m.top.itemContent
if content = invalid
return
end if
m.top.title = content.title
' NOTE: "_author" not "author". See PlaylistContentNode.xml for explanation.
m.top.author = content._author
m.top.updated = content.updatedText
m.top.thumbnailUri = content.thumbnail
videoCountText = content.videoCountText
if content.videoCount = -1 and videoCountText = ""
m.top.videoCountLabelVisible = false
else
m.top.videoCountLabelVisible = true
SetVideoCount(videoCountText)
end if
end function
function SetVideoCount(videoCountText as string) as void
m.top.videoCount = videoCountText
label = m.videoCountLabel
rect = m.videoCountRect
if label = invalid or rect = invalid
return
end if
rectParent = rect.getParent()
size = label.localBoundingRect()
rect.width = size.width + 16
rect.translation = [rectParent.width - rect.width, rect.translation[1]]
end function