2023-05-03 21:21:04 +00:00
|
|
|
import "pkg:/source/api/Image.brs"
|
|
|
|
import "pkg:/source/api/baserequest.brs"
|
|
|
|
import "pkg:/source/utils/config.brs"
|
|
|
|
|
2020-11-23 17:13:57 +00:00
|
|
|
sub setFields()
|
|
|
|
json = m.top.json
|
2021-07-09 20:08:32 +00:00
|
|
|
|
|
|
|
startDate = createObject("roDateTime")
|
2020-11-23 17:13:57 +00:00
|
|
|
endDate = createObject("roDateTime")
|
|
|
|
startDate.FromISO8601String(json.StartDate)
|
|
|
|
endDate.FromISO8601String(json.EndDate)
|
|
|
|
|
|
|
|
m.top.Title = json.Name
|
|
|
|
m.top.PlayStart = startDate.AsSeconds()
|
|
|
|
m.top.PlayDuration = endDate.AsSeconds() - m.top.PlayStart
|
|
|
|
m.top.Id = json.Id
|
|
|
|
m.top.Description = json.overview
|
|
|
|
m.top.EpisodeTitle = json.EpisodeTitle
|
|
|
|
m.top.isLive = json.isLive
|
|
|
|
m.top.isRepeat = json.isRepeat
|
|
|
|
m.top.startDate = json.startDate
|
|
|
|
m.top.endDate = json.endDate
|
|
|
|
m.top.channelId = json.channelId
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
if json.IsSeries <> invalid and json.IsSeries = true
|
2020-11-23 17:13:57 +00:00
|
|
|
if json.IndexNumber <> invalid
|
|
|
|
m.top.episodeNumber = json.IndexNumber
|
|
|
|
end if
|
|
|
|
|
|
|
|
if json.ParentIndexNumber <> invalid
|
|
|
|
m.top.seasonNumber = json.ParentIndexNumber
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
|
|
|
|
setPoster()
|
2021-07-09 20:08:32 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
sub setPoster()
|
2020-11-23 17:13:57 +00:00
|
|
|
if m.top.image <> invalid
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.posterURL = m.top.image.url
|
2020-11-23 17:13:57 +00:00
|
|
|
else
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.json.ImageTags <> invalid and m.top.json.ImageTags.Thumb <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams = { "maxHeight": 500, "maxWidth": 500, "Tag": m.top.json.ImageTags.Thumb }
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.id, "Thumb", imgParams)
|
|
|
|
end if
|
2020-11-23 17:13:57 +00:00
|
|
|
end if
|
2021-07-09 20:08:32 +00:00
|
|
|
end sub
|