2023-10-03 16:11:25 +00:00
|
|
|
import "pkg:/source/api/Image.bs"
|
|
|
|
import "pkg:/source/api/baserequest.bs"
|
|
|
|
import "pkg:/source/utils/config.bs"
|
2023-05-03 21:21:04 +00:00
|
|
|
|
2019-05-03 12:48:59 +00:00
|
|
|
sub setFields()
|
2021-07-09 20:08:32 +00:00
|
|
|
json = m.top.json
|
|
|
|
|
|
|
|
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 = "Series"
|
|
|
|
m.top.overview = json.overview
|
|
|
|
|
|
|
|
if json.ProductionYear <> invalid
|
|
|
|
m.top.SubTitle = json.ProductionYear
|
2020-06-15 16:05:48 +00:00
|
|
|
end if
|
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
setPoster()
|
2019-05-10 04:24:19 +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
|
2020-06-15 16:05:48 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
if m.top.json.ImageTags.Primary <> invalid
|
|
|
|
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary }
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
|
|
|
else if m.top.json.BackdropImageTags <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] }
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
|
|
|
end if
|
2020-06-15 16:05:48 +00:00
|
|
|
|
2021-07-09 20:08:32 +00:00
|
|
|
' Add Backdrop Image
|
|
|
|
if m.top.json.BackdropImageTags <> invalid
|
2022-12-26 20:42:50 +00:00
|
|
|
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] }
|
2021-07-09 20:08:32 +00:00
|
|
|
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
|
|
|
end if
|
|
|
|
|
|
|
|
end if
|
2020-06-15 16:05:48 +00:00
|
|
|
end sub
|