Show upcoming videos correctly

This commit is contained in:
Brahim Hadriche committed 2022-12-08 21:17:01 -05:00
1 parent 80d169f386
commit deeaac06f7
3 files changed
+62 -5

No files matched your search

+13 -5
View File
@@ -7,12 +7,16 @@ function OnContentSet()
m.top.FindNode("titleLabel").text = content.title
m.top.FindNode("authorLabel").text = content.author
publishedText = validstr(content.publishedText)
viewCount = FormatViewCount(content.viewCount)
if publishedText = "" and viewCount = ""
m.top.FindNode("viewCountDateLabel").text = ""
if IsVideoUpcoming(content)
m.top.FindNode("viewCountDateLabel").text = `Premeres in ${TimeUtils.GetFormattedTimeLeft(content.premiereTimestamp)}`
else
m.top.FindNode("viewCountDateLabel").text = `${publishedText} • ${viewCount}`
publishedText = validstr(content.publishedText)
viewCount = FormatViewCount(content.viewCount)
if publishedText = "" and viewCount = ""
m.top.FindNode("viewCountDateLabel").text = ""
else
m.top.FindNode("viewCountDateLabel").text = `${publishedText} • ${viewCount}`
end if
end if
thumbnail = m.top.FindNode("thumbnail")
@@ -46,6 +50,10 @@ function GetThumbnailUrl(videoThumbnails as object, quality = "medium" as string
return videoThumbnails[0].url
end function
function IsVideoUpcoming(metadata as object) as boolean
return metadata.isUpcoming = true
end function
function IsVideoLive(metadata as object) as boolean
if metadata.liveNow = true
return true