2020-02-23 04:47:00 +00:00
|
|
|
sub init()
|
|
|
|
m.title = m.top.findNode("title")
|
2020-05-05 21:09:18 +00:00
|
|
|
m.title.text = tr("Loading...")
|
2020-02-23 04:47:00 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
function itemContentChanged() as void
|
|
|
|
item = m.top.itemContent
|
|
|
|
itemData = item.json
|
2020-02-23 18:58:24 +00:00
|
|
|
if itemData.indexNumber <> invalid then
|
|
|
|
indexNumber = itemData.indexNumber.toStr() + ". "
|
2020-05-05 21:09:18 +00:00
|
|
|
else
|
2020-02-23 18:58:24 +00:00
|
|
|
indexNumber = ""
|
|
|
|
end if
|
2020-02-23 19:04:02 +00:00
|
|
|
m.top.findNode("title").text = indexNumber + item.title
|
2020-02-23 04:47:00 +00:00
|
|
|
m.top.findNode("poster").uri = item.posterURL
|
|
|
|
m.top.findNode("overview").text = item.overview
|
|
|
|
|
|
|
|
if type(itemData.RunTimeTicks) = "LongInteger"
|
2020-03-18 03:05:18 +00:00
|
|
|
m.top.findNode("runtime").text = stri(getRuntime()).trim() + " mins"
|
2020-05-06 17:56:34 +00:00
|
|
|
m.top.findNode("endtime").text = tr("Ends at %1").Replace("%1", getEndTime())
|
2020-02-23 04:47:00 +00:00
|
|
|
end if
|
|
|
|
if itemData.communityRating <> invalid then
|
2020-03-05 04:00:33 +00:00
|
|
|
m.top.findNode("star").visible = true
|
2020-02-23 04:47:00 +00:00
|
|
|
m.top.findNode("communityRating").text = str(int(itemData.communityRating*10)/10)
|
2020-03-05 04:00:33 +00:00
|
|
|
else
|
|
|
|
m.top.findNode("star").visible = false
|
2020-02-23 04:47:00 +00:00
|
|
|
end if
|
|
|
|
end function
|
|
|
|
|
|
|
|
function getRuntime() as integer
|
|
|
|
itemData = m.top.itemContent.json
|
|
|
|
|
|
|
|
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
|
|
|
|
' then 1/60 for seconds to minutess... 1/600,000,000
|
|
|
|
return int(itemData.RunTimeTicks / 600000000.0)
|
|
|
|
end function
|
|
|
|
|
|
|
|
function getEndTime() as string
|
|
|
|
itemData = m.top.itemContent.json
|
|
|
|
date = CreateObject("roDateTime")
|
|
|
|
duration_s = int(itemData.RunTimeTicks / 10000000.0)
|
|
|
|
date.fromSeconds(date.asSeconds() + duration_s)
|
|
|
|
date.toLocalTime()
|
|
|
|
|
2020-04-10 08:04:48 +00:00
|
|
|
return formatTime(date)
|
2020-02-23 04:47:00 +00:00
|
|
|
end function
|