Show upcoming videos correctly
This commit is contained in:
1 parent
80d169f386
commit
deeaac06f7
3 files changed
+62
-5
No files matched your search
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Bug where SponsorBlock returning videoDuration of zero causes the app to hang
|
- Bug where SponsorBlock returning videoDuration of zero causes the app to hang
|
||||||
- Bug where app would lose focus when casting from web app
|
- Bug where app would lose focus when casting from web app
|
||||||
- Bug where DASH stream is not compatible. Play format stream as a fallback
|
- Bug where DASH stream is not compatible. Play format stream as a fallback
|
||||||
|
- Showing upcoming videos correctly
|
||||||
|
|
||||||
## [0.5.0] - 2022-12-02
|
## [0.5.0] - 2022-12-02
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -7,12 +7,16 @@ function OnContentSet()
|
|||||||
m.top.FindNode("titleLabel").text = content.title
|
m.top.FindNode("titleLabel").text = content.title
|
||||||
m.top.FindNode("authorLabel").text = content.author
|
m.top.FindNode("authorLabel").text = content.author
|
||||||
|
|
||||||
publishedText = validstr(content.publishedText)
|
if IsVideoUpcoming(content)
|
||||||
viewCount = FormatViewCount(content.viewCount)
|
m.top.FindNode("viewCountDateLabel").text = `Premeres in ${TimeUtils.GetFormattedTimeLeft(content.premiereTimestamp)}`
|
||||||
if publishedText = "" and viewCount = ""
|
|
||||||
m.top.FindNode("viewCountDateLabel").text = ""
|
|
||||||
else
|
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
|
end if
|
||||||
|
|
||||||
thumbnail = m.top.FindNode("thumbnail")
|
thumbnail = m.top.FindNode("thumbnail")
|
||||||
@@ -46,6 +50,10 @@ function GetThumbnailUrl(videoThumbnails as object, quality = "medium" as string
|
|||||||
return videoThumbnails[0].url
|
return videoThumbnails[0].url
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function IsVideoUpcoming(metadata as object) as boolean
|
||||||
|
return metadata.isUpcoming = true
|
||||||
|
end function
|
||||||
|
|
||||||
function IsVideoLive(metadata as object) as boolean
|
function IsVideoLive(metadata as object) as boolean
|
||||||
if metadata.liveNow = true
|
if metadata.liveNow = true
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -14,6 +14,54 @@ namespace TimeUtils
|
|||||||
return minutes + ":" + seconds
|
return minutes + ":" + seconds
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function GetFormattedTimeLeft(unixTimestamp as integer) as string
|
||||||
|
if unixTimestamp = invalid
|
||||||
|
return "N/A"
|
||||||
|
end if
|
||||||
|
|
||||||
|
currentTime = TimeUtils.Now().AsSeconds()
|
||||||
|
timeLeft = unixTimestamp - currentTime
|
||||||
|
if timeLeft <= 0
|
||||||
|
return "now"
|
||||||
|
end if
|
||||||
|
|
||||||
|
if timeLeft < 60
|
||||||
|
result = `${timeLeft} second`
|
||||||
|
if timeLeft > 1
|
||||||
|
result += "s"
|
||||||
|
end if
|
||||||
|
return result
|
||||||
|
end if
|
||||||
|
|
||||||
|
timeLeft = timeLeft / 60.0
|
||||||
|
if timeLeft < 60
|
||||||
|
timeLeft = Cint(timeLeft)
|
||||||
|
result = `${timeLeft} minute`
|
||||||
|
if timeLeft > 1
|
||||||
|
result += "s"
|
||||||
|
end if
|
||||||
|
return result
|
||||||
|
end if
|
||||||
|
|
||||||
|
timeLeft = timeLeft / 60.0
|
||||||
|
if timeLeft < 24
|
||||||
|
timeLeft = Cint(timeLeft)
|
||||||
|
result = `${timeLeft} hour`
|
||||||
|
if timeLeft > 1
|
||||||
|
result += "s"
|
||||||
|
end if
|
||||||
|
return result
|
||||||
|
else
|
||||||
|
timeLeft = timeLeft / 24.0
|
||||||
|
timeLeft = Cint(timeLeft)
|
||||||
|
result = `${timeLeft} day`
|
||||||
|
if timeLeft > 1
|
||||||
|
result += "s"
|
||||||
|
end if
|
||||||
|
return result
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
function Now() as object
|
function Now() as object
|
||||||
this = m.now
|
this = m.now
|
||||||
if this = invalid
|
if this = invalid
|
||||||
|
|||||||
Reference in new issue
Block a user