jf-roku/components/data/MovieData.brs

73 lines
2.3 KiB
Plaintext
Raw Normal View History

2019-05-03 12:48:59 +00:00
sub setFields()
2021-07-09 20:08:32 +00:00
json = m.top.json
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
m.top.id = json.id
m.top.Title = json.name
m.top.Description = json.overview
m.top.favorite = json.UserData.isFavorite
m.top.watched = json.UserData.played
m.top.Type = "Movie"
2022-03-13 00:36:11 +00:00
if json.MediaSourceCount <> invalid and json.MediaSourceCount > 1
m.top.mediaSources = []
for each source in json.MediaSources
m.top.mediaSources.push(source)
end for
end if
2021-07-09 20:08:32 +00:00
if json.ProductionYear <> invalid
m.top.SubTitle = json.ProductionYear
end if
if json.OfficialRating <> invalid and json.OfficialRating <> ""
m.top.Rating = json.OfficialRating
if m.top.SubTitle <> ""
m.top.SubTitle = m.top.SubTitle + " - " + m.top.Rating
else
m.top.SubTitle = m.top.Rating
end if
end if
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
setPoster()
setContainer()
2019-05-03 12:48:59 +00:00
end sub
sub setPoster()
2021-07-09 20:08:32 +00:00
if m.top.image <> invalid
m.top.posterURL = m.top.image.url
else
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
if m.top.json.ImageTags.Primary <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary }
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
else if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
else if m.top.json.ParentThumbImageTag <> invalid and m.top.json.ParentThumbItemId <> invalid
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag }
m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams)
end if
2021-07-09 20:08:32 +00:00
' Add Backdrop Image
if m.top.json.BackdropImageTags[0] <> invalid
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
end if
2021-07-09 20:08:32 +00:00
end if
2019-05-03 12:48:59 +00:00
end sub
sub setContainer()
2021-07-09 20:08:32 +00:00
json = m.top.json
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
if json.mediaSources = invalid then return
if json.mediaSources.count() = 0 then return
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
m.top.container = json.mediaSources[0].container
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
if m.top.container = invalid then m.top.container = ""
2019-05-03 12:48:59 +00:00
2021-07-09 20:08:32 +00:00
if m.top.container = "m4v" or m.top.container = "mov"
m.top.container = "mp4"
end if
2019-05-03 12:48:59 +00:00
end sub